Right Side

####Rest and fMRI#####
indiffrest = read.csv("E:/Box Sync/wlab/lab-members/aml/certs1-pilot/3-experiment-fmri/eye-tracking-MRI/individualdiffrestnew.csv", stringsAsFactors = FALSE)

cor.test(indiffrest$rOFC_rIFG, indiffrest$l_OFC)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$rOFC_rIFG and indiffrest$l_OFC
## t = 1.5068, df = 38, p-value = 0.1401
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.07998522  0.51114296
## sample estimates:
##       cor 
## 0.2374402
r <- round(cor(indiffrest$rOFC_rIFG, indiffrest$l_OFC), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$rOFC_rIFG, indiffrest$l_OFC)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$rOFC_rIFG, indiffrest$l_OFC, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .25,1.9,label= r)+ annotate('text', .25,1.7,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and l_OFC.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(indiffrest$rOFC_rIFG, indiffrest$l_IFG)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$rOFC_rIFG and indiffrest$l_IFG
## t = -0.10245, df = 38, p-value = 0.9189
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3264363  0.2964271
## sample estimates:
##         cor 
## -0.01661661
r <- round(cor(indiffrest$rOFC_rIFG, indiffrest$l_IFG), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$rOFC_rIFG, indiffrest$l_IFG)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$rOFC_rIFG, indiffrest$l_IFG, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,1.9,label= r)+ annotate('text', .5,1.7,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and l_IFG.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and DTI (outlier corrected)#####
outcorrDTI<-indiffrest[-13,]

cor.test(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr50)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrDTI$rOFC_rIFG and outcorrDTI$FA_thr50
## t = -0.17955, df = 37, p-value = 0.8585
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3418397  0.2886997
## sample estimates:
##         cor 
## -0.02950494
r <- round(cor(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr50), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr50)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr50, data = outcorrDTI) + geom_smooth(method = 'lm') + annotate('text', .5,.47,label= r)+ annotate('text', .5,.46,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and FA_thr50.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr75)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrDTI$rOFC_rIFG and outcorrDTI$FA_thr75
## t = -0.50928, df = 37, p-value = 0.6136
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3887171  0.2383589
## sample estimates:
##         cor 
## -0.08343286
r <- round(cor(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr75), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr75)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrDTI$rOFC_rIFG, outcorrDTI$FA_thr75, data = outcorrDTI) + geom_smooth(method = 'lm') + annotate('text', .5,.47,label= r)+ annotate('text', .5,.46,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and FA_thr75.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and ET#####
outcorrET<-indiffrest[-15,]

cor.test(indiffrest$rOFC_rIFG, indiffrest$zDTDiff)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$rOFC_rIFG and indiffrest$zDTDiff
## t = 3.6229, df = 38, p-value = 0.000849
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2317616 0.7066609
## sample estimates:
##     cor 
## 0.50669
r <- round(cor(indiffrest$rOFC_rIFG, indiffrest$zDTDiff), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$rOFC_rIFG, indiffrest$zDTDiff)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$rOFC_rIFG, indiffrest$zDTDiff, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,1.4,label= r)+ annotate('text', .5,1.6,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and zDTDiff.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(indiffrest$rOFC_rIFG, indiffrest$DTDiff)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$rOFC_rIFG and indiffrest$DTDiff
## t = 3.7562, df = 38, p-value = 0.0005779
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  0.2492307 0.7158226
## sample estimates:
##       cor 
## 0.5203419
r <- round(cor(indiffrest$rOFC_rIFG, indiffrest$DTDiff), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$rOFC_rIFG, indiffrest$DTDiff)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$rOFC_rIFG, indiffrest$DTDiff, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,.2,label= r)+ annotate('text', .5,.22,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and DTDiff.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and Age#####

cor.test(indiffrest$rOFC_rIFG, indiffrest$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$rOFC_rIFG and indiffrest$Age
## t = -0.537, df = 38, p-value = 0.5944
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3878093  0.2309694
## sample estimates:
##         cor 
## -0.08678402
r <- round(cor(indiffrest$rOFC_rIFG, indiffrest$Age), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$rOFC_rIFG, indiffrest$Age)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$rOFC_rIFG, indiffrest$Age, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .2,16,label= r)+ annotate('text', .5,16,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and Age.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and BMI#####
outcorrBMI<-indiffrest[c(-30,-24,-26,-6),]

cor.test(outcorrBMI$rOFC_rIFG, outcorrBMI$BMI)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrBMI$rOFC_rIFG and outcorrBMI$BMI
## t = -0.40587, df = 36, p-value = 0.6872
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3789964  0.2577545
## sample estimates:
##         cor 
## -0.06749002
r <- round(cor(outcorrBMI$rOFC_rIFG, outcorrBMI$BMI), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrBMI$rOFC_rIFG, outcorrBMI$BMI)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrBMI$rOFC_rIFG, outcorrBMI$BMI, data = outcorrBMI) + geom_smooth(method = 'lm') + annotate('text', .2,16,label= r)+ annotate('text', .5,16,label= p)
## Warning: Removed 3 rows containing non-finite values (stat_smooth).
## Warning: Removed 3 rows containing missing values (geom_point).

ggsave(file = 'rOFC_rIFG and BMI.pdf')
## Saving 7 x 5 in image
## Warning: Removed 3 rows containing non-finite values (stat_smooth).

## Warning: Removed 3 rows containing missing values (geom_point).

Left Side

####Rest and fMRI#####
indiffrest = read.csv("E:/Box Sync/wlab/lab-members/aml/certs1-pilot/3-experiment-fmri/eye-tracking-MRI/individualdiffrestnew.csv", stringsAsFactors = FALSE)

cor.test(indiffrest$lIFG_lOFC, indiffrest$l_OFC)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$lIFG_lOFC and indiffrest$l_OFC
## t = 0.20102, df = 38, p-value = 0.8418
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2817779  0.3406432
## sample estimates:
##        cor 
## 0.03259233
r <- round(cor(indiffrest$lIFG_lOFC, indiffrest$l_OFC), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$lIFG_lOFC, indiffrest$l_OFC)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$lIFG_lOFC, indiffrest$l_OFC, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,1.9,label= r)+ annotate('text', .5,1.7,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).
## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and l_OFC.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(indiffrest$lIFG_lOFC, indiffrest$l_IFG)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$lIFG_lOFC and indiffrest$l_IFG
## t = 0.46732, df = 38, p-value = 0.6429
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.2416063  0.3781961
## sample estimates:
##        cor 
## 0.07559236
r <- round(cor(indiffrest$lIFG_lOFC, indiffrest$l_IFG), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$lIFG_lOFC, indiffrest$l_IFG)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$lIFG_lOFC, indiffrest$l_IFG, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,1.9,label= r)+ annotate('text', .5,1.7,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and l_IFG.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and DTI (outlier corrected)#####
outcorrDTI<-indiffrest[-13,]

cor.test(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr50)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrDTI$lIFG_lOFC and outcorrDTI$FA_thr50
## t = -0.80385, df = 37, p-value = 0.4266
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4288050  0.1924593
## sample estimates:
##        cor 
## -0.1310134
r <- round(cor(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr50), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr50)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr50, data = outcorrDTI) + geom_smooth(method = 'lm') + annotate('text', .5,.47,label= r)+ annotate('text', .5,.46,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and FA_thr50.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr75)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrDTI$lIFG_lOFC and outcorrDTI$FA_thr75
## t = -1.0831, df = 37, p-value = 0.2858
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.4650995  0.1484180
## sample estimates:
##        cor 
## -0.1753085
r <- round(cor(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr75), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr75)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrDTI$lIFG_lOFC, outcorrDTI$FA_thr75, data = outcorrDTI) + geom_smooth(method = 'lm') + annotate('text', .5,.47,label= r)+ annotate('text', .5,.46,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and FA_thr75.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and ET#####
cor.test(indiffrest$lIFG_lOFC, indiffrest$zDTDiff)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$lIFG_lOFC and indiffrest$zDTDiff
## t = 0.97969, df = 38, p-value = 0.3334
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1624982  0.4466284
## sample estimates:
##       cor 
## 0.1569562
r <- round(cor(indiffrest$lIFG_lOFC, indiffrest$zDTDiff), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$lIFG_lOFC, indiffrest$zDTDiff)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$lIFG_lOFC, indiffrest$zDTDiff, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,1.4,label= r)+ annotate('text', .5,1.6,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and zDTDiff.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
cor.test(indiffrest$lIFG_lOFC, indiffrest$DTDiff)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$lIFG_lOFC and indiffrest$DTDiff
## t = 1.033, df = 38, p-value = 0.3081
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1541754  0.4534363
## sample estimates:
##       cor 
## 0.1652715
r <- round(cor(indiffrest$lIFG_lOFC, indiffrest$DTDiff), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$lIFG_lOFC, indiffrest$DTDiff)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$lIFG_lOFC, indiffrest$DTDiff, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .5,.2,label= r)+ annotate('text', .5,.22,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and DTDiff.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and Age#####

cor.test(indiffrest$lIFG_lOFC, indiffrest$Age)
## 
##  Pearson's product-moment correlation
## 
## data:  indiffrest$lIFG_lOFC and indiffrest$Age
## t = -0.20535, df = 38, p-value = 0.8384
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.3412635  0.2811316
## sample estimates:
##         cor 
## -0.03329343
r <- round(cor(indiffrest$lIFG_lOFC, indiffrest$Age), 4)
r<- paste('r =',r) 
p <- round(cor.test(indiffrest$lIFG_lOFC, indiffrest$Age)$p.value, 4)
p <- paste('p =',p)
qplot(indiffrest$lIFG_lOFC, indiffrest$Age, data = indiffrest) + geom_smooth(method = 'lm') + annotate('text', .2,16,label= r)+ annotate('text', .5,16,label= p)
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and Age.pdf')
## Saving 7 x 5 in image
## Warning: Removed 5 rows containing non-finite values (stat_smooth).

## Warning: Removed 5 rows containing missing values (geom_point).
####Rest and BMI#####
outcorrBMI<-indiffrest[c(-30,-24,-26,-6),]

cor.test(outcorrBMI$lIFG_lOFC, outcorrBMI$BMI)
## 
##  Pearson's product-moment correlation
## 
## data:  outcorrBMI$lIFG_lOFC and outcorrBMI$BMI
## t = 1.9172, df = 36, p-value = 0.06317
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.01695391  0.56872294
## sample estimates:
##       cor 
## 0.3043791
r <- round(cor(outcorrBMI$lIFG_lOFC, outcorrBMI$BMI), 4)
r<- paste('r =',r) 
p <- round(cor.test(outcorrBMI$lIFG_lOFC, outcorrBMI$BMI)$p.value, 4)
p <- paste('p =',p)
qplot(outcorrBMI$lIFG_lOFC, outcorrBMI$BMI, data = outcorrBMI) + geom_smooth(method = 'lm') + annotate('text', .2,16,label= r)+ annotate('text', .5,16,label= p)
## Warning: Removed 3 rows containing non-finite values (stat_smooth).
## Warning: Removed 3 rows containing missing values (geom_point).

ggsave(file = 'lIFG_lOFC and BMI.pdf')
## Saving 7 x 5 in image
## Warning: Removed 3 rows containing non-finite values (stat_smooth).

## Warning: Removed 3 rows containing missing values (geom_point).

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