nievergeltlab of Simulations
7/11/2017 - 6:30 PM

Type 1 error rate of evaluating GxE via the difference of coefficients of stratified regression models.

Type 1 error rate of evaluating GxE via the difference of coefficients of stratified regression models.

nsim=10000
pval <- rep(NA,nsim)

for (sim in 1:nsim)
{
d1 <- rbinom(10000,2,.3)

result <- 1.2*d1 + rnorm(10000,sd=20)

da <- d1[1:8000]
db <- d1[8001:10000]

resa <- result[1:8000]
resb <- result[8001:10000]

GxE1 <- summary(lm(resa ~ da))
GxE1b <- GxE1$coefficients[2,1]
GxE1s <- GxE1$coefficients[2,2]^2



GxE2 <- summary(lm(resb ~ db))

GxE2b <- GxE2$coefficients[2,1]
GxE2s <- GxE2$coefficients[2,2]^2

zv <- GxE1b - GxE2b / sqrt(GxE1s + GxE2s)
pval[sim] <- 2*pnorm(abs(zv),lower.tail=F)
}