Remember - Overall Memory Quality
ROIData <- read.csv(paste(myDir,'MeanROIBetavalues-Overall-Complexity-noEmot.csv',sep=""), header = TRUE, sep = ",")
title = 'Memory Quality'
event = 'Remember'
contrast = 'DetailRemembered'
ROIData <- subset(ROIData,Contrast == paste(event,'x',contrast,'^1',sep=""))
#set factors in results matrices
ROIData$SubID=as.factor(ROIData$SubID)
ROIData$Contrast=as.factor(ROIData$Contrast)
ROIData$ROI=as.factor(ROIData$ROI)
ROIData$ROI = factor(ROIData$ROI,levels(ROIData$ROI)[roiOrd])
ROIData <- ROIData %>% group_by(ROI)
NSubjs = length(unique(ROIData$SubID))
rois = levels(ROIData$ROI)
### test mean of each ROI against 0:
curData <- ROIData
cur_summary <- curData %>%
group_by(ROI) %>%
summarise(Mean = mean(MeanBeta), SE = se(MeanBeta))
# add '*' to means that are signficantly greater than 0
# one-sample t-test for each ROI, FDR-corrected
cur_summary$t <- ''
cur_summary$df <- ''
cur_summary$p <- ''
cur_summary$sig <- ''
# one-sample t-test for each ROI and add significance to cur_summary
for (r in 1:length(rois)) {
test <- t.test(curData$MeanBeta[curData$ROI == rois[r]], alternative = "greater", mu=0)
cur_summary$t[r] <- test$statistic
cur_summary$df[r] <- test$parameter
cur_summary$p[r] <- test$p.value
}
# FDR-correct:
PAdjust <- p.adjust(cur_summary$p, method = "fdr", n = length(cur_summary$p))
cur_summary$p <- PAdjust #replace original p values with adjusted
# add significance asterix:
for (r in 1:nrow(cur_summary)) {
if (as.numeric(cur_summary$p[r]) < 0.05) { #if significant FDR corrected, add asterix
cur_summary$sig[r] <- '*'
}
} # end of loop through seeds
print(kable(cur_summary))
|ROI | Mean| SE|t |df | p|sig |
|:-----|---------:|---------:|:-----------------|:--|---------:|:---|
|ANG | 0.7130027| 0.4132013|1.72555787309757 |27 | 0.0718924| |
|PREC | 1.5295700| 0.2859255|5.34954102797945 |27 | 0.0000657|* |
|PCC | 0.5734229| 0.2232577|2.5684348741583 |27 | 0.0137695|* |
|RSC | 1.6872258| 0.3293588|5.12275878418246 |27 | 0.0000657|* |
|PHC | 1.0580299| 0.2177675|4.85852926333797 |27 | 0.0000891|* |
|pHIPP | 0.5513186| 0.1655396|3.33043235535802 |27 | 0.0037783|* |
|aHIPP | 0.4125528| 0.1447718|2.84967714474821 |27 | 0.0099334|* |
|PRC | 0.1579373| 0.1735454|0.910063380583017 |27 | 0.1854211| |
|AMYG | 0.2716893| 0.2085626|1.30267508495452 |27 | 0.1111024| |
|FUS | 0.2483121| 0.1708063|1.45376405957694 |27 | 0.1050252| |
|ITC | 0.2365327| 0.1812127|1.30527674828236 |27 | 0.1111024| |
|OFC | 0.6089407| 0.2360448|2.57976812644389 |27 | 0.0137695|* |
# plots the mean ROI stats with 95% CI
myCol <- c("dodgerblue2","dodgerblue2","dodgerblue2","dodgerblue2","dodgerblue2",
"mediumorchid","mediumorchid",
"firebrick2","firebrick2","firebrick2","firebrick2","firebrick2")
ggplot(curData, aes(x=ROI, y=MeanBeta, fill = 'ROI')) +
stat_summary(fun.y = mean, geom="bar", alpha = 1, color = "gray20", fill = 'gray60') +
geom_dotplot(binaxis='y', stackdir='center', dotsize=0.5, alpha = 0.8, fill = 'gray80') +
stat_summary(fun.data = mean_se, geom = "errorbar", fun.args = list(mult = 1.96), width = 0.45, color = "black", size = 0.65) +
xlab("ROI") + ylab("Mean Beta") + geom_hline(yintercept = 0) +
ggtitle(title) +
theme(plot.title = element_text(hjust = 0.5, size=28), axis.line = element_line(colour = "black"),
axis.text.x = element_text(angle=45, vjust=1, hjust=1, size=22, colour=myCol),
axis.text.y = element_text(size=22), axis.title = element_text(size=26),
panel.background = element_blank(), legend.position="none", text = element_text(family="Helvetica"))
ggsave('Remember_Quality_Activity.jpg',plot=last_plot(),dpi=300,width=7.5,height=6)
write.csv(ROIData, "Univariate_MemoryQuality_data.csv", row.names=FALSE)
LS0tCnRpdGxlOiAiT3JiaXQgZk1SSSAtIFJPSSBVbml2YXJpYXRlIEFuYWx5c2VzIgpvdXRwdXQ6CiA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