In [11]:
library(tidyr)
library(corrplot)
library(RColorBrewer)
library(plyr)
library(fdrtool)
In [5]:
abide_anat_spat_df<-read.csv("2016_05_ABIDE_qap_anatomical_spatial.csv")
id.vars=c('Participant','Site','Session','Series')
measure.vars=c('CNR','Cortical.Contrast','EFC','FBER','FWHM','Qi1','SNR')
abide_anat_spat_df<-abide_anat_spat_df[c(id.vars,measure.vars)]
# remove outliers
abide_anat_spat_df <- abide_anat_spat_df %>% drop_na()
head(abide_anat_spat_df)
In [14]:
all_zmats <- daply(abide_anat_spat_df, .(Site), function(x) {
cmat <- cor(x[,measure.vars], use="pairwise.complete.obs")
cmat[cmat>0.9999999] <- 0.9999999 # clamp
zmat <- atanh(cmat) * sqrt(nrow(x) - 3)
zmat
})
In [16]:
ns <- daply(abide_anat_spat_df, .(Site), nrow)
mean_df <- mean(sqrt(ns-3))
abide_anat <- apply(all_zmats, c(2,3), function(x) tanh(mean(x)/mean_df))
abide_anat_p <- pcor0(abs(abide_anat), mean(ns), lower.tail=F)
In [22]:
cols <- rev(brewer.pal(10, "RdBu"))
corrplot(abide_anat, method="color", diag=F, outline=F, col=cols, cl.length=length(cols)+1)
In [ ]:
#' This calculates the collinearity between the different QC measures
#'
#' We first load the abide and corr dataset
#' then we compute the correlation between the measures within each site
#' we average across sites after doing an r->t->z (this is the difference with the other script)
#' and finally we plot that difference
#'
#+ setup
In [ ]:
# plots
label_strings=c(CNR='CNR',
Cortical.Contrast='Cortical Contrast',
EFC='EFC',
FBER='FBER',
FWHM='Smoothness (FWHM)',
Qi1='Fraction of Artifact Voxels',
SNR='SNR')
In [3]:
?install.packages
In [5]:
install.packages("boot")
In [ ]: