Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Statistical power and sample size determination for two sample (unequal variance) welch t-test?

Tags:

r

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?

like image 352
Daniel Ayk Avatar asked Nov 08 '25 09:11

Daniel Ayk


1 Answers

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
like image 144
ekstroem Avatar answered Nov 10 '25 21:11

ekstroem



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!