R Markdown

library(knitr)
library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(broom)
library(ggplot2)
All.subcort.Vol <- read.csv("/projects/neda/FINAL.ANALYSIS.T1/QCd_All_data/subCortVol.All.csv")
All.subcort.Vol$EduCateg <- as.factor(All.subcort.Vol$EduCateg)
All.subcort.Vol$Sex <- as.factor(All.subcort.Vol$Sex)

demographics - age

Dx n MeanAge MeanSD
AD 41 75.29268 7.142282
aMCI 84 72.73810 8.006201
HC 56 69.82143 6.644498
naMCI 34 70.85294 6.800768
rMDD 42 69.66667 5.145050
rMDD+aMCI 45 71.13333 4.722288
rMDD+naMCI 29 70.51724 4.679901

boxplot age distribution in each group

## `stat_bindot()` using `bins = 30`. Pick better value with `binwidth`.

compare age between groups : AD is sig older than HC and rMDD

##              Df Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6   1064  177.40   4.107 0.000546 ***
## Residuals   324  13995   43.19                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Age ~ Dx, data = All.subcort.Vol)
## 
## $Dx
##                            diff       lwr         upr     p adj
## aMCI-AD              -2.5545877 -6.269514  1.16033892 0.3913725
## HC-AD                -5.4712544 -9.479245 -1.46326344 0.0012432
## naMCI-AD             -4.4397418 -8.962736  0.08325263 0.0582073
## rMDD-AD              -5.6260163 -9.907056 -1.34497636 0.0022368
## rMDD+aMCI-AD         -4.1593496 -8.369308  0.05060919 0.0552403
## rMDD+naMCI-AD        -4.7754415 -9.506790 -0.04409351 0.0462337
## HC-aMCI              -2.9166667 -6.280676  0.44734245 0.1379778
## naMCI-aMCI           -1.8851541 -5.848744  2.07843577 0.7956182
## rMDD-aMCI            -3.0714286 -6.756516  0.61365879 0.1727145
## rMDD+aMCI-aMCI       -1.6047619 -5.207028  1.99750392 0.8414337
## rMDD+naMCI-aMCI      -2.2208539 -6.420642  1.97893428 0.7022822
## naMCI-HC              1.0315126 -3.207987  5.27101208 0.9911987
## rMDD-HC              -0.1547619 -4.135111  3.82558736 0.9999998
## rMDD+aMCI-HC          1.3119048 -2.591892  5.21570171 0.9544073
## rMDD+naMCI-HC         0.6958128 -3.765300  5.15692611 0.9992572
## rMDD-naMCI           -1.1862745 -5.684793  3.31224383 0.9865272
## rMDD+aMCI-naMCI       0.2803922 -4.150535  4.71131955 0.9999963
## rMDD+naMCI-naMCI     -0.3356998 -5.264698  4.59329796 0.9999942
## rMDD+aMCI-rMDD        1.4666667 -2.716985  5.65031843 0.9442851
## rMDD+naMCI-rMDD       0.8505747 -3.857381  5.55853004 0.9982884
## rMDD+naMCI-rMDD+aMCI -0.6160920 -5.259506  4.02732205 0.9997076

sex difference among groups

## 
##  Pearson's Chi-squared test
## 
## data:  sex.diff
## X-squared = 6.0593, df = 6, p-value = 0.4166

calculating z-score and taking outliers out (+-3)

hippo R & L

amyg R & L

accumbens R & L

thalamus R & L

caudate R & L

putamen R & L

Anova(lm) model

