|
Size: 548
Comment:
|
Size: 554
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)
