setwd("~/Documents/Teresa/MedScholars/Data/Data files/CSV")
del1 <- read.csv("working data_DEL_ApoE clean.csv")
del2 <- read.csv("working data_DEL_ms_age.csv")

Predicting DEL:

Gene x Gender ANOVA

d1 <- aov(DEL ~ sex + ApoE + sex:ApoE, data = del1)
summary (d1)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## sex          1  0.135  0.1346   1.511 0.2242  
## ApoE         3  1.017  0.3390   3.806 0.0149 *
## sex:ApoE     3  0.347  0.1158   1.300 0.2835  
## Residuals   56  4.989  0.0891                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Gender x Dx ANOVA (Significant Main Effect of both Gender and Dx, but no interaction. Why no ME of Gender on previous anova?)

d2 <- aov(DEL~sex+Dx+Dx:sex, data= del1)
summary (d2)
##             Df Sum Sq Mean Sq F value Pr(>F)    
## sex          1  0.135  0.1346   4.826  0.032 *  
## Dx           2  4.735  2.3676  84.919 <2e-16 ***
## sex:Dx       2  0.001  0.0004   0.016  0.984    
## Residuals   58  1.617  0.0279                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Gene x Gender x Dx ANOVA (only Dx is significant, trend for ApoE)

d3 <- aov(DEL~(Dx*sex*ApoE), data=del1)
summary (d3)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Dx           2  4.859  2.4294  84.846 7.95e-16 ***
## sex          1  0.011  0.0110   0.384   0.5389    
## ApoE         3  0.195  0.0650   2.269   0.0937 .  
## Dx:sex       2  0.000  0.0001   0.004   0.9961    
## Dx:ApoE      5  0.053  0.0105   0.368   0.8678    
## sex:ApoE     3  0.030  0.0101   0.353   0.7872    
## Dx:sex:ApoE  3  0.080  0.0267   0.932   0.4335    
## Residuals   44  1.260  0.0286                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Linear Regression with Dx, Age, and Edu - Edu is significant, but not age

s4 <- lm(DEL~Dx + Age + education, data=del1)
summary (s4)
## 
## Call:
## lm(formula = DEL ~ Dx + Age + education, data = del1)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -0.34417 -0.09940  0.00367  0.11504  0.34222 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.125797   0.223241   0.564   0.5752    
## DxMCI        0.021854   0.060400   0.362   0.7188    
## DxNC         0.539068   0.057255   9.415 2.34e-13 ***
## Age         -0.003400   0.002507  -1.356   0.1803    
## education    0.019639   0.009368   2.096   0.0403 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.1585 on 59 degrees of freedom
## Multiple R-squared:  0.7716, Adjusted R-squared:  0.7561 
## F-statistic: 49.84 on 4 and 59 DF,  p-value: < 2.2e-16

Median split on age - age is now significiant. But, no age x gender interaction, nor age x dx interaction

s5 <- aov(DEL~sex+Age+Age:sex, data=del2)
summary (s5)
##             Df Sum Sq Mean Sq F value Pr(>F)   
## sex          1  0.135  0.1346   1.469 0.2302   
## Age          1  0.767  0.7670   8.374 0.0053 **
## sex:Age      1  0.091  0.0908   0.991 0.3235   
## Residuals   60  5.495  0.0916                  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
s6 <- aov(DEL~Age+Dx+Age:Dx, data=del2)
summary (s6)
##             Df Sum Sq Mean Sq F value   Pr(>F)    
## Age          1  0.701  0.7014  26.674 3.09e-06 ***
## Dx           2  4.209  2.1047  80.041  < 2e-16 ***
## Age:Dx       2  0.052  0.0259   0.985     0.38    
## Residuals   58  1.525  0.0263                     
## ---
## 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.