setwd("~/Documents/Teresa/MedScholars/Data/Data files/CSV")
srlm1 <- read.csv("working data_SRLM_APOE clean.csv")
srlm2 <- read.csv("working data_SRLM_ms_age.csv")

Predicting SRLM_avg:

Gene x Gender ANOVA

s2 <- aov(SRLM_avg ~ sex + ApoE + sex:ApoE, data = srlm1)
summary (s2)
##             Df Sum Sq  Mean Sq F value Pr(>F)  
## sex          1 0.0085 0.008526   1.432 0.2346  
## ApoE         3 0.0511 0.017027   2.861 0.0415 *
## sex:ApoE     3 0.0103 0.003448   0.579 0.6302  
## Residuals   87 0.5179 0.005952                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Gender x Dx ANOVA

s3 <- aov(SRLM_avg ~ sex + Dx + Dx:sex, data = srlm1)
summary (s3)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## sex          1 0.0085 0.00853   1.897    0.172    
## Dx           2 0.1774 0.08869  19.736 8.05e-08 ***
## sex:Dx       2 0.0020 0.00099   0.220    0.803    
## Residuals   89 0.3999 0.00449                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Gender x Gene x Dx ANOVA

s5 <- aov(SRLM_avg ~(Dx*sex*ApoE), data = srlm1)
summary (s5)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Dx           2 0.1742 0.08708  19.191 2.09e-07 ***
## sex          1 0.0117 0.01173   2.586    0.112    
## ApoE         3 0.0081 0.00269   0.593    0.621    
## Dx:sex       2 0.0021 0.00104   0.229    0.796    
## Dx:ApoE      6 0.0188 0.00313   0.691    0.658    
## sex:ApoE     3 0.0073 0.00244   0.539    0.657    
## Dx:sex:ApoE  5 0.0389 0.00778   1.714    0.142    
## Residuals   72 0.3267 0.00454                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Linear Regression with Dx, Age, and Education I:

s4 <- lm (SRLM_avg ~ Dx + Age + education, data = srlm1)
summary (s4)
## 
## Call:
## lm(formula = SRLM_avg ~ Dx + Age + education, data = srlm1)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.112238 -0.050112 -0.003745  0.025627  0.171011 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.5554407  0.0746436   7.441 5.99e-11 ***
## DxMCI        0.0362519  0.0191302   1.895   0.0613 .  
## DxNC         0.0993279  0.0176615   5.624 2.13e-07 ***
## Age         -0.0013144  0.0008574  -1.533   0.1288    
## education    0.0006396  0.0033800   0.189   0.8503    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.06691 on 89 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.3123, Adjusted R-squared:  0.2814 
## F-statistic:  10.1 on 4 and 89 DF,  p-value: 8.652e-07

II: Age is significant in predicting RIGHT, but not LEFT SRLM (not ERC) atrophy, independent of education and dx

s14 <- lm(SRLM_r~Age+education+Dx, data = srlm1)
summary (s14)
## 
## Call:
## lm(formula = SRLM_r ~ Age + education + Dx, data = srlm1)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.117835 -0.048941 -0.007725  0.041137  0.244788 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.6101279  0.0808992   7.542 3.75e-11 ***
## Age         -0.0020401  0.0009292  -2.196   0.0307 *  
## education    0.0006533  0.0036633   0.178   0.8589    
## DxMCI        0.0295130  0.0207335   1.423   0.1581    
## DxNC         0.0802550  0.0191417   4.193 6.49e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07251 on 89 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.2331, Adjusted R-squared:  0.1986 
## F-statistic: 6.762 on 4 and 89 DF,  p-value: 8.463e-05
s15 <-lm(SRLM_l~Age+education+Dx, data = srlm1)
summary (s15)
## 
## Call:
## lm(formula = SRLM_l ~ Age + education + Dx, data = srlm1)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.124077 -0.058623 -0.001447  0.037910  0.270176 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.5007534  0.0887730   5.641 1.98e-07 ***
## Age         -0.0005887  0.0010197  -0.577   0.5651    
## education    0.0006259  0.0040198   0.156   0.8766    
## DxMCI        0.0429907  0.0227514   1.890   0.0621 .  
## DxNC         0.1184008  0.0210047   5.637 2.01e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.07957 on 89 degrees of freedom
##   (1 observation deleted due to missingness)
## Multiple R-squared:  0.2957, Adjusted R-squared:  0.264 
## F-statistic:  9.34 on 4 and 89 DF,  p-value: 2.383e-06

Median split on Age (now age is significant for srlm_avg)

