Skip to content

Instantly share code, notes, and snippets.

@rkbarney
Created September 12, 2019 21:45
Show Gist options
  • Save rkbarney/dcb2411aaad735a2e2f8095f968c8caa to your computer and use it in GitHub Desktop.
Save rkbarney/dcb2411aaad735a2e2f8095f968c8caa to your computer and use it in GitHub Desktop.
Does the power test tell me I need way high N than if I use prop.test?
> prop.test(x = c(300,250), n = c(50000,50000), conf.level = 0.05)
2-sample test for equality of proportions with continuity
correction
data: c(300, 250) out of c(50000, 50000)
X-squared = 4.3896, df = 1, p-value = 0.03616
alternative hypothesis: two.sided
5 percent confidence interval:
0.0009506696 0.0010493304
sample estimates:
prop 1 prop 2
0.006 0.005
> pwr.p.test(h = 0.001, power = .8, sig.level = .01)
proportion power calculation for binomial distribution (arcsine transformation)
h = 0.001
n = 11678968
sig.level = 0.01
power = 0.8
alternative = two.sided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment