Power
Chen Hao posted on 13 Mar 2016This is my course notes for Mathematical Biostatistics Boot Camp 2, course materials are free on github.
1. Power
Example
2. Power for the T test
Example
Comments
R codes Using Monte Carlo
nosim <- 100000
n <- 16
sigma <- 4
mu0 <- 30
mua <- 32
z <- rnorm(nosim)
xsq <- rchisq(nosim, df = 15)
t <- qt(.95, 15)
mean(z + sqrt(n) * (mua - mu0) / sigma >
t / sqrt(n - 1) * sqrt(xsq))
##result is 60%