## Loading required package: carData
## 
## Attaching package: 'car'
## The following object is masked from 'package:dplyr':
## 
##     recode
region term sumsq df statistic p.value
Laccumb_vol Dx 1.519032e+05 6 4.5780560 0.0001795
Laccumb_vol Age 3.492454e+05 1 63.1532944 0.0000000
Laccumb_vol Sex 1.333092e+02 1 0.0241060 0.8767149
Laccumb_vol ICV 6.587727e+04 1 11.9124460 0.0006337
Laccumb_vol EduCateg 1.198224e+04 6 0.3611203 0.9031222
Laccumb_vol Residuals 1.741988e+06 315 NA NA
Lamyg_vol Dx 2.206984e+06 6 11.0736602 0.0000000
Lamyg_vol Age 1.343914e+06 1 40.4589770 0.0000000
Lamyg_vol Sex 2.942360e+05 1 8.8580683 0.0031440
Lamyg_vol ICV 4.460067e+05 1 13.4271745 0.0002909
Lamyg_vol EduCateg 2.939323e+05 6 1.4748212 0.1862097
Lamyg_vol Residuals 1.046327e+07 315 NA NA
Lcaud_vol Dx 8.534097e+05 6 0.7360424 0.6209262
Lcaud_vol Age 8.183123e+05 1 4.2346310 0.0404298
Lcaud_vol Sex 4.232222e+05 1 2.1901052 0.1398992
Lcaud_vol ICV 1.885521e+07 1 97.5726110 0.0000000
Lcaud_vol EduCateg 1.703333e+06 6 1.4690774 0.1882334
Lcaud_vol Residuals 6.087151e+07 315 NA NA
Lhippo_vol Dx 1.012522e+07 6 12.8133836 0.0000000
Lhippo_vol Age 9.439089e+06 1 71.6705485 0.0000000
Lhippo_vol Sex 2.924165e+04 1 0.2220304 0.6378233
Lhippo_vol ICV 6.686750e+06 1 50.7721743 0.0000000
Lhippo_vol EduCateg 1.778980e+06 6 2.2512853 0.0383743
Lhippo_vol Residuals 4.148584e+07 315 NA NA
Lput_vol Dx 2.804200e+06 6 1.8225536 0.0941765
Lput_vol Age 1.530497e+06 1 5.9683626 0.0151137
Lput_vol Sex 2.247295e+06 1 8.7636014 0.0033063
Lput_vol ICV 5.325943e+06 1 20.7691695 0.0000074
Lput_vol EduCateg 5.343144e+05 6 0.3472707 0.9112461
Lput_vol Residuals 8.077705e+07 315 NA NA
Lthal_vol Dx 3.496367e+06 6 1.8174750 0.0951514
Lthal_vol Age 9.359723e+06 1 29.1921241 0.0000001
Lthal_vol Sex 2.664287e+05 1 0.8309668 0.3626902
Lthal_vol ICV 4.694679e+07 1 146.4227645 0.0000000
Lthal_vol EduCateg 1.505602e+06 6 0.7826392 0.5840532
Lthal_vol Residuals 1.009969e+08 315 NA NA
Raccumb_vol Dx 1.828719e+05 6 5.0494406 0.0000580
Raccumb_vol Age 1.488160e+05 1 24.6545511 0.0000011
Raccumb_vol Sex 1.175009e+03 1 0.1946654 0.6593644
Raccumb_vol ICV 1.612805e+05 1 26.7195563 0.0000004
Raccumb_vol EduCateg 3.290350e+04 6 0.9085279 0.4888926
Raccumb_vol Residuals 1.901354e+06 315 NA NA
Ramyg_vol Dx 1.959003e+06 6 8.8785589 0.0000000
Ramyg_vol Age 4.721636e+05 1 12.8395905 0.0003931
Ramyg_vol Sex 3.716047e+05 1 10.1050812 0.0016255
Ramyg_vol ICV 8.847166e+05 1 24.0581812 0.0000015
Ramyg_vol EduCateg 6.066672e+04 6 0.2749527 0.9484800
Ramyg_vol Residuals 1.158382e+07 315 NA NA
Rcaud_vol Dx 1.076241e+06 6 0.7357571 0.6211538
Rcaud_vol Age 3.907652e+05 1 1.6028471 0.2064357
Rcaud_vol Sex 4.648046e+05 1 1.9065428 0.1683267
Rcaud_vol ICV 2.141606e+07 1 87.8447514 0.0000000
Rcaud_vol EduCateg 3.199205e+06 6 2.1870916 0.0440351
Rcaud_vol Residuals 7.679525e+07 315 NA NA
Rhippo_vol Dx 1.298714e+07 6 15.0689186 0.0000000
Rhippo_vol Age 6.790720e+06 1 47.2754529 0.0000000
Rhippo_vol Sex 1.580804e+05 1 1.1005199 0.2949562
Rhippo_vol ICV 8.719861e+06 1 60.7056917 0.0000000
Rhippo_vol EduCateg 2.252540e+06 6 2.6136123 0.0173610
Rhippo_vol Residuals 4.524710e+07 315 NA NA
Rput_vol Dx 1.408979e+06 6 0.8886037 0.5034171
Rput_vol Age 2.007023e+06 1 7.5946421 0.0061951
Rput_vol Sex 2.987637e+06 1 11.3053173 0.0008681
Rput_vol ICV 3.572889e+06 1 13.5199300 0.0002774
Rput_vol EduCateg 1.682506e+06 6 1.0611101 0.3858789
Rput_vol Residuals 8.324451e+07 315 NA NA
Rthal_vol Dx 3.569964e+06 6 2.3591755 0.0303863
Rthal_vol Age 5.431236e+06 1 21.5350725 0.0000051
Rthal_vol Sex 7.674802e+05 1 3.0430903 0.0820568
Rthal_vol ICV 3.672156e+07 1 145.6025004 0.0000000
Rthal_vol EduCateg 1.039853e+06 6 0.6871767 0.6601388
Rthal_vol Residuals 7.944433e+07 315 NA NA

p value - FDR - Bonferroni

## # A tibble: 72 x 8
## # Groups:   region [13]
##    region      term      sumsq    df statistic  p.value      FDR Bonferroni
##    <chr>       <chr>     <dbl> <dbl>     <dbl>    <dbl>    <dbl>      <dbl>
##  1 Rhippo_vol  Dx    12987139.     6    15.1   3.61e-15 4.33e-14   4.33e-14
##  2 Lhippo_vol  Dx    10125219.     6    12.8   5.91e-13 3.55e-12   7.09e-12
##  3 Lamyg_vol   Dx     2206984.     6    11.1   3.30e-11 1.32e-10   3.96e-10
##  4 Ramyg_vol   Dx     1959003.     6     8.88  5.85e- 9 1.76e- 8   7.02e- 8
##  5 Raccumb_vol Dx      182872.     6     5.05  5.80e- 5 1.39e- 4   6.96e- 4
##  6 Laccumb_vol Dx      151903.     6     4.58  1.79e- 4 3.59e- 4   2.15e- 3
##  7 Rthal_vol   Dx     3569964.     6     2.36  3.04e- 2 5.21e- 2   3.65e- 1
##  8 Lput_vol    Dx     2804200.     6     1.82  9.42e- 2 1.27e- 1   1.00e+ 0
##  9 Lthal_vol   Dx     3496367.     6     1.82  9.52e- 2 1.27e- 1   1.00e+ 0
## 10 Rput_vol    Dx     1408979.     6     0.889 5.03e- 1 6.04e- 1   1.00e+ 0
## # … with 62 more rows

