[英]Power analysis for multiple regression using pwr and R
I want to determine the sample size necessary to detect an effect of an interaction term of two continuous variables (scaled) in a multiple regression with other covariates.我想确定在与其他协变量的多元回归中检测两个连续变量(缩放)的交互项的影响所需的样本量。
We have found an effect where previous smaller studies have failed.我们发现了之前小型研究失败的效果。 These effects are small, but a reviewer is asking us say that previous studies were probably underpowered, and to provide some measure to support that.
这些影响很小,但审稿人要求我们说以前的研究可能不足,并提供一些措施来支持这一点。
I am using the pwr.f2.test()
function in the pwr
package, as follows:我使用的是
pwr
包中的pwr.f2.test()
函数,如下:
pwr.f2.test(u = nominator, v = denominator, f2 = effect size, sig.level = 0.05, power = 0.8)
, and the denominator I set to NULL so I can get sample size. pwr.f2.test(u = nominator, v = denominator, f2 = effect size, sig.level = 0.05, power = 0.8)
,以及我将分母设置为 NULL 以便我可以获得样本大小。
Here is my model output from summary()
:这是我从
summary()
模型输出:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -21.2333 20.8127 -1.02 0.30800
age 0.0740 0.0776 0.95 0.34094
wkdemand 1.6333 0.5903 2.77 0.00582 **
hoops 0.8662 0.6014 1.44 0.15028
wtlift 5.2417 1.3912 3.77 0.00018 ***
height05 0.2205 0.0467 4.72 2.9e-06 ***
amtRS 0.1041 0.2776 0.37 0.70779
allele1_numS -0.0731 0.2779 -0.26 0.79262
amtRS:allele1_numS 0.6267 0.2612 2.40 0.01670 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 7.17 on 666 degrees of freedom
Multiple R-squared: 0.0769, Adjusted R-squared: 0.0658
F-statistic: 6.94 on 8 and 666 DF, p-value: 8.44e-09
And the model effects sizes estimates from modelEffectSizes()
function in lmSupport
package:模型效果大小估计来自
lmSupport
包中的modelEffectSizes()
函数:
Coefficients
SSR df pEta-sqr dR-sqr
(Intercept) 53.5593 1 0.0016 NA
age 46.7344 1 0.0014 0.0013
wkdemand 393.9119 1 0.0114 0.0106
hoops 106.7318 1 0.0031 0.0029
wtlift 730.5385 1 0.0209 0.0197
height05 1145.0394 1 0.0323 0.0308
amtRS 7.2358 1 0.0002 0.0002
allele1_numS 3.5599 1 0.0001 0.0001
amtRS:allele1_numS 296.2219 1 0.0086 0.0080
Sum of squared errors (SSE): 34271.3
Sum of squared total (SST): 37127.3
The question:问题:
What value do I put in the f2 slot of pwr.f2.test()
?我在
pwr.f2.test()
的 f2 插槽中放了什么值? I take it the numerator is going to be 1, and I should use the pEta-sqr from modelEffectSizes()
, so in this case 0.0086?我认为分子将是 1,我应该使用
modelEffectSizes()
的 pEta-sqr,所以在这种情况下是 0.0086?
Also, the estimated sample sizes I get are often much larger than our sample size 675 - does this mean we were 'lucky' to have picked up a significant effects (we'll only detect them 50% of the time, given the effect size)?此外,我得到的估计样本量通常比我们的样本量 675 大得多——这是否意味着我们“很幸运”获得了显着影响(考虑到影响大小,我们只会在 50% 的时间内检测到它们) )? Note that I we have multiple measures of different things all pointing to the same finding, so I'm relatively satisfied there.
请注意,我对不同事物的多种测量都指向同一个发现,所以我对那里比较满意。
What value do I put in the f2 slot of pwr.f2.test()?我在 pwr.f2.test() 的 f2 槽中放了什么值?
For each of pwr
functions, you enter three of the four quantities ( effect size , sample size , significance level , power ) and the fourth will be calculated (1).对于每个
pwr
功能,你进入三四个量(影响大小,样本大小,显着性水平,功率)和第四的将被计算(1)。 In pwr.f2.test
u
and v
are the numerator and denominator degrees of freedom.在
pwr.f2.test
u
和v
是分子和分母的自由度。 And f2
is used as the effect size measure.并且
f2
用作效果大小的度量。 Eg you will put there an effect size estimate.例如,您将在那里放置一个效果大小估计。
Is pEta-sqr the correct 'effect size' to use? pEta-sqr 是要使用的正确“效果大小”吗?
Now, there are many different effect size measures.现在,有许多不同的效应量度量。
Pwr
uses specifically Cohen´s F 2 and it is different from pEta-sqr, so I wouldn´t recommend it. Pwr
专门使用 Cohen 的F 2 ,它与 pEta-sqr 不同,所以我不推荐它。
Which effect size measure I could use then?那么我可以使用哪种效应量度量?
As @42- mentioned, you could try to use delta-R 2 effect, which in your output variables is labeled “dR-sqr”.正如@42- 提到的,您可以尝试使用 delta-R 2效果,它在您的输出变量中被标记为“dR-sqr”。 You could do this with variation of Cohen's f 2 measuring local effect size which was described by Selya et al.
您可以使用由 Selya等人描述的 Cohen's f 2测量局部效应大小的变化来做到这一点。 (2012).
(2012)。 It uses the following equation:
它使用以下等式:
In the equation, B is the variable of interest, A is the set of all other variables , R 2 AB is the proportion of variance accounted for by A and B together (relative to a model with no regressors), and R² A is the proportion of variance accounted for by A (relative to a model with no regressors).在等式中, B是感兴趣的变量, A是所有其他变量的集合,R 2 AB是A和B共同占方差的比例(相对于没有回归量的模型),R² A是A占方差的比例(相对于没有回归量的模型)。 I would do as @42- suggested – eg build two models, one with the interaction and one without and use their delta-R 2 effect size.
我会按照@42- 的建议去做——例如建立两个模型,一个有交互,一个没有,并使用它们的 delta-R 2效应大小。
Importantly, as @42- correctly pointed out, if the reviewers ask you if prior studies were underpowered, you need to use the sample sizes of those studies to make any power calculation.重要的是,正如@42- 正确指出的那样,如果审稿人问您之前的研究是否功效不足,您需要使用这些研究的样本量来进行功效计算。 If you are using parameters of your own study, first of all you already know the answer – that you did have sufficient power to detect a difference, and second, you are doing it post hoc which also doesn´t sound correct.
如果您使用自己研究的参数,首先您已经知道答案——您确实有足够的能力来检测差异,其次,您是事后进行的,这听起来也不正确。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.