Plots

Linear Mixed Effect Model & Type 2 ANOVA

# TNFa: sufficient litter overlap to model Litter
data %>% filter(!is.na(Tnfa)) %>% group_by(Group, Region, Sex) %>% summarise(n = n(), mouse = length(unique(Mouse)), litter = length(unique(Litter)))
## `summarise()` has grouped output by 'Group', 'Region'. You can override using the `.groups` argument.
## # A tibble: 8 x 6
## # Groups:   Group, Region [4]
##   Group Region Sex       n mouse litter
##   <fct> <fct>  <fct> <int> <int>  <int>
## 1 CON   Ctx    F         6     6      4
## 2 CON   Ctx    M         9     9      7
## 3 CON   Str    F         6     6      4
## 4 CON   Str    M         8     8      6
## 5 MIA   Ctx    F         5     5      4
## 6 MIA   Ctx    M        15    15      9
## 7 MIA   Str    F         5     5      4
## 8 MIA   Str    M        15    15      9
data %>% group_by(Group, Region, Sex) %>% shapiro_test(log2.TNFa)
## # A tibble: 8 x 6
##   Region Sex   Group variable  statistic      p
##   <fct>  <fct> <fct> <chr>         <dbl>  <dbl>
## 1 Ctx    F     CON   log2.TNFa     0.935 0.623 
## 2 Ctx    M     CON   log2.TNFa     0.981 0.969 
## 3 Str    F     CON   log2.TNFa     0.921 0.511 
## 4 Str    M     CON   log2.TNFa     0.914 0.386 
## 5 Ctx    F     MIA   log2.TNFa     0.810 0.0967
## 6 Ctx    M     MIA   log2.TNFa     0.967 0.805 
## 7 Str    F     MIA   log2.TNFa     0.859 0.225 
## 8 Str    M     MIA   log2.TNFa     0.941 0.401
data %>% levene_test((log2.TNFa) ~ Group * Region * Sex)
## # A tibble: 1 x 4
##     df1   df2 statistic      p
##   <int> <int>     <dbl>  <dbl>
## 1     7    61      2.54 0.0230
Anova(aov(log2.TNFa ~ Group + Region + Sex, data=data))
## Anova Table (Type II tests)
## 
## Response: log2.TNFa
##            Sum Sq Df F value  Pr(>F)  
## Group      1.6100  1  3.7565 0.05695 .
## Region     0.0181  1  0.0422 0.83784  
## Sex        0.1842  1  0.4298 0.51442  
## Residuals 27.8585 65                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(lmer(log2.TNFa ~ Group + Region + Sex + (1|Litter), data=data))
## boundary (singular) fit: see ?isSingular
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: log2.TNFa ~ Group + Region + Sex + (1 | Litter)
##    Data: data
## 
## REML criterion at convergence: 142
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.72660 -0.63437 -0.01022  0.58688  2.39125 
## 
## Random effects:
##  Groups   Name        Variance Std.Dev.
##  Litter   (Intercept) 0.0000   0.0000  
##  Residual             0.4286   0.6547  
## Number of obs: 69, groups:  Litter, 21
## 
## Fixed effects:
##             Estimate Std. Error      df t value Pr(>|t|)  
## (Intercept)  -0.1240     0.1758 65.0000  -0.705   0.4831  
## GroupMIA      0.3143     0.1622 65.0000   1.938   0.0569 .
## RegionStr    -0.0324     0.1577 65.0000  -0.205   0.8378  
## SexM          0.1126     0.1717 65.0000   0.656   0.5144  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##           (Intr) GrpMIA RgnStr
## GroupMIA  -0.411              
## RegionStr -0.440 -0.019       
## SexM      -0.578 -0.174  0.013
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see ?isSingular
# Iba1: not enough litter overlap to properly model
data %>% filter(!is.na(Iba1)) %>%  group_by(Group, Region, Sex) %>% summarise(n = n(), litters = length(unique(Litter)))
## `summarise()` has grouped output by 'Group', 'Region'. You can override using the `.groups` argument.
## # A tibble: 8 x 5
## # Groups:   Group, Region [4]
##   Group Region Sex       n litters
##   <fct> <fct>  <fct> <int>   <int>
## 1 CON   Ctx    F         6       4
## 2 CON   Ctx    M         2       2
## 3 CON   Str    F         6       4
## 4 CON   Str    M         2       2
## 5 MIA   Ctx    F         5       4
## 6 MIA   Ctx    M         3       2
## 7 MIA   Str    F         5       4
## 8 MIA   Str    M         3       2
data %>% group_by(Group, Sex) %>% shapiro_test(log2.Iba1)
## # A tibble: 4 x 5
##   Sex   Group variable  statistic     p
##   <fct> <fct> <chr>         <dbl> <dbl>
## 1 F     CON   log2.Iba1     0.977 0.968
## 2 M     CON   log2.Iba1     0.993 0.970
## 3 F     MIA   log2.Iba1     0.934 0.485
## 4 M     MIA   log2.Iba1     0.890 0.318
data %>% levene_test(log2.Iba1 ~ Group * Region * Sex)
## # A tibble: 1 x 4
##     df1   df2 statistic     p
##   <int> <int>     <dbl> <dbl>
## 1     7    24      1.21 0.333
Anova(aov(log2.Iba1 ~ Group + Region + Sex, data=data))
## Anova Table (Type II tests)
## 
## Response: log2.Iba1
##            Sum Sq Df F value  Pr(>F)  
## Group     0.36386  1  4.1953 0.05002 .
## Region    0.39093  1  4.5073 0.04273 *
## Sex       0.13264  1  1.5293 0.22649  
## Residuals 2.42850 28                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

