This document forms part of the data and code deposited at:
https://github.com/acp29/Elmasri_GRIN2A

Load package requirements

if (!require(package="tidyverse")) utils::install.packages("tidyverse")
library(tidyverse) 
if (!require(package="lme4")) utils::install.packages("lme4")
library(lme4)  
if (!require(package="HLMdiag")) utils::install.packages("HLMdiag")
library(HLMdiag) 
if (!require(package="parameters")) utils::install.packages("parameters")
library(parameters) 
if (!require(package="car")) utils::install.packages("car")
library(car)  
if (!require(package="performance")) utils::install.packages("performance")
library(performance) 
if (!require(package="BayesFactor")) utils::install.packages("BayesFactor")
library(BayesFactor) 
if (!require(package="bayestestR")) utils::install.packages("bayestestR")
library(bayestestR) 
if (!require(package="stats")) utils::install.packages("stats")
library(stats)
if (!require(package="pCalibrate")) utils::install.packages("pCalibrate")
library(pCalibrate)
if (!require(package="afex")) utils::install.packages("afex")
library(afex)
if (!require(package="emmeans")) utils::install.packages("emmeans")
library(emmeans)
if (!require(package="multcomp")) utils::install.packages("multcomp")
library(multcomp)
if (!require(package="knitr")) utils::install.packages("knitr")
library(knitr)
if (!require(package="kableExtra")) utils::install.packages("kableExtra")
library(kableExtra)
if (!require(package="ggplot2")) utils::install.packages("ggplot2")
library(ggplot2)
if (!require(package="qqplotr")) utils::install.packages("qqplotr")
library(qqplotr)
if (!require(package="gridExtra")) utils::install.packages("gridExtra")
library(gridExtra)
if (!require(package="ggforce")) utils::install.packages("ggforce")
library(ggforce)
if (!require(package="devEMF")) utils::install.packages("devEMF")
library(devEMF)
if (!require(package="effectsize")) utils::install.packages("effectsize")
library(effectsize)

Read text in from file

Data <- read.delim("../data/n2a_ko_nmdar.dat", header = TRUE)
# Implicit nesting (required for anovaBF)
Data %>% 
  mutate(genotype = as.factor(genotype)) %>% 
  mutate(animal = paste0(as.numeric(genotype),animal)) %>% 
  mutate(slice = paste0(animal,slice)) %>% 
  mutate(pair = paste0(slice,pair)) %>% 
  mutate(pair = factor(pair)) -> Data

Factor encoding

Data$genotype <- as.factor(Data$genotype)
Data$transfection <- as.factor(Data$transfection)
Data$animal <- as.factor(Data$animal)
Data$slice <- as.factor(Data$slice)
Data$pair <- as.factor(Data$pair)

Set genotype WT and transfection + as reference levels

Data$genotype <- factor(Data$genotype, ordered=TRUE, levels=c("WT","HET","HOM"))
Data$transfection <- factor(Data$transfection, levels=c("-","+"))

lmer settings

settings <- lmerControl(check.conv.singular = .makeCC(action = "ignore",  tol = 1e-4), boundary.tol=0)

Fit a mixed linear model

# Initialize
variates <- c("peak","rise","decay","dt50","charge")
l <- length(variates)

