## Not run:
# ### load example data for 2 studies
# data(seqMetaExample)
#
# ####run on each study:
# cohort1 <- prepScores(Z=Z1, y~sex+bmi, SNPInfo = SNPInfo, data =pheno1)
# cohort2 <- prepScores(Z=Z2, y~sex+bmi, SNPInfo = SNPInfo, kins=kins, data=pheno2)
#
# #### combine results:
# ##skat-O with default settings:
# out1 <- skatOMeta(cohort1, cohort2, SNPInfo = SNPInfo, method = "int")
# head(out1)
#
# ##skat-O, using a large number of combinations between SKAT and T1 tests:
# out2 <- skatOMeta(cohort1, cohort2, rho=seq(0,1,length=11), SNPInfo=SNPInfo, method="int")
# head(out2)
#
# #rho = 0 indicates SKAT gave the smaller p-value (or the T1 is undefined)
# #rho=1 indicates the burden test was chosen
# # 0 < rho < 1 indicates some other value was chosen
# #notice that most of the time either the SKAT or T1 is chosen
# table(out2$rho)
#
# ##skat-O with beta-weights used in the burden test:
# out3 <- skatOMeta(cohort1,cohort2, burden.wts = function(maf){dbeta(maf,1,25) },
# rho=seq(0,1,length=11),SNPInfo = SNPInfo, method="int")
# head(out3)
# table(out3$rho)
#
# ########################
# ####binary data
# cohort1 <- prepScores(Z=Z1, ybin~1, family=binomial(), SNPInfo=SNPInfo, data=pheno1)
# out.bin <- skatOMeta(cohort1, SNPInfo = SNPInfo, method="int")
# head(out.bin)
#
# ####################
# ####survival data
# cohort1 <- prepCox(Z=Z1, Surv(time,status)~strata(sex)+bmi, SNPInfo=SNPInfo,
# data=pheno1)
# out.surv <- skatOMeta(cohort1, SNPInfo = SNPInfo, method="int")
# head(out.surv)
#
# ##########################################
# ###Compare with SKAT and T1 tests on their own:
# cohort1 <- prepScores(Z=Z1, y~sex+bmi, SNPInfo=SNPInfo, data=pheno1)
# cohort2 <- prepScores(Z=Z2, y~sex+bmi, SNPInfo=SNPInfo, kins=kins, data=pheno2)
#
# out.skat <- skatMeta(cohort1,cohort2,SNPInfo=SNPInfo)
# out.t1 <- burdenMeta(cohort1,cohort2, wts= function(maf){as.numeric(maf <= 0.01)},
# SNPInfo=SNPInfo)
#
# #plot results
# #We compare the minimum p-value of SKAT and T1, adjusting for multiple tests
# #using the Sidak correction, to that of SKAT-O.
#
# par(mfrow=c(1,3))
# pseq <- seq(0,1,length=100)
# plot(y=out.skat$p, x=out1$p,xlab="SKAT-O p-value", ylab="SKAT p-value", main ="SKAT-O vs SKAT")
# lines(y=pseq,x=1-(1-pseq)^2,col=2,lty=2, lwd=2)
# abline(0,1)
#
# plot(y=out.t1$p, x=out1$p,xlab="SKAT-O p-value", ylab="T1 p-value", main ="SKAT-O vs T1")
# lines(y=pseq,x=1-(1-pseq)^2,col=2,lty=2, lwd=2)
# abline(0,1)
#
# plot(y=pmin(out.t1$p, out.skat$p,na.rm=T), x=out1$p,xlab="SKAT-O p-value",
# ylab="min(T1,SKAT) p-value", main ="min(T1,SKAT) vs SKAT-O")
# lines(y=pseq,x=1-(1-pseq)^2,col=2,lty=2, lwd=2)
# abline(0,1)
# legend("bottomright", lwd=2,lty=2,col=2,legend="Bonferroni correction")
# ## End(Not run)
Run the code above in your browser using DataLab