Sample size and power calculation in r as viable alternative to proc power in SAS?

≡放荡痞女 提交于 2019-12-05 07:48:05

In pwr.t.test and its derivatives, d is not the null difference (that's assumed to be zero), but the effect size/hypothesized difference between the two populations. If the difference between population means is zero, no sample size will let you detect a nonexistent difference.

If population A has a proportion of 15% and population B has a proportion of 30%, then you use the function pwr::ES.h to calculate the effect size and do a test of proportions like:

> pwr.2p.test(h=ES.h(0.30,0.15),power=0.80,sig.level=0.05)

     Difference of proportion power calculation for binomial distribution (arcsine transformation) 

              h = 0.3638807
              n = 118.5547
      sig.level = 0.05
          power = 0.8
    alternative = two.sided

NOTE: same sample sizes

> pwr.chisq.test(w=ES.w1(0.3,0.15),df=1,sig.level=0.05,power=0.80)

     Chi squared power calculation 

              w = 0.2738613
              N = 104.6515
             df = 1
      sig.level = 0.05
          power = 0.8

NOTE: N is the number of observations
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!