s7 <- aov(SRLM_avg ~ sex + Age + Age: sex, data = srlm2)
summary (s7)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## sex          1 0.0078 0.00779   1.301 0.2571  
## Age          1 0.0379 0.03794   6.333 0.0136 *
## sex:Age      1 0.0007 0.00066   0.110 0.7406  
## Residuals   90 0.5392 0.00599                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s8 <- aov(SRLM_avg ~ Age + Dx + Age:Dx, data = srlm2)
summary (s8)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Age          1 0.0400 0.04001   9.096  0.00335 ** 
## Dx           2 0.1554 0.07772  17.669 3.54e-07 ***
## Age:Dx       2 0.0030 0.00150   0.342  0.71157    
## Residuals   88 0.3871 0.00440                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Predicting ERC (slight trend in Dx x Gene interaction)

s9<- aov(ERC_avg ~ (Dx*sex*ApoE), data=srlm1)
summary (s9)
##             Df Sum Sq Mean Sq F value Pr(>F)   
## Dx           2  0.891  0.4453   5.453 0.0063 **
## sex          1  0.084  0.0836   1.024 0.3151   
## ApoE         3  0.181  0.0603   0.738 0.5329   
## Dx:sex       2  0.194  0.0969   1.187 0.3112   
## Dx:ApoE      6  0.955  0.1591   1.948 0.0850 . 
## sex:ApoE     3  0.347  0.1158   1.418 0.2449   
## Dx:sex:ApoE  4  0.594  0.1484   1.817 0.1353   
## Residuals   70  5.717  0.0817                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness

Predicting average hippocampal volume (trend in main effect of Gender, and trend in Dx x APOE)

s10 <- aov(Hipp_avg~(Dx*sex*ApoE), data = srlm1)
summary (s10)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Dx           2 0.1667 0.08337  13.142 1.43e-05 ***
## sex          1 0.0212 0.02122   3.345   0.0717 .  
## ApoE         3 0.0671 0.02238   3.527   0.0192 *  
## Dx:sex       2 0.0048 0.00242   0.382   0.6840    
## Dx:ApoE      6 0.0796 0.01327   2.091   0.0651 .  
## sex:ApoE     3 0.0209 0.00697   1.099   0.3554    
## Dx:sex:ApoE  4 0.0395 0.00987   1.556   0.1957    
## Residuals   70 0.4441 0.00634                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness

Main effect of gender on right hippocampal volume = trend. But no main effect of gender on right or left SRLM.

s11 <- aov(Hipp_r~sex, data = srlm2)
summary (s11)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## sex          1 0.0309 0.03094   3.086 0.0824 .
## Residuals   89 0.8923 0.01002                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness
s13 <- aov(SRLM_r~(sex*ApoE), data = srlm1)
summary (s13)
##             Df Sum Sq  Mean Sq F value Pr(>F)
## sex          1 0.0078 0.007778   1.156  0.285
## ApoE         3 0.0233 0.007762   1.154  0.332
## sex:ApoE     3 0.0207 0.006887   1.024  0.386
## Residuals   87 0.5854 0.006728
s13.1 <- aov(SRLM_l~(sex*ApoE), data = srlm1)
summary (s13.1)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## sex          1 0.0093 0.00931   1.177 0.28102   
## ApoE         3 0.0957 0.03192   4.035 0.00976 **
## sex:ApoE     3 0.0073 0.00242   0.306 0.82098   
## Residuals   87 0.6881 0.00791                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

But a trend in Dx x Gender x APOE is observed in SRLM_R.

s16 <- aov(SRLM_r~(Dx*sex*ApoE), data=srlm1)
summary (s16)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Dx           2 0.1234 0.06168  11.091 6.33e-05 ***
## sex          1 0.0108 0.01083   1.948   0.1671    
## ApoE         3 0.0053 0.00178   0.320   0.8109    
## Dx:sex       2 0.0032 0.00158   0.285   0.7531    
## Dx:ApoE      6 0.0264 0.00440   0.792   0.5791    
## sex:ApoE     3 0.0099 0.00330   0.594   0.6210    
## Dx:sex:ApoE  5 0.0577 0.01153   2.074   0.0786 .  
## Residuals   72 0.4004 0.00556                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

However, there is no interaction between age and gender on SRLM_R thinning (with median split on age)

s17 <- aov(SRLM_r~(sex*Age), data=srlm2)
summary (s17)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## sex          1 0.0078 0.00784   1.255 0.26561   
## Age          1 0.0627 0.06272  10.040 0.00209 **
## sex:Age      1 0.0043 0.00429   0.687 0.40954   
## Residuals   90 0.5622 0.00625                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

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