ALFF-CBF SURF COUPLING
# read in packages
library(plyr)
## Warning: package 'plyr' was built under R version 3.2.5
# read in demos
alffCbf_subjDemos <- read.csv("/data/jux/BBL/projects/coupling/subjectsLists/n882_alff_cbf_finalSample.csv")
alffCbf_subjDemos$sex <- as.factor(alffCbf_subjDemos$sex)
# get all files
setwd("/data/jux/BBL/projects/coupling/couplingSurfaceMaps/alffCbf/lh/stat")
lh_alffCbf_files = list.files(pattern="*.asc")
lh_alffCbf_data = do.call(rbind, lapply(lh_alffCbf_files, function(x) read.table(x, stringsAsFactors = FALSE)))
lh_alffCbf_coupling <- as.data.frame(lh_alffCbf_data$V5)
lh_alffCbf_coupling_n <- t(as.data.frame(split(lh_alffCbf_coupling,1:882)))
setwd("/data/jux/BBL/projects/coupling/couplingSurfaceMaps/alffCbf/rh/stat")
rh_alffCbf_files = list.files(pattern="*.asc")
rh_alffCbf_data = do.call(rbind, lapply(rh_alffCbf_files, function(x) read.table(x, stringsAsFactors = FALSE)))
rh_alffCbf_coupling <- as.data.frame(rh_alffCbf_data$V5)
rh_alffCbf_coupling_n <- t(as.data.frame(split(rh_alffCbf_coupling,1:882)))
# run model
for (i in 1:10242) {
lh_alffCbf_agemodel <- lm(lh_alffCbf_coupling_n[,i] ~ ageAtScan1, data=alffCbf_subjDemos)
lh_alffCbf_ageSexmodel <- lm(lh_alffCbf_coupling_n[,i] ~ ageAtScan1 + sex, data=alffCbf_subjDemos)
lh_alffCbf_ageSex_qaModel <- lm(lh_alffCbf_coupling_n[,i] ~ ageAtScan1 + sex + pcaslRelMeanRMSMotion + restRelMeanRMSMotion, data=alffCbf_subjDemos)
}
for (i in 1:10242) {
rh_alffCbf_agemodel <- lm(rh_alffCbf_coupling_n[,i] ~ ageAtScan1, data=alffCbf_subjDemos)
rh_alffCbf_ageSexmodel <- lm(rh_alffCbf_coupling_n[,i] ~ ageAtScan1 + sex, data=alffCbf_subjDemos)
rh_alffCbf_ageSex_qaModel <- lm(rh_alffCbf_coupling_n[,i] ~ ageAtScan1 + sex + pcaslRelMeanRMSMotion + restRelMeanRMSMotion, data=alffCbf_subjDemos)
}
# print out summary results
#summary(lh_alffCbf_agemodel)
#summary(lh_alffCbf_ageSexmodel)
summary(lh_alffCbf_ageSex_qaModel)
##
## Call:
## lm(formula = lh_alffCbf_coupling_n[, i] ~ ageAtScan1 + sex +
## pcaslRelMeanRMSMotion + restRelMeanRMSMotion, data = alffCbf_subjDemos)
##
## Residuals:
## Min 1Q Median 3Q Max
## -11.2812 -2.6083 -0.8098 2.4742 12.7862
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.58528 0.72526 -0.807 0.4199
## ageAtScan1 0.17556 0.03605 4.870 1.32e-06 ***
## sex2 0.09133 0.23522 0.388 0.6979
## pcaslRelMeanRMSMotion 7.43805 3.40535 2.184 0.0292 *
## restRelMeanRMSMotion -0.01980 3.31072 -0.006 0.9952
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 3.449 on 877 degrees of freedom
## Multiple R-squared: 0.02819, Adjusted R-squared: 0.02376
## F-statistic: 6.36 on 4 and 877 DF, p-value: 4.785e-05
#summary(rh_alffCbf_agemodel)
#summary(rh_alffCbf_ageSexmodel)
summary(rh_alffCbf_ageSex_qaModel)
##
## Call:
## lm(formula = rh_alffCbf_coupling_n[, i] ~ ageAtScan1 + sex +
## pcaslRelMeanRMSMotion + restRelMeanRMSMotion, data = alffCbf_subjDemos)
##
## Residuals:
## Min 1Q Median 3Q Max
## -14.7743 -2.3485 -0.8075 1.7692 17.3077
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.68322 0.87132 -0.784 0.433
## ageAtScan1 0.17523 0.04331 4.046 5.67e-05 ***
## sex2 0.18044 0.28259 0.639 0.523
## pcaslRelMeanRMSMotion 0.84702 4.09119 0.207 0.836
## restRelMeanRMSMotion 1.94965 3.97750 0.490 0.624
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 4.144 on 877 degrees of freedom
## Multiple R-squared: 0.01915, Adjusted R-squared: 0.01468
## F-statistic: 4.281 on 4 and 877 DF, p-value: 0.00195