The command for two sample t-test (equal variance pooled std dev.) is
power.t.test(n=, delta=, sd=, type="two.sample")
How do I compute statistical power given two sample of unequal variance and sample number?
You can use the power_t_test() function from the MESS package.
For example, to compute the required sample sizes when you have a 1:2 ratio of individuals, sd's 1 and 3 and an effect size of 1.2 is (for power 80%)
> MESS::power_t_test(n=NULL, sd=1, power=.8, ratio=2, sd.ratio=3, delta=1.2)
Two-sample t test power calculation with unequal sizes
n = 14.35824, 28.71648
delta = 1.2
sd = 3
sig.level = 0.05
power = 0.8
alternative = two.sided
NOTE: n is vector of number in each group
To compute the power you'd set power=NULL and specify the n instead just as for the regular power.t.test() function.
> MESS::power_t_test(n=20, sd=1, power=NULL, ratio=2, sd.ratio=3, delta=1.2)
Two-sample t test power calculation with unequal sizes
n = 20, 40
delta = 1.2
sd = 3
sig.level = 0.05
power = 0.9149541
alternative = two.sided
NOTE: n is vector of number in each group
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With