for (i in 1:l) {
  
variates[i] -> resp  

cat('\n\n\n# Analysis of',resp,'\n\n')

# Plot data
# colours selected from:
#  > library(scales)
#  > show_col(hue_pal()(9))
p1 <- Data %>%
    mutate(genotype_jittered = jitter((as.numeric(genotype)+(as.numeric(transfection)-1)/2.5), 0.5),
           grouping=interaction(pair, genotype)) %>%
    mutate(genotype_transfection = as.numeric(genotype)+(as.numeric(transfection)-1)/2.5) %>%
    ggplot(aes(x=genotype, y=!!sym(resp), group=grouping, color=transfection)) + 
    geom_blank() +
    geom_line(aes(genotype_jittered), alpha=0.33) +
    geom_point(aes(genotype_jittered), alpha=0.9, shape = 16) +
    scale_color_manual(values=c("grey","#00BA38")) +
    stat_summary(mapping = aes(x=genotype_transfection,y=!!sym(resp)), fun.data="median_hilow", fun.args = list(conf.int=0.5), geom="linerange", color="black", size=1.0,inherit.aes=FALSE) + 
    stat_summary(mapping = aes(x=genotype_transfection,y=!!sym(resp)), fun="median", geom="point", shape=21, fill="white", color="black", size=2.5, stroke=1, inherit.aes=FALSE) +
    ylab(resp) +
    ggtitle("a") +
    theme(axis.text.x = element_text(angle = 45, vjust=1, hjust=1),axis.line = element_line(colour="black"),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          panel.background = element_blank(),
          legend.title = element_blank(),
          legend.position = "top")
p2 <- Data %>% 
    pivot_wider(c(genotype,pair,!!sym(resp)),names_from=transfection,values_from=!!sym(resp)) %>% 
    mutate(ratio = `+`/`-`) %>%
    ggplot(aes(x=genotype, y=ratio, colour=genotype)) +
    geom_sina(alpha=0.9, shape = 16) + 
    scale_color_manual(values=c("grey","#619CFF","#F8766D")) +
    stat_summary(fun.data="median_hilow", fun.args = list(conf.int=0.5), geom="linerange", color="black", size=1.0) + 
    stat_summary(fun="median", geom="point", shape=21, fill="white", color="black", size=2.5, stroke=1) +
    ylab("ratio") +
    ggtitle("b") +
    theme(axis.text.x = element_text(angle = 45, vjust=1, hjust=1),axis.line = element_line(colour="black"),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          panel.background = element_blank(),
          legend.position = "none")
grid.arrange(p1, p2, nrow = 1, ncol = 2, top=sprintf("Summary plots of the data for: %s\n",resp))

# Fit full model (with polynomial contrasts) 
contrasts(Data$genotype) <- contr.poly(3) # needed for trend analysis
attr(Data$genotype,"contrasts") %>%
  as.data.frame() %>%
  rownames_to_column(var = "genotype") %>% 
  knitr::kable(caption = sprintf("**Matrix of contrasts on genotype: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()
contrasts(Data$transfection) <- contr.poly(2)
attr(Data$transfection,"contrasts") %>% 
  as.data.frame() %>%
  rownames_to_column(var = "transfection") %>% 
  mutate_at("transfection", str_replace_all, pattern = "\\+", replacement = "\\\\+")  %>% 
  mutate_at("transfection", str_replace_all, pattern = "\\-", replacement = "\\\\-")  %>% 
  knitr::kable(caption = sprintf("**Matrix of contrasts on transfection: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print() 
formula <- sprintf("log(%s) ~ genotype * transfection + (1|animal/slice/pair)", resp)
model <- lme4::lmer(formula, data = Data, REML = TRUE, control = settings, na.action = "na.fail") 

# Checking model assumptions
resid = residuals(model)
n = length(resid)
stdev = sqrt((n-1)/n) * sd(resid) # standard deviation with denominator n
std_resid = resid/stdev
p1 <- ggplot(Data, aes(x = fitted(model), y = std_resid)) +
  geom_point() +
  ggtitle("a") +
  xlab("Fitted values") + ylab("Standardized Residuals") +
  geom_hline(yintercept = 0) +
  geom_quantile(formula=y~x, color="#619CFF", size=1) +
  geom_smooth(method="loess", formula = y ~ x, color="#F8766D", size=1, se=FALSE)
p2 <- ggplot(Data, aes(x = std_resid)) +
  geom_histogram(aes(y=..density..), binwidth = 0.9*n^(-1/5), fill="#619CFF", alpha=0.33)  +
  geom_density(kernel="gaussian", alpha=0, color="#619CFF", size=1) +
  ggtitle("b") +
  xlab("Standardized Residuals") + ylab("Density") +
  geom_vline(xintercept = 0) +
  geom_function(fun = dnorm, args = list(mean=0, sd=1), col = "#F8766D", size = 1)
p3 <- ggplot(Data, aes(sample = std_resid)) +
  geom_qq_band(distribution = "norm", bandType = "ts", mapping = aes(fill = "TS"), fill="#619CFF", alpha = 0.33) +
  stat_qq() + 
  stat_qq_line(color="#F8766D",size=1) +
  ggtitle("c") +
  xlab("Normal Quantiles") + ylab("Sample Quantiles") 
infl <- hlm_influence(model, level="pair:(slice:animal)")
p4 <- infl %>% 
  mutate(influential = cooksd > 1.0) %>% 
  ggplot(aes(x=`pair:(slice:animal)`,y=cooksd, color=influential)) + 
  geom_segment(aes(x=`pair:(slice:animal)`, xend=`pair:(slice:animal)`, y=0, yend=cooksd)) + 
  geom_point() + 
  scale_color_manual(values=c("#619CFF","#F8766D")) + 
  ylab("Cook's distance") +
  ggtitle("d") +
  theme(axis.text.x = element_blank(),
        axis.ticks.x = element_blank(),
        legend.position = "none",
        panel.background = element_rect(color="#EBEBEB"),
        panel.grid = element_blank(),
        panel.grid.minor.y = element_line(color = "white", size=0.25),
        panel.grid.major.y = element_line(color = "white", size=0.5),
        axis.line = element_blank(),
        axis.line.x = element_line(size = 0.5, colour = "black"))
grid.arrange(p1, p2, p3, p4, nrow=2, ncol=2, top=sprintf("Plots of standardized model residuals and Cook's distances: %s\n",resp))


# Calculate ANOVA table for the fitted model (Type III sum of squares)
car::Anova(model, type = 3, test.statistic = "F") %>%       # Uses Kenward-Roger degrees of freedom
  as.data.frame() %>%
  rownames_to_column(var="Source") %>%
  filter(Source != "(Intercept)") -> aov

# Calculate Bayes Factors for ANOVA and append them to the ANOVA data frame
# Inclusion Bayes Factor based on matched models (prior odds uniform-equal)
Data %>% 
  mutate(logresp = log(!!sym(resp))) %>%
  as.data.frame() -> Data
set.seed(123456)
anovaBF(logresp ~ genotype * transfection + animal + slice + pair, 
                 whichRandom = c("animal","slice","pair"), 
                 whichModels = "withmain", 
                 iterations = 20000,
                 data = Data) %>%
  bayesfactor_inclusion(match_models = TRUE) %>% 
  as.data.frame() %>% 
  na.omit() %>%    # removes the (nuisance) random factors
  mutate(BF = exp(log_BF)) %>%
  mutate_at("BF", formatC, format='g',digits = 3) %>% 
  dplyr::select(BF) %>% 
  unlist() -> aov$BF


# Calculate polynomial contrasts and append them to the ANOVA summary table
# I go to the trouble of transforming the t-statistic (which is returned from the linear model) 
# to an F statistic but they give identical p-values; I think this makes more sense and provides 
# more consistency when splitting the source of variation into polynomial contrasts and  
# presenting them in an ANOVA table 
model_parameters(model, ci_method = "kenward", exponentiate = FALSE, effects = "fixed") %>%  
  filter(grepl(":",Parameter)) %>%                          # select interaction terms only
  rename(Source = Parameter) %>%                            # set denominator degrees of freedom
  mutate(Df = 1) %>%                                        # set numerator degrees of freedom
  add_column(BF = "")  %>%                                  # add empty column for Bayes factors
  rename(Df.res = df_error) %>%                             # set denominator degrees of freedom
  mutate(F = abs(t)^2) %>%                                  # calculate F statistic
  mutate(`Pr(>F)` = pf(F,Df,Df.res,lower.tail=FALSE)) %>%   # calculate p value
  dplyr::select(c(Source,F,Df,Df.res,`Pr(>F)`,BF)) %>%      # select columns of interest for table
  rbind(aov,.) %>%                                          # row bind with anova table
  mutate(`Pr(>F)` = afex::round_ps_apa(`Pr(>F)`)) %>%       # format p values as APA style
  knitr::kable(caption = sprintf("**ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  add_indent(c(4:5)) %>%                                    # add indentation to indicate source components
  print()

# Calculate intraclass correlation coefficients (ICC) for the random effects
icc(model, by_group=TRUE, tolerance=0) %>% 
  as.data.frame() %>% 
  mutate(N = ngrps(model)) %>%
  rbind(.,c("residual",1-sum(.$ICC),nobs(model))) %>%
  mutate(ICC = as.numeric(ICC)) %>%                               
  knitr::kable(caption = sprintf("**Intraclass correlation coefficients for random effects: %s**",resp), digits = 3) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

# Calculated estimated marginal means, By default, emmeans uses Kenward-Roger's method for estimating the degrees of freedom
emm <- emmeans(model, ~ genotype * transfection, data = Data, tran = 'log', type = 'response')
emm %>% 
  summary(calc = c(n = ".wgt.")) %>%
  as.data.frame() %>%
  mutate_at("transfection", str_replace_all, pattern = "\\+", replacement = "\\\\+")  %>% 
  mutate_at("transfection", str_replace_all, pattern = "\\-", replacement = "\\\\-")  %>% 
  relocate(df, .before = response) %>%
  dplyr::select(-SE) %>%
  knitr::kable(caption = sprintf("**Estimated marginal means with 95%% confidence intervals: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

# Calculate overall average for untransfected neurons
emmeans(model, ~ genotype * transfection, data = Data) %>%
  as.data.frame() %>%
  filter(transfection == "-") %>%
  dplyr::select(emmean) %>% 
  colMeans() %>%
  exp() %>%
  sprintf("**Overall average of %s for untransfected neurons**: %.2f",resp,.) %>%
  print()

# Calculate transfected/untransfected ratios
emm.transfection <- contrast(emm, method = "trt.vs.ctrl", interaction = FALSE, by = 'genotype', adjust = "none")
emm.transfection %>%
  confint() %>%
  as.data.frame() %>%
  relocate(df, .before = ratio) %>%
  dplyr::select(-SE) %>%
  knitr::kable(caption = sprintf("**Estimated marginal means with 95%% confidence intervals for transfected/untransfected ratios: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

# 95% confidence intervals for interaction contrasts
emm.interaction <- contrast(emm, method = "trt.vs.ctrl", interaction = TRUE, adjust = "none")
emm.interaction %>%
  confint() %>% 
  relocate(df, .before = ratio) %>%
  dplyr::select(-SE) %>%
  knitr::kable(caption = sprintf("**95%% confidence intervals for contrasts: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

# Standardized effect sizes (*r*) for interaction contrasts
# Methods used the same as this server: https://easystats4u.shinyapps.io/statistic2effectsize/
emm.interaction %>% 
    as.data.frame() %>% 
    mutate(n = df+nrow(.)+1) %>%
    mutate(r = t_to_r(t.ratio, df)$r) %>% 
    mutate(z = atanh(r),
           SE = 1/sqrt(n-3),
           CI = sprintf("[%.2f, %.2f]",
                        LL = tanh(z - 1.96*SE),
                        UL = tanh(z + 1.96*SE))) %>%
    dplyr::select(-c(ratio,SE,df,null,t.ratio,p.value,z)) %>%
    knitr::kable(col.names = c("genotype",
                               "transfection",
                               "*n*",
                               "*r*",
                               "95% *CI*"),
                 caption = sprintf("**Standardized effect sizes (*r*) for contrasts: %s**",resp), digits = 2) %>% 
    kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
    print()

# Joint tests
joint_tests(model,by="genotype") %>%
  mutate(p.value = afex::round_ps_apa(p.value)) %>%       # format p values as APA style
  knitr::kable(caption = sprintf("**Joint (type III) tests by genotype: %s**",resp), digits = 2) %>% 
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

posthoc = TRUE

if (posthoc == TRUE) {
  
# p-values and maximum Bayes Factors for pairwise comparisons
# Westfall stepwise p-value adjustment to control FWER on p-values (using multcomp package)
# Chapter 4.1.2 in Bretz, F., Hothorn, T. and Westfall, P. (2011) Multiple Comparisons Using R. Taylor and Frances Group, LLC.
emm.interaction <- contrast(emm, method = "pairwise", interaction = TRUE, adjust = "none")
emm.interaction %>%   
    as.glht() %>%
    summary(test = adjusted(type = "Westfall")) -> glht.out  
emm.interaction %>%   
  as.data.frame() %>%
  dplyr::select(-SE) %>%
  mutate(p.adj = glht.out$test$pvalues) %>%
  mutate(p.adj = sapply(p.adj,max,.Machine$double.eps)) %>%
  mutate(maxBF = 1/pCalibrate(p.adj,"exploratory")) %>%
  mutate_at("maxBF", formatC, format='g',digits = 3) %>%
  mutate(p.value = afex::round_ps_apa(p.value)) %>%
  mutate(p.adj = afex::round_ps_apa(p.adj)) %>%
  knitr::kable(caption = sprintf("**Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): %s**",resp), digits = 2) %>%
  kableExtra::kable_styling(bootstrap_options = c("striped", "hover")) %>%
  print()

}

# Replot data with 95% confidence intervals
emf(sprintf("../img/%s_%s.emf","n2a_ko_nmdar",resp), width=3.5, height=3.5)
emm %>%
    as.data.frame() %>%
    mutate(genotype_transfection = as.numeric(genotype)+(as.numeric(transfection)-1)/2.5) -> emm_df
p1 <- Data %>%
    mutate(genotype_jittered = jitter((as.numeric(genotype)+(as.numeric(transfection)-1)/2.5), 0.5),
           grouping=interaction(pair, genotype)) %>%
    mutate(genotype_transfection = as.numeric(genotype)+(as.numeric(transfection)-1)/2.5) %>%
    ggplot(aes(x=genotype, y=!!sym(resp), group=grouping, color=transfection)) + 
    geom_blank() +
    geom_line(aes(genotype_jittered), alpha=0.3, color="grey", size=0.75) +
    geom_point(aes(genotype_jittered), alpha=0.6, shape = 16, size=1.25) +
    scale_color_manual(values=c("grey","#00BA38")) +
    scale_fill_manual(values=c("grey","#00BA38")) +
    geom_crossbar(data = emm_df, 
                    aes(x=genotype_transfection, y=response, ymin=`lower.CL`, ymax=`upper.CL`, fill=transfection), 
                    color="black", alpha=0.5, size=0.5, fatten=1, width=0.3, inherit.aes=FALSE) + 
    ylab(resp) +
    theme(axis.text.x = element_text(angle = 45, vjust=1, hjust=1),axis.line = element_line(colour="black"),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          panel.background = element_blank(),
          legend.title = element_blank(),
          legend.position = c(0.5, 1.06),
          legend.direction = "horizontal",
          text = element_text(size=14))
emm.transfection %>%
    confint() %>%
    as.data.frame() -> emm.transfection_df
p2 <- Data %>% 
    pivot_wider(c(genotype,pair,!!sym(resp)),names_from=transfection,values_from=!!sym(resp)) %>% 
    mutate(ratio = `+`/`-`) %>%
    ggplot(aes(x=genotype, y=ratio, colour=genotype)) +
    geom_sina(alpha=0.6, shape=16, size=1.25, maxwidth=0.5) + 
    geom_crossbar(data = emm.transfection_df, 
                           aes(x=genotype, y=ratio, ymin=`lower.CL`, ymax=`upper.CL`, fill=genotype), 
                    color="black", alpha=0.5, size=0.5, fatten=1, width=0.8, inherit.aes=FALSE) +
    scale_color_manual(values=c("grey","#619CFF","#F8766D")) +
    scale_fill_manual(values=c("grey","#619CFF","#F8766D")) +
    ylab("ratio") +
    theme(axis.text.x = element_text(angle = 45, vjust=1, hjust=1), axis.line = element_line(colour="black"),
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.border = element_blank(),
          panel.background = element_blank(),
          legend.position = "none",
          text=element_text(size=14))
grid.arrange(p1, p2, layout_matrix=rbind(c(1,2)), top=sprintf("Summary plots of the data with 95%% confidence intervals: %s\n",resp))
dev.off() #turn off device and finalize file

}

Analysis of peak

Matrix of contrasts on genotype: peak
genotype .L .Q
WT -0.71 0.41
HET 0.00 -0.82
HOM 0.71 0.41
Matrix of contrasts on transfection: peak
transfection .L
- -0.71
+ 0.71
ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: peak
Source F Df Df.res Pr(>F) BF
genotype 0.83 2 10.07 .465 0.461
transfection 25.46 1 96.00 <.001 5.05e+04
genotype:transfection 8.61 2 96.00 <.001 227
genotype.L:transfection.L 13.00 1 96.00 <.001
genotype.Q:transfection.L 3.76 1 96.00 .055
Intraclass correlation coefficients for random effects: peak
Group ICC N
pair:(slice:animal) 0.000 99
slice:animal 0.270 53
animal 0.293 14
residual 0.436 198
Estimated marginal means with 95% confidence intervals: peak
genotype transfection df response n lower.CL upper.CL
WT - 10.29 83.78 33 56.93 123.30
HET - 15.96 63.93 29 44.96 90.92
HOM - 9.95 81.10 37 55.20 119.16
WT + 10.29 74.90 33 50.89 110.23
HET + 15.96 57.06 29 40.13 81.15
HOM + 9.95 46.77 37 31.83 68.72
[1] “Overall average of peak for untransfected neurons: 75.74”
Estimated marginal means with 95% confidence intervals for transfected/untransfected ratios: peak
contrast genotype df ratio lower.CL upper.CL
(+) / (-) WT 96 0.89 0.75 1.07
(+) / (-) HET 96 0.89 0.74 1.08
(+) / (-) HOM 96 0.58 0.49 0.68
95% confidence intervals for contrasts: peak
genotype_trt.vs.ctrl transfection_trt.vs.ctrl df ratio lower.CL upper.CL
HET / WT (+) / (-) 96 1.00 0.77 1.29
HOM / WT (+) / (-) 96 0.65 0.51 0.82
Standardized effect sizes (r) for contrasts: peak
genotype transfection n r 95% CI
HET / WT (+) / (-) 99 0.00 [-0.20, 0.20]
HOM / WT (+) / (-) 99 -0.35 [-0.51, -0.16]
Joint (type III) tests by genotype: peak
model term genotype df1 df2 F.ratio p.value
transfection WT 1 96 1.61 .208
transfection HET 1 96 1.45 .231
transfection HOM 1 96 43.49 <.001
## Note: df set to 96
Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): peak
genotype_pairwise transfection_pairwise ratio df null t.ratio p.value p.adj maxBF
WT / HET (-) / (+) 1.00 96 1 -0.01 .990 .990 1
WT / HOM (-) / (+) 0.65 96 1 -3.61 <.001 .001 38
HET / HOM (-) / (+) 0.65 96 1 -3.47 <.001 .001 38

Analysis of rise

Matrix of contrasts on genotype: rise
genotype .L .Q
WT -0.71 0.41
HET 0.00 -0.82
HOM 0.71 0.41
Matrix of contrasts on transfection: rise
transfection .L
- -0.71
+ 0.71
ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: rise
Source F Df Df.res Pr(>F) BF
genotype 1.50 2 9.69 .270 0.538
transfection 83.79 1 96.00 <.001 1.15e+10
genotype:transfection 44.21 2 96.00 <.001 2.33e+13
genotype.L:transfection.L 81.48 1 96.00 <.001
genotype.Q:transfection.L 5.55 1 96.00 .021
Intraclass correlation coefficients for random effects: rise
Group ICC N
pair:(slice:animal) 0.045 99
slice:animal 0.491 53
animal 0.146 14
residual 0.318 198
Estimated marginal means with 95% confidence intervals: rise
genotype transfection df response n lower.CL upper.CL
WT - 9.43 3.74 33 3.40 4.11
HET - 16.68 3.73 29 3.40 4.09
HOM - 9.10 3.61 37 3.28 3.96
WT + 9.43 3.74 33 3.40 4.12
HET + 16.68 4.00 29 3.65 4.39
HOM + 9.10 4.71 37 4.29 5.18
[1] “Overall average of rise for untransfected neurons: 3.69”
Estimated marginal means with 95% confidence intervals for transfected/untransfected ratios: rise
contrast genotype df ratio lower.CL upper.CL
(+) / (-) WT 96 1.00 0.96 1.05
(+) / (-) HET 96 1.07 1.03 1.12
(+) / (-) HOM 96 1.31 1.26 1.36
95% confidence intervals for contrasts: rise
genotype_trt.vs.ctrl transfection_trt.vs.ctrl df ratio lower.CL upper.CL
HET / WT (+) / (-) 96 1.07 1.01 1.14
HOM / WT (+) / (-) 96 1.30 1.23 1.38
Standardized effect sizes (r) for contrasts: rise
genotype transfection n r 95% CI
HET / WT (+) / (-) 99 0.22 [0.02, 0.40]
HOM / WT (+) / (-) 99 0.68 [0.55, 0.77]
Joint (type III) tests by genotype: rise
model term genotype df1 df2 F.ratio p.value
transfection WT 1 96 0.01 .921
transfection HET 1 96 9.67 .002
transfection HOM 1 96 175.62 <.001
## Note: df set to 96
Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): rise
genotype_pairwise transfection_pairwise ratio df null t.ratio p.value p.adj maxBF
WT / HET (-) / (+) 1.07 96 1 2.20 .030 .030 3.48
WT / HOM (-) / (+) 1.30 96 1 9.03 <.001 <.001 4.18e+11
HET / HOM (-) / (+) 1.22 96 1 6.46 <.001 <.001 4.35e+06

Analysis of decay

Matrix of contrasts on genotype: decay
genotype .L .Q
WT -0.71 0.41
HET 0.00 -0.82
HOM 0.71 0.41
Matrix of contrasts on transfection: decay
transfection .L
- -0.71
+ 0.71
ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: decay
Source F Df Df.res Pr(>F) BF
genotype 4.91 2 9.9 .033 1.97
transfection 156.82 1 96.0 <.001 8.68e+13
genotype:transfection 76.23 2 96.0 <.001 4.67e+19
genotype.L:transfection.L 140.11 1 96.0 <.001
genotype.Q:transfection.L 9.90 1 96.0 .002
Intraclass correlation coefficients for random effects: decay
Group ICC N
pair:(slice:animal) 0.144 99
slice:animal 0.259 53
animal 0.247 14
residual 0.350 198
Estimated marginal means with 95% confidence intervals: decay
genotype transfection df response n lower.CL upper.CL
WT - 9.90 83.36 33 67.72 102.62
HET - 15.68 91.08 29 75.08 110.48
HOM - 9.49 86.41 37 70.27 106.25
WT + 9.90 85.08 33 69.11 104.73
HET + 15.68 111.82 29 92.18 135.63
HOM + 9.49 182.18 37 148.15 224.03
[1] “Overall average of decay for untransfected neurons: 86.89”
Estimated marginal means with 95% confidence intervals for transfected/untransfected ratios: decay
contrast genotype df ratio lower.CL upper.CL
(+) / (-) WT 96 1.02 0.93 1.11
(+) / (-) HET 96 1.23 1.12 1.35
(+) / (-) HOM 96 2.11 1.94 2.29
95% confidence intervals for contrasts: decay
genotype_trt.vs.ctrl transfection_trt.vs.ctrl df ratio lower.CL upper.CL
HET / WT (+) / (-) 96 1.20 1.06 1.37
HOM / WT (+) / (-) 96 2.07 1.83 2.33
Standardized effect sizes (r) for contrasts: decay
genotype transfection n r 95% CI
HET / WT (+) / (-) 99 0.28 [0.09, 0.45]
HOM / WT (+) / (-) 99 0.77 [0.68, 0.84]
Joint (type III) tests by genotype: decay
model term genotype df1 df2 F.ratio p.value
transfection WT 1 96 0.21 .649
transfection HET 1 96 18.62 <.001
transfection HOM 1 96 314.11 <.001
## Note: df set to 96
Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): decay
genotype_pairwise transfection_pairwise ratio df null t.ratio p.value p.adj maxBF
WT / HET (-) / (+) 1.20 96 1 2.84 .006 .006 12.7
WT / HOM (-) / (+) 2.07 96 1 11.84 <.001 <.001 4.6e+13
HET / HOM (-) / (+) 1.72 96 1 8.52 <.001 <.001 5.59e+10

Analysis of dt50

Matrix of contrasts on genotype: dt50
genotype .L .Q
WT -0.71 0.41
HET 0.00 -0.82
HOM 0.71 0.41
Matrix of contrasts on transfection: dt50
transfection .L
- -0.71
+ 0.71
ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: dt50
Source F Df Df.res Pr(>F) BF
genotype 3.97 2 10.59 .052 2.22
transfection 415.87 1 96.00 <.001 5.31e+19
genotype:transfection 231.23 2 96.00 <.001 2.36e+43
genotype.L:transfection.L 416.89 1 96.00 <.001
genotype.Q:transfection.L 37.39 1 96.00 <.001
Intraclass correlation coefficients for random effects: dt50
Group ICC N
pair:(slice:animal) 0.081 99
slice:animal 0.070 53
animal 0.633 14
residual 0.216 198
Estimated marginal means with 95% confidence intervals: dt50
genotype transfection df response n lower.CL upper.CL
WT - 10.45 32.33 33 24.18 43.22
HET - 12.93 39.77 29 31.09 50.87
HOM - 10.31 32.39 37 24.24 43.29
WT + 10.45 32.78 33 24.52 43.82
HET + 12.93 50.60 29 39.55 64.73
HOM + 10.31 90.71 37 67.88 121.22
[1] “Overall average of dt50 for untransfected neurons: 34.66”
Estimated marginal means with 95% confidence intervals for transfected/untransfected ratios: dt50
contrast genotype df ratio lower.CL upper.CL
(+) / (-) WT 96 1.01 0.94 1.09
(+) / (-) HET 96 1.27 1.18 1.37
(+) / (-) HOM 96 2.80 2.62 3.00
95% confidence intervals for contrasts: dt50
genotype_trt.vs.ctrl transfection_trt.vs.ctrl df ratio lower.CL upper.CL
HET / WT (+) / (-) 96 1.26 1.13 1.39
HOM / WT (+) / (-) 96 2.76 2.50 3.05
Standardized effect sizes (r) for contrasts: dt50
genotype transfection n r 95% CI
HET / WT (+) / (-) 99 0.4 [0.22, 0.55]
HOM / WT (+) / (-) 99 0.9 [0.86, 0.93]
Joint (type III) tests by genotype: dt50
model term genotype df1 df2 F.ratio p.value
transfection WT 1 96 0.14 .707
transfection HET 1 96 38.96 <.001
transfection HOM 1 96 908.24 <.001
## Note: df set to 96
Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): dt50
genotype_pairwise transfection_pairwise ratio df null t.ratio p.value p.adj maxBF
WT / HET (-) / (+) 1.26 96 1 4.30 <.001 <.001 874
WT / HOM (-) / (+) 2.76 96 1 20.42 <.001 <.001 4.6e+13
HET / HOM (-) / (+) 2.20 96 1 15.30 <.001 <.001 4.6e+13

Analysis of charge

Matrix of contrasts on genotype: charge
genotype .L .Q
WT -0.71 0.41
HET 0.00 -0.82
HOM 0.71 0.41
Matrix of contrasts on transfection: charge
transfection .L
- -0.71
+ 0.71
ANOVA table (Type III Wald F tests with Kenward-Roger df) and Bayes factors for fixed effects with interaction source split into polynomial contrasts: charge
Source F Df Df.res Pr(>F) BF
genotype 0.09 2 10.09 .911 0.372
transfection 0.01 1 96.00 .938 0.157
genotype:transfection 1.21 2 96.00 .303 0.277
genotype.L:transfection.L 2.39 1 96.00 .125
genotype.Q:transfection.L 0.01 1 96.00 .907
Intraclass correlation coefficients for random effects: charge
Group ICC N
pair:(slice:animal) 0.009 99
slice:animal 0.317 53
animal 0.312 14
residual 0.362 198
Estimated marginal means with 95% confidence intervals: charge
genotype transfection df response n lower.CL upper.CL
WT - 10.01 8.79 33 5.49 14.06
HET - 15.44 7.56 29 4.94 11.58
HOM - 9.73 7.91 37 4.95 12.64
WT + 10.01 8.01 33 5.01 12.82
HET + 15.44 7.52 29 4.91 11.52
HOM + 9.73 8.84 37 5.53 14.12
[1] “Overall average of charge for untransfected neurons: 8.07”
Estimated marginal means with 95% confidence intervals for transfected/untransfected ratios: charge
contrast genotype df ratio lower.CL upper.CL
(+) / (-) WT 96 0.91 0.75 1.10
(+) / (-) HET 96 0.99 0.81 1.22
(+) / (-) HOM 96 1.12 0.93 1.34
95% confidence intervals for contrasts: charge
genotype_trt.vs.ctrl transfection_trt.vs.ctrl df ratio lower.CL upper.CL
HET / WT (+) / (-) 96 1.09 0.83 1.44
HOM / WT (+) / (-) 96 1.22 0.94 1.59
Standardized effect sizes (r) for contrasts: charge
genotype transfection n r 95% CI
HET / WT (+) / (-) 99 0.06 [-0.14, 0.26]
HOM / WT (+) / (-) 99 0.16 [-0.04, 0.34]
Joint (type III) tests by genotype: charge
model term genotype df1 df2 F.ratio p.value
transfection WT 1 96 0.94 .335
transfection HET 1 96 0.00 .960
transfection HOM 1 96 1.50 .223
## Note: df set to 96
Hypothesis testing on interaction parameters (Westfall stepwise p-value adjustment): charge
genotype_pairwise transfection_pairwise ratio df null t.ratio p.value p.adj maxBF
WT / HET (-) / (+) 1.09 96 1 0.63 .533 .533 1
WT / HOM (-) / (+) 1.22 96 1 1.55 .125 .274 1.04
HET / HOM (-) / (+) 1.12 96 1 0.85 .397 .397 1