#Session Info

sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-apple-darwin17.0 (64-bit)
## Running under: macOS Big Sur 10.16
## 
## Matrix products: default
## BLAS:   /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRblas.dylib
## LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
##  [1] rstatix_0.7.0   forcats_0.5.1   stringr_1.4.0   dplyr_1.0.7    
##  [5] purrr_0.3.4     readr_1.4.0     tidyr_1.1.3     tibble_3.1.2   
##  [9] tidyverse_1.3.1 car_3.0-11      carData_3.0-4   multcomp_1.4-17
## [13] TH.data_1.0-10  MASS_7.3-54     survival_3.2-11 mvtnorm_1.1-2  
## [17] lmerTest_3.1-3  lme4_1.1-27.1   Matrix_1.3-4    cowplot_1.1.1  
## [21] ggplot2_3.3.5  
## 
## loaded via a namespace (and not attached):
##  [1] httr_1.4.2          sass_0.4.0          jsonlite_1.7.2     
##  [4] splines_4.0.3       modelr_0.1.8        bslib_0.2.5.1      
##  [7] assertthat_0.2.1    highr_0.9           cellranger_1.1.0   
## [10] yaml_2.2.1          numDeriv_2016.8-1.1 pillar_1.6.1       
## [13] backports_1.2.1     lattice_0.20-44     glue_1.4.2         
## [16] digest_0.6.27       rvest_1.0.0         minqa_1.2.4        
## [19] colorspace_2.0-2    sandwich_3.0-1      htmltools_0.5.1.1  
## [22] pkgconfig_2.0.3     broom_0.7.8         haven_2.4.1        
## [25] scales_1.1.1        openxlsx_4.2.4      rio_0.5.27         
## [28] farver_2.1.0        generics_0.1.0      ellipsis_0.3.2     
## [31] withr_2.4.2         cli_3.0.0           magrittr_2.0.1     
## [34] crayon_1.4.1        readxl_1.3.1        evaluate_0.14      
## [37] fs_1.5.0            fansi_0.5.0         nlme_3.1-152       
## [40] xml2_1.3.2          foreign_0.8-81      tools_4.0.3        
## [43] data.table_1.14.0   hms_1.1.0           lifecycle_1.0.0    
## [46] munsell_0.5.0       reprex_2.0.0        zip_2.2.0          
## [49] compiler_4.0.3      jquerylib_0.1.4     rlang_0.4.11       
## [52] grid_4.0.3          nloptr_1.2.2.2      rstudioapi_0.13    
## [55] labeling_0.4.2      rmarkdown_2.9       boot_1.3-28        
## [58] gtable_0.3.0        codetools_0.2-18    abind_1.4-5        
## [61] DBI_1.1.1           curl_4.3.2          R6_2.5.0           
## [64] zoo_1.8-9           lubridate_1.7.10    knitr_1.33         
## [67] utf8_1.2.1          stringi_1.6.2       Rcpp_1.0.7         
## [70] vctrs_0.3.8         dbplyr_2.1.1        tidyselect_1.1.1   
## [73] xfun_0.24