hippocampus post-hoc + testing simple vs. interactive model

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df   Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6 18883821 3147304  23.852  < 2e-16 ***
## Age           1  9397710 9397710  71.220 1.25e-15 ***
## ICV           1  8674983 8674983  65.743 1.22e-14 ***
## Sex           1    13834   13834   0.105   0.7463    
## EduCateg      6  1778980  296497   2.247   0.0388 *  
## Dx:Age        6   712281  118714   0.900   0.4954    
## Residuals   309 40773559  131953                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lhippo_vol ~ Dx * Age + ICV + Sex + EduCateg, data = All.subcort.Vol)
## 
## $Dx
##                             diff        lwr       upr     p adj
## aMCI-AD               382.703368  177.31320 588.09354 0.0000014
## HC-AD                 754.391463  532.79841 975.98452 0.0000000
## naMCI-AD              560.512052  310.44558 810.57852 0.0000000
## rMDD-AD               749.979559  513.29022 986.66889 0.0000000
## rMDD+aMCI-AD          612.388130  379.62871 845.14755 0.0000000
## rMDD+naMCI-AD         648.393188  386.80730 909.97908 0.0000000
## HC-aMCI               371.688095  185.69939 557.67680 0.0000002
## naMCI-aMCI            177.808683  -41.32953 396.94690 0.1986365
## rMDD-aMCI             367.276190  163.53577 571.01661 0.0000036
## rMDD+aMCI-aMCI        229.684762   30.52336 428.84616 0.0123555
## rMDD+naMCI-aMCI       265.689819   33.49272 497.88692 0.0135000
## naMCI-HC             -193.879412 -428.27207  40.51324 0.1797888
## rMDD-HC                -4.411905 -224.47671 215.65290 1.0000000
## rMDD+aMCI-HC         -142.003333 -357.83573  73.82906 0.4472030
## rMDD+naMCI-HC        -105.998276 -352.64348 140.64692 0.8627427
## rMDD-naMCI            189.467507  -59.24574 438.18075 0.2666187
## rMDD+aMCI-naMCI        51.876078 -193.10021 296.85237 0.9958464
## rMDD+naMCI-naMCI       87.881136 -184.63237 360.39464 0.9625769
## rMDD+aMCI-rMDD       -137.591429 -368.89639  93.71353 0.5724635
## rMDD+naMCI-rMDD      -101.586371 -361.87893 158.70619 0.9090081
## rMDD+naMCI-rMDD+aMCI   36.005057 -220.71915 292.72927 0.9995958
## Analysis of Variance Table
## 
## Model 1: Lhippo_vol ~ Dx + Age + ICV + Sex + EduCateg
## Model 2: Lhippo_vol ~ Dx * Age + ICV + Sex + EduCateg
##   Res.Df      RSS Df Sum of Sq      F Pr(>F)
## 1    315 41485840                           
## 2    309 40773559  6    712281 0.8997 0.4954
##              Df   Sum Sq  Mean Sq F value   Pr(>F)    
## Dx            6 22263785  3710631  25.076  < 2e-16 ***
## Age           1  6961660  6961660  47.047 3.57e-11 ***
## ICV           1 10219404 10219404  69.062 2.72e-15 ***
## Sex           1   125948   125948   0.851    0.357    
## Residuals   321 47499636   147974                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df   Sum Sq  Mean Sq F value   Pr(>F)    
## Dx            6 22263785  3710631  24.942  < 2e-16 ***
## Age           1  6961660  6961660  46.796 4.11e-11 ***
## ICV           1 10219404 10219404  68.694 3.36e-15 ***
## Sex           1   125948   125948   0.847    0.358    
## Dx:Age        6   637862   106310   0.715    0.638    
## Residuals   315 46861775   148768                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Rhippo_vol ~ Dx * Age + ICV + Sex, data = All.subcort.Vol)
## 
## $Dx
##                             diff        lwr        upr     p adj
## aMCI-AD               495.829384  277.77292  713.88585 0.0000000
## HC-AD                 843.364503  608.10593 1078.62307 0.0000000
## naMCI-AD              648.269440  382.78152  913.75736 0.0000000
## rMDD-AD               816.667480  565.38165 1067.95331 0.0000000
## rMDD+aMCI-AD          644.780813  397.66726  891.89437 0.0000000
## rMDD+naMCI-AD         798.175526  520.45779 1075.89326 0.0000000
## HC-aMCI               347.535119  150.07659  544.99364 0.0000066
## naMCI-aMCI            152.440056  -80.21229  385.09240 0.4525657
## rMDD-aMCI             320.838095  104.53312  537.14307 0.0002945
## rMDD+aMCI-aMCI        148.951429  -62.49214  360.39500 0.3608690
## rMDD+naMCI-aMCI       302.346141   55.82958  548.86271 0.0058471
## naMCI-HC             -195.095063 -443.94258   53.75245 0.2346453
## rMDD-HC               -26.697024 -260.33310  206.93905 0.9998774
## rMDD+aMCI-HC         -198.583690 -427.72635   30.55897 0.1382943
## rMDD+naMCI-HC         -45.188978 -307.04464  216.66669 0.9986769
## rMDD-naMCI            168.398039  -95.65321  432.44928 0.4868051
## rMDD+aMCI-naMCI        -3.488627 -263.57246  256.59521 1.0000000
## rMDD+naMCI-naMCI      149.906085 -139.41317  439.22534 0.7218889
## rMDD+aMCI-rMDD       -171.886667 -417.45607   73.68273 0.3688868
## rMDD+naMCI-rMDD       -18.491954 -294.83660  257.85269 0.9999948
## rMDD+naMCI-rMDD+aMCI  153.394713 -119.16153  425.95095 0.6365279
## Analysis of Variance Table
## 
## Model 1: Rhippo_vol ~ Dx + Age + ICV + Sex
## Model 2: Rhippo_vol ~ Dx * Age + ICV + Sex
##   Res.Df      RSS Df Sum of Sq      F Pr(>F)
## 1    321 47499636                           
## 2    315 46861775  6    637862 0.7146 0.6381

