Diff for "FAQ/Rpowprop" - CBU statistics Wiki
location: Diff for "FAQ/Rpowprop"
Differences between revisions 3 and 4
Revision 3 as of 2008-02-19 16:41:05
Size: 548
Editor: PeterWatson
Comment:
Revision 4 as of 2008-02-19 16:43:47
Size: 554
Editor: PeterWatson
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= Power for a one sample binomial test in R =  = Power for a two-tailed one sample binomial test =

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)