Not sure if I'm misunderstanding the pwr::pwr.t.test()
function and result.
set.seed(1299448)
g1 <- rnorm(35, 12, 3)
g2 <- rnorm(35, 14, 3)
t.test(g1, g2)
pwr.t.test(d = ((mean(as.numeric(g1), na.rm = T) -
mean(as.numeric(g2), na.rm = T)) /
sqrt(((sd(g1)^2)+ (sd(g2)^2))/2)),
power = .80,
sig.level = .05,
alternative = "two.sided")
Results
Welch Two Sample t-test
data: g1 and g2
t = -2.1738, df = 63.822, p-value = 0.03343
Two-sample t test power calculation
n = 59.10848
d = 0.519647
sig.level = 0.05
power = 0.8
alternative = two.sided
NOTE: n is number in *each* group
So the effect is significant with a sample size of 70, but with such an effect size, a sample size of 120 would be required for 80% power.
Can someone ELI5? Sorry if this is more of a cross-validated question. I started originally thinking this was a programming/misunderstanding of the pwr package, but now I'm starting to think I just don't understand the sample size estimation/power well enough.