# NOT RUN {
# grab synthetic study for example
data("studies")
n.studies <- 5
study.sizes <- c(nrow(studies[[1]]), nrow(studies[[2]]), nrow(studies[[3]]),
nrow(studies[[4]]), nrow(studies[[5]]))
study.pvals <- rep(0, n.studies)
# Correlations of p-values among the studies.
# In this case the studies were generated independently so its just I
cor.matrix <- diag(1, n.studies)
# load the lrtest() function to conduct the likelihood ratio test
# Used just to generate the input p-values, not required in pasta itself.
library(lmtest)
for(i in 1:n.studies) {
# model with gene(G) by environment(E) interaction
model <- glm(D ~ G + E + GbyE, data = studies[[i]], family = binomial)
# model without G and GE interaction
null.model <- glm(D ~ E, data = studies[[i]], family = binomial)
# likelihood ratio test from the package lmtest
study.pvals[i] = lmtest::lrtest(null.model, model)[2, 5]
}
pasta <- pasta(study.pvals, study.sizes, cor.matrix)
pasta$p.pasta
pasta$test.statistic$selected.subset
# }
Run the code above in your browser using DataLab