amygdala post-hoc + testing simple vs. interactive model

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df   Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6  3367028  561171  17.311  < 2e-16 ***
## Age           1  1155026 1155026  35.630 6.54e-09 ***
## ICV           1  1299093 1299093  40.074 8.59e-10 ***
## Sex           1   318477  318477   9.824  0.00189 ** 
## EduCateg      6   293932   48989   1.511  0.17390    
## Dx:Age        6   446417   74403   2.295  0.03496 *  
## Residuals   309 10016849   32417                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lamyg_vol ~ Dx * Age + ICV + Sex + EduCateg, data = All.subcort.Vol)
## 
## $Dx
##                            diff          lwr       upr     p adj
## aMCI-AD              155.832782   54.0308758 257.63469 0.0001605
## HC-AD                321.585758  211.7528710 431.41864 0.0000000
## naMCI-AD             263.897418  139.9516451 387.84319 0.0000000
## rMDD-AD              296.226829  178.9114508 413.54221 0.0000000
## rMDD+aMCI-AD         268.606829  153.2393207 383.97434 0.0000000
## rMDD+naMCI-AD        259.164760  129.5093732 388.82015 0.0000002
## HC-aMCI              165.752976   73.5674296 257.93852 0.0000038
## naMCI-aMCI           108.064636   -0.5515069 216.68078 0.0521579
## rMDD-aMCI            140.394048   39.4098410 241.37825 0.0009277
## rMDD+aMCI-aMCI       112.774048   14.0594388 211.48866 0.0137420
## rMDD+naMCI-aMCI      103.331979  -11.7568191 218.42078 0.1109187
## naMCI-HC             -57.688340 -173.8653667  58.48869 0.7602779
## rMDD-HC              -25.358929 -134.4343382  83.71648 0.9930908
## rMDD+aMCI-HC         -52.978929 -159.9565383  53.99868 0.7625631
## rMDD+naMCI-HC        -62.420998 -184.6710133  59.82902 0.7354556
## rMDD-naMCI            32.329412  -90.9456322 155.60446 0.9868819
## rMDD+aMCI-naMCI        4.709412 -116.7134051 126.13223 0.9999998
## rMDD+naMCI-naMCI      -4.732657 -139.8043339 130.33902 0.9999999
## rMDD+aMCI-rMDD       -27.620000 -142.2666048  87.02660 0.9916336
## rMDD+naMCI-rMDD      -37.062069 -166.0764145  91.95228 0.9789873
## rMDD+naMCI-rMDD+aMCI  -9.442069 -136.6877579 117.80362 0.9999904
## Analysis of Variance Table
## 
## Model 1: Lamyg_vol ~ Dx + Age + ICV + Sex + EduCateg
## Model 2: Lamyg_vol ~ Dx * Age + ICV + Sex + EduCateg
##   Res.Df      RSS Df Sum of Sq      F  Pr(>F)  
## 1    315 10463266                              
## 2    309 10016849  6    446417 2.2952 0.03496 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df   Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6  2788183  464697  12.717 7.82e-13 ***
## Age           1   336756  336756   9.216  0.00260 ** 
## ICV           1  2325496 2325496  63.642 2.94e-14 ***
## Sex           1   373246  373246  10.215  0.00154 ** 
## EduCateg      6    60667   10111   0.277  0.94768    
## Dx:Age        6   292944   48824   1.336  0.24062    
## Residuals   309 11290879   36540                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Ramyg_vol ~ Dx * Age + ICV + Sex + EduCateg, data = All.subcort.Vol)
## 
## $Dx
##                           diff        lwr       upr     p adj
## aMCI-AD              192.15136   84.06915 300.23358 0.0000051
## HC-AD                311.91803  195.30940 428.52667 0.0000000
## naMCI-AD             246.65143  115.05927 378.24360 0.0000012
## rMDD-AD              286.86684  162.31411 411.41957 0.0000000
## rMDD+aMCI-AD         237.28509  114.80040 359.76979 0.0000004
## rMDD+naMCI-AD        257.73490  120.08089 395.38892 0.0000012
## HC-aMCI              119.76667   21.89406 217.63927 0.0060263
## naMCI-aMCI            54.50007  -60.81676 169.81690 0.8001922
## rMDD-aMCI             94.71548  -12.49859 201.92954 0.1229776
## rMDD+aMCI-aMCI        45.13373  -59.67072 149.93818 0.8615744
## rMDD+naMCI-aMCI       65.58354  -56.60525 187.77233 0.6869743
## naMCI-HC             -65.26660 -188.61075  58.07756 0.7013369
## rMDD-HC              -25.05119 -140.85562  90.75324 0.9953309
## rMDD+aMCI-HC         -74.63294 -188.21015  38.94427 0.4487909
## rMDD+naMCI-HC        -54.18313 -183.97492  75.60867 0.8783640
## rMDD-naMCI            40.21541  -90.66465 171.09546 0.9705073
## rMDD+aMCI-naMCI       -9.36634 -138.27990 119.54722 0.9999915
## rMDD+naMCI-naMCI      11.08347 -132.32097 154.48791 0.9999878
## rMDD+aMCI-rMDD       -49.58175 -171.30106  72.13757 0.8903974
## rMDD+naMCI-rMDD      -29.13194 -166.10536 107.84149 0.9957459
## rMDD+naMCI-rMDD+aMCI  20.44981 -114.64585 155.54547 0.9993728
## Analysis of Variance Table
## 
## Model 1: Ramyg_vol ~ Dx + Age + ICV + Sex + EduCateg
## Model 2: Ramyg_vol ~ Dx * Age + ICV + Sex + EduCateg
##   Res.Df      RSS Df Sum of Sq      F Pr(>F)
## 1    315 11583823                           
## 2    309 11290879  6    292944 1.3362 0.2406

accumbens post-hoc + testing simple vs. interactive model

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df  Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6  296529   49422   8.901 5.71e-09 ***
## Age           1  330649  330649  59.554 1.66e-13 ***
## ICV           1  105444  105444  18.992 1.79e-05 ***
## Sex           1     124     124   0.022    0.882    
## EduCateg      6   11982    1997   0.360    0.904    
## Dx:Age        6   26403    4401   0.793    0.576    
## Residuals   309 1715585    5552                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Laccumb_vol ~ Dx * Age + ICV + Sex + EduCateg, data = All.subcort.Vol)
## 
## $Dx
##                            diff       lwr       upr     p adj
## aMCI-AD               73.120006  30.98952 115.25049 0.0000096
## HC-AD                 89.663458  44.20937 135.11755 0.0000003
## naMCI-AD              76.716714  25.42204 128.01139 0.0002525
## rMDD-AD              100.078339  51.52764 148.62904 0.0000001
## rMDD+aMCI-AD          81.790244  34.04566 129.53482 0.0000132
## rMDD+naMCI-AD        104.383347  50.72576 158.04093 0.0000004
## HC-aMCI               16.543452 -21.60732  54.69423 0.8576001
## naMCI-aMCI             3.596709 -41.35383  48.54725 0.9999850
## rMDD-aMCI             26.958333 -14.83375  68.75042 0.4722787
## rMDD+aMCI-aMCI         8.670238 -32.18258  49.52305 0.9957953
## rMDD+naMCI-aMCI       31.263342 -16.36589  78.89258 0.4501883
## naMCI-HC             -12.946744 -61.02634  35.13285 0.9849410
## rMDD-HC               10.414881 -34.72573  55.55549 0.9933700
## rMDD+aMCI-HC          -7.873214 -52.14565  36.39922 0.9984304
## rMDD+naMCI-HC         14.719889 -35.87300  65.31278 0.9775831
## rMDD-naMCI            23.361625 -27.65547  74.37872 0.8230038
## rMDD+aMCI-naMCI        5.073529 -45.17703  55.32408 0.9999406
## rMDD+naMCI-naMCI      27.666633 -28.23247  83.56574 0.7630720
## rMDD+aMCI-rMDD       -18.288095 -65.73433  29.15814 0.9138883
## rMDD+naMCI-rMDD        4.305008 -49.08728  57.69730 0.9999843
## rMDD+naMCI-rMDD+aMCI  22.593103 -30.06723  75.25344 0.8636943
## Analysis of Variance Table
## 
## Model 1: Laccumb_vol ~ Dx + Age + ICV + Sex + EduCateg
## Model 2: Laccumb_vol ~ Dx * Age + ICV + Sex + EduCateg
##   Res.Df     RSS Df Sum of Sq      F Pr(>F)
## 1    315 1741988                           
## 2    309 1715585  6     26403 0.7926 0.5763
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##              Df  Sum Sq Mean Sq F value   Pr(>F)    
## Dx            6  243772   40629   6.719 1.06e-06 ***
## Age           1  133053  133053  22.002 4.09e-06 ***
## ICV           1  209615  209615  34.663 1.02e-08 ***
## Sex           1     933     933   0.154    0.695    
## EduCateg      6   32903    5484   0.907    0.490    
## Dx:Age        6   32764    5461   0.903    0.493    
## Residuals   309 1868591    6047                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Raccumb_vol ~ Dx * Age + ICV + Sex + EduCateg, data = All.subcort.Vol)
## 
## $Dx
##                             diff       lwr       upr     p adj
## aMCI-AD               80.4987515  36.52966 124.46784 0.0000023
## HC-AD                 77.9082753  30.47054 125.34601 0.0000358
## naMCI-AD              67.0299139  13.49670 120.56312 0.0044538
## rMDD-AD               90.4666086  39.79712 141.13610 0.0000046
## rMDD+aMCI-AD          73.4508943  23.62271 123.27908 0.0003318
## rMDD+naMCI-AD         90.0768713  34.07763 146.07611 0.0000570
## HC-aMCI               -2.5904762 -42.40618  37.22523 0.9999956
## naMCI-aMCI           -13.4688375 -60.38105  33.44338 0.9790482
## rMDD-aMCI              9.9678571 -33.64806  53.58378 0.9937026
## rMDD+aMCI-aMCI        -7.0478571 -49.68352  35.58780 0.9989626
## rMDD+naMCI-aMCI        9.5781199 -40.12969  59.28593 0.9975378
## naMCI-HC             -10.8783613 -61.05618  39.29946 0.9952748
## rMDD-HC               12.5583333 -34.55224  59.66891 0.9857127
## rMDD+aMCI-HC          -4.4573810 -50.66190  41.74714 0.9999546
## rMDD+naMCI-HC         12.1685961 -40.63220  64.96939 0.9934101
## rMDD-naMCI            23.4366947 -29.80682  76.68021 0.8486703
## rMDD+aMCI-naMCI        6.4209804 -46.02254  58.86450 0.9998163
## rMDD+naMCI-naMCI      23.0469574 -35.29162  81.38554 0.9040127
## rMDD+aMCI-rMDD       -17.0157143 -66.53254  32.50111 0.9492027
## rMDD+naMCI-rMDD       -0.3897373 -56.11211  55.33263 1.0000000
## rMDD+naMCI-rMDD+aMCI  16.6259770 -38.33249  71.58445 0.9727134
## Analysis of Variance Table
## 
## Model 1: Raccumb_vol ~ Dx + Age + ICV + Sex + EduCateg
## Model 2: Raccumb_vol ~ Dx * Age + ICV + Sex + EduCateg
##   Res.Df     RSS Df Sum of Sq     F Pr(>F)
## 1    315 1901354                          
## 2    309 1868591  6     32764 0.903 0.4929

thalamus : not sign

##              Df    Sum Sq  Mean Sq F value   Pr(>F)    
## Dx            6   9887734  1647956   5.161 4.40e-05 ***
## Age           1   8888888  8888888  27.837 2.43e-07 ***
## ICV           1  63523894 63523894 198.933  < 2e-16 ***
## Sex           1    209698   209698   0.657    0.418    
## Residuals   321 102502462   319322                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lthal_vol ~ Dx + Age + ICV + Sex, data = All.subcort.Vol)
## 
## $Dx
##                              diff        lwr      upr     p adj
## aMCI-AD               215.7689605 -103.66188 535.1998 0.4139715
## HC-AD                 546.9963415  202.36614 891.6265 0.0000753
## naMCI-AD              344.5081062  -44.40506 733.4213 0.1209568
## rMDD-AD               480.7891986  112.68067 848.8977 0.0024518
## rMDD+aMCI-AD          373.6863415   11.68978 735.6829 0.0379721
## rMDD+naMCI-AD         480.4256518   73.59703 887.2543 0.0093590
## HC-aMCI               331.2273810   41.97045 620.4843 0.0133734
## naMCI-aMCI            128.7391457 -212.07319 469.5515 0.9214348
## rMDD-aMCI             265.0202381  -51.84485 581.8853 0.1694534
## rMDD+aMCI-aMCI        157.9173810 -151.82623 467.6610 0.7370734
## rMDD+naMCI-aMCI       264.6566913  -96.46534 625.7787 0.3123280
## naMCI-HC             -202.4882353 -567.02488 162.0484 0.6510596
## rMDD-HC               -66.2071429 -408.46055 276.0463 0.9974883
## rMDD+aMCI-HC         -173.3100000 -508.98100 162.3610 0.7253444
## rMDD+naMCI-HC         -66.5706897 -450.16297 317.0216 0.9986354
## rMDD-naMCI            136.2810924 -250.52749 523.0897 0.9429490
## rMDD+aMCI-naMCI        29.1782353 -351.81848 410.1750 0.9999884
## rMDD+naMCI-naMCI      135.9175456 -287.90614 559.7412 0.9636379
## rMDD+aMCI-rMDD       -107.1028571 -466.83739 252.6317 0.9748563
## rMDD+naMCI-rMDD        -0.3635468 -405.18073 404.4536 1.0000000
## rMDD+naMCI-rMDD+aMCI  106.7393103 -292.52824 506.0069 0.9855226
##              Df    Sum Sq  Mean Sq F value   Pr(>F)    
## Dx            6   9887734  1647956   5.117 4.93e-05 ***
## Age           1   8888888  8888888  27.600 2.75e-07 ***
## ICV           1  63523894 63523894 197.241  < 2e-16 ***
## Sex           1    209698   209698   0.651    0.420    
## Dx:Age        6   1053044   175507   0.545    0.774    
## Residuals   315 101449418   322062                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Lthal_vol ~ Dx * Age + ICV + Sex, data = All.subcort.Vol)
## 
## $Dx
##                              diff        lwr      upr     p adj
## aMCI-AD               215.7689605 -105.06799 536.6059 0.4194399
## HC-AD                 546.9963415  200.84911 893.1436 0.0000831
## naMCI-AD              344.5081062  -46.11703 735.1332 0.1243015
## rMDD-AD               480.7891986  111.06029 850.5181 0.0026183
## rMDD+aMCI-AD          373.6863415   10.09630 737.2764 0.0394932
## rMDD+naMCI-AD         480.4256518   71.80620 889.0451 0.0098684
## HC-aMCI               331.2273810   40.69717 621.7576 0.0140528
## naMCI-aMCI            128.7391457 -213.57342 471.0517 0.9229231
## rMDD-aMCI             265.0202381  -53.23966 583.2801 0.1734996
## rMDD+aMCI-aMCI        157.9173810 -153.18970 469.0245 0.7409613
## rMDD+naMCI-aMCI       264.6566913  -98.05497 627.3684 0.3175483
## naMCI-HC             -202.4882353 -568.62954 163.6531 0.6556883
## rMDD-HC               -66.2071429 -409.96713 277.5528 0.9975467
## rMDD+aMCI-HC         -173.3100000 -510.45860 163.8386 0.7293467
## rMDD+naMCI-HC         -66.5706897 -451.85151 318.7101 0.9986676
## rMDD-naMCI            136.2810924 -252.23019 524.7924 0.9440710
## rMDD+aMCI-naMCI        29.1782353 -353.49560 411.8521 0.9999887
## rMDD+naMCI-naMCI      135.9175456 -289.77178 561.6069 0.9643839
## rMDD+aMCI-rMDD       -107.1028571 -468.42091 254.2152 0.9753868
## rMDD+naMCI-rMDD        -0.3635468 -406.96270 406.2356 1.0000000
## rMDD+naMCI-rMDD+aMCI  106.7393103 -294.28578 507.7644 0.9858383
## Analysis of Variance Table
## 
## Model 1: Lthal_vol ~ Dx + Age + ICV + Sex
## Model 2: Lthal_vol ~ Dx * Age + ICV + Sex
##   Res.Df       RSS Df Sum of Sq      F Pr(>F)
## 1    321 102502462                           
## 2    315 101449418  6   1053044 0.5449 0.7738
##              Df   Sum Sq  Mean Sq F value  Pr(>F)    
## Dx            6  8092645  1348774   5.379 2.6e-05 ***
## Age           1  5051598  5051598  20.148 1.0e-05 ***
## ICV           1 45916817 45916817 183.133 < 2e-16 ***
## Sex           1   624294   624294   2.490   0.116    
## Residuals   321 80484179   250730                    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Rthal_vol ~ Dx + Age + ICV + Sex, data = All.subcort.Vol)
## 
## $Dx
##                             diff        lwr       upr     p adj
## aMCI-AD               170.655314 -112.39586 453.70648 0.5565224
## HC-AD                 474.846385  169.46579 780.22698 0.0001159
## naMCI-AD              273.520230  -71.10000 618.14046 0.2215351
## rMDD-AD               401.077933   74.89293 727.26294 0.0056515
## rMDD+aMCI-AD          230.137615  -90.63151 550.90674 0.3382658
## rMDD+naMCI-AD         468.214550  107.71925 828.70985 0.0026609
## HC-aMCI               304.191071   47.87734 560.50481 0.0088155
## naMCI-aMCI            102.864916 -199.13263 404.86247 0.9513612
## rMDD-aMCI             230.422619  -50.35501 511.20025 0.1875047
## rMDD+aMCI-aMCI         59.482302 -214.98491 333.94951 0.9952929
## rMDD+naMCI-aMCI       297.559236  -22.43496 617.55343 0.0874818
## naMCI-HC             -201.326155 -524.34607 121.69376 0.5157219
## rMDD-HC               -73.768452 -377.04295 229.50605 0.9912084
## rMDD+aMCI-HC         -244.708770 -542.15052  52.73298 0.1850738
## rMDD+naMCI-HC          -6.631835 -346.53716 333.27349 1.0000000
## rMDD-naMCI            127.557703 -215.19762 470.31303 0.9265556
## rMDD+aMCI-naMCI       -43.382614 -380.98799 294.22276 0.9997570
## rMDD+naMCI-naMCI      194.694320 -180.86049 570.24914 0.7214861
## rMDD+aMCI-rMDD       -170.940317 -489.70503 147.82440 0.6881399
## rMDD+naMCI-rMDD        67.136617 -291.57633 425.84956 0.9979119
## rMDD+naMCI-rMDD+aMCI  238.076935 -115.71842 591.87229 0.4187915
##              Df   Sum Sq  Mean Sq F value   Pr(>F)    
## Dx            6  8092645  1348774   5.355 2.78e-05 ***
## Age           1  5051598  5051598  20.056 1.05e-05 ***
## ICV           1 45916817 45916817 182.299  < 2e-16 ***
## Sex           1   624294   624294   2.479    0.116    
## Dx:Age        6  1143043   190507   0.756    0.605    
## Residuals   315 79341136   251877                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Age

## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## ICV
## Warning in replications(paste("~", xx), data = mf): non-factors ignored:
## Dx, Age
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = Rthal_vol ~ Dx * Age + ICV + Sex, data = All.subcort.Vol)
## 
## $Dx
##                             diff        lwr       upr     p adj
## aMCI-AD               170.655314 -113.07700 454.38763 0.5593021
## HC-AD                 474.846385  168.73090 780.96187 0.0001223
## naMCI-AD              273.520230  -71.92931 618.96977 0.2240226
## rMDD-AD               401.077933   74.10798 728.04788 0.0058362
## rMDD+aMCI-AD          230.137615  -91.40342 551.67865 0.3411326
## rMDD+naMCI-AD         468.214550  106.85173 829.57737 0.0027592
## HC-aMCI               304.191071   47.26053 561.12161 0.0090813
## naMCI-aMCI            102.864916 -199.85938 405.58921 0.9518793
## rMDD-aMCI             230.422619  -51.03069 511.87592 0.1898072
## rMDD+aMCI-aMCI         59.482302 -215.64540 334.61001 0.9953501
## rMDD+naMCI-aMCI       297.559236  -23.20501 618.32348 0.0889624
## naMCI-HC             -201.326155 -525.12340 122.47109 0.5185847
## rMDD-HC               -73.768452 -377.77277 230.23586 0.9913129
## rMDD+aMCI-HC         -244.708770 -542.86630  53.44876 0.1873615
## rMDD+naMCI-HC          -6.631835 -347.35512 334.09145 1.0000000
## rMDD-naMCI            127.557703 -216.02244 471.13785 0.9273038
## rMDD+aMCI-naMCI       -43.382614 -381.80042 295.03519 0.9997602
## rMDD+naMCI-naMCI      194.694320 -181.76425 571.15289 0.7236478
## rMDD+aMCI-rMDD       -170.940317 -490.47212 148.59149 0.6904624
## rMDD+naMCI-rMDD        67.136617 -292.43955 426.71279 0.9979378
## rMDD+naMCI-rMDD+aMCI  238.076935 -116.56981 592.72368 0.4217328
## Analysis of Variance Table
## 
## Model 1: Rthal_vol ~ Dx + Age + ICV + Sex
## Model 2: Rthal_vol ~ Dx * Age + ICV + Sex
##   Res.Df      RSS Df Sum of Sq      F Pr(>F)
## 1    321 80484179                           
## 2    315 79341136  6   1143043 0.7564 0.6048

figures Hippo

## Installing package into '/home/nrashidi/R/x86_64-pc-linux-gnu-library/3.5'
## (as 'lib' is unspecified)
## 
## Attaching package: 'magrittr'
## The following object is masked from 'package:tidyr':
## 
##     extract

for changing colors

# wes_palettes <- list(
#   BottleRocket1 = c("#A42820", "#5F5647", "#9B110E", "#3F5151", "#4E2A1E", "#550307", "#0C1707"),
#   BottleRocket2 = c("#FAD510", "#CB2314", "#273046", "#354823", "#1E1E1E"),
#   Rushmore1 = c("#E1BD6D", "#EABE94", "#0B775E", "#35274A" ,"#F2300F"),
#   Rushmore = c("#E1BD6D", "#EABE94", "#0B775E", "#35274A" ,"#F2300F"),
#   Royal1 = c("#899DA4", "#C93312", "#FAEFD1", "#DC863B"),
#   Royal2 = c("#9A8822", "#F5CDB4", "#F8AFA8", "#FDDDA0", "#74A089"),
#   Zissou1 = c("#3B9AB2", "#78B7C5", "#EBCC2A", "#E1AF00", "#F21A00"),
#   Darjeeling1 = c("#FF0000", "#00A08A", "#F2AD00", "#F98400", "#5BBCD6"),
#   Darjeeling2 = c("#ECCBAE", "#046C9A", "#D69C4E", "#ABDDDE", "#000000"),
#   Chevalier1 = c("#446455", "#FDD262", "#D3DDDC", "#C7B19C"),
#   FantasticFox1 = c("#DD8D29", "#E2D200", "#46ACC8", "#E58601", "#B40F20"),
#   Moonrise1 = c("#F3DF6C", "#CEAB07", "#D5D5D3", "#24281A"),
#   Moonrise2 = c("#798E87", "#C27D38", "#CCC591", "#29211F"),
#   Moonrise3 = c("#85D4E3", "#F4B5BD", "#9C964A", "#CDC08C", "#FAD77B"),
#   Cavalcanti1 = c("#D8B70A", "#02401B", "#A2A475", "#81A88D", "#972D15"),
#   GrandBudapest1 = c("#F1BB7B", "#FD6467", "#5B1A18", "#D67236"),
#   GrandBudapest2 = c("#E6A0C4", "#C6CDF7", "#D8A499", "#7294D4"),
#   IsleofDogs1 = c("#9986A5", "#79402E", "#CCBA72", "#0F0D0E", "#D9D0D3", "#8D8680"),
#   IsleofDogs2 = c("#EAD3BF", "#AA9486", "#B6854D", "#39312F", "#1C1718")
# )
# 
# g + scale_fill_manual(wes_palette(7, name="BottleRocket1"))

boxplot hippo

## Saving 7 x 5 in image
## Saving 7 x 5 in image

## Saving 7 x 5 in image
## Saving 7 x 5 in image

boxplot Amygdala

## Saving 7 x 5 in image
## Saving 7 x 5 in image

## Saving 7 x 5 in image
## Saving 7 x 5 in image

boxplot accumbens

## Saving 7 x 5 in image
## Saving 7 x 5 in image

## Saving 7 x 5 in image
## Saving 7 x 5 in image

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.