If I have a normally distributed population of 3.5 million elements, and I want to sample enough of them to make a statement with 99.6% confidence on a 1-tailed test, what should my sample size be? Is 100 enough, or would it need to be significantly larger?
-
$\begingroup$ Do you have an achieved amount of power that you want? $\endgroup$– user25658Commented Sep 12, 2013 at 17:04
-
3$\begingroup$ (1) One-tailed test of what parameter? The mean? Standard deviation? Variance? etc. (2) The answer for the mean is a sample size of one. With this you can construct a 99.6% confidence interval. It will be very wide, though :-). $\endgroup$– whuber ♦Commented Sep 12, 2013 at 17:18
1 Answer
You can use the following R script to generate your required sample:
library(pwr)
pwr.t.test(n = SAMPLE_SIZE , d = EXPECTED_EFFECT_SIZE, sig.level = 0.004 , power =
DESIRED_POWER, type = c("one.sample"), alternative = "greater"/"less")
You need to provide 3 of the 4 values (n,*d*,sig.level, and power), while making the 4th value = NULL
. For example, if you wanted to see if 100 subjects is enough, you could fill in information for n, d (if you have an expected effect size, for this example d will be equal to 0.4), your significance level of 0.004 (or 99.6% CI), while leaving power as Null
. Lastly, you will need to choose the direction for the one-tailed test by choosing "greater" or "less", which for this example, I chose to use "greater". The below R script will perform this calculation:
library(pwr)
pwr.t.test(n = 100 , d = 0.4, sig.level = 0.004 , power = NULL, type = c("one.sample"), alternative = greater)
Below is the generated output:
One-sample t test power calculation
n = 100
d = 0.4
sig.level = 0.004
power = 0.8991141
alternative = greater
As you can see in the above output, we have 89.9% power to test our null hypothesis with an expected difference in effect size of 0.4 with 99.6% confidence ($a$ = 0.004).
-
2$\begingroup$ Thanks -- really like this one because you're "teaching a man to fish", while at the same time not being a jerk because he doesn't know how! Very cool. $\endgroup$ Commented Sep 12, 2013 at 18:02
-
$\begingroup$ No problem! I try to keep things as simple as possible because everything involving stats can be overwhelming (to say the least!). Let me know if there is anything else that I can help you with in regards to this calculation! Best of luck! $\endgroup$ Commented Sep 12, 2013 at 19:42
-
1$\begingroup$ @MattR - The word
greater
requires quotes inpwr.t.test()
. $\endgroup$– bill_080Commented Sep 12, 2013 at 21:23