FAQ/Rpowprop - CBU statistics Wiki
location: FAQ / Rpowprop

Power for a two-tailed one sample binomial test

For testing the (two-tailed) hypothesis that a sample of size, ntot, with proportion, prop, equals a constant, const, with a type I error of alpha copy and paste the below into R and adjust inputs as required:

prop <- 0.45
const <- 0.50
ntot <- 900
alpha <- 0.05

Then copy and paste the below into R. Pow is the power of the test.

chisq <- ( (prop-const)^2 ) / (const*(1-const))
chisq <- ntot*chisq
pow <-  1 - pchisq(abs(qchisq(1-alpha,1)),1,chisq)
print(pow)

None: FAQ/Rpowprop (last edited 2013-03-08 10:17:15 by localhost)