chrisaberson / pwr2ppl

pwr2ppl: Power analyses for a wide range common behavioral science research designs
https://github.com/chrisaberson/pwr2ppl
17 stars 7 forks source link

Three-way interaction? #12

Open rempsyc opened 2 years ago

rempsyc commented 2 years ago

I have a copy of Applied Power Analysis for the Behavioral Sciences 2nd edition (2019) on hand.

Reading the relevant sections, I am unclear as to whether it is possible to do a power analysis for a three-way interaction for multiple regression (not ANOVA) with pwr2ppl. I would just like to verify that I didn't get this all wrong? I have two binary variables (experimental manipulations) and one continuous variable.

I have looked at the following functions:

MRC (p. 139, section Moderated Regression Analysis (Regression with Interactions) & p. 144, Table 9.6) (and it's brother, MRC_all)

MRC(ry1=.17, ry2=-.00, ry3=.26, r12=.00, r13=.05, r23=.05, n=122)
Sample size is 122
Power R2 = 0.828
Power b1 = 0.428
Power b2 = 0.052
Power b3 = 0.814

However investigating the output, I do not believe this is for the interaction, but for the individual coefficients?

Next we have regintR2 (p. 145, Table 9.7)

regintR2(R2Mod=.092, R2Ch=.032, mod_pred=3, ch_pred=1, nlow=100, nhigh=400, by=20)
     n R2 Change)  Power
1  100      0.032 0.4448
2  120      0.032 0.5181
3  140      0.032 0.5847
4  160      0.032 0.6444
5  180      0.032 0.6974
6  200      0.032 0.7439
7  220      0.032 0.7843
8  240      0.032 0.8192
9  260      0.032 0.8491
10 280      0.032 0.8745
11 300      0.032 0.8960
12 320      0.032 0.9142
13 340      0.032 0.9294
14 360      0.032 0.9421
15 380      0.032 0.9526
16 400      0.032 0.9614

In this case, are the values for power for the R2 change of the three-way interaction?

If three-way interactions are not supported at this time, are you expecting to add support in the future, and can you think of any other package to accomplish this goal at this time (e.g., how would you do it personally)? Thanks.

chrisaberson commented 2 years ago

You would need to use R2 change for the three way interaction

rempsyc commented 2 years ago

(Sorry for the delay) Thank you. So if I get this right, assuming I am looking to determine the sample size required for detecting a three-way interaction with 80% power, an sr2/R2ch of 0.02 (for the three-way interaction term), a model R2 of 0.1514, and 7 predictors (with a single interaction of interest, the three-way interaction), I would use the function regintR2, and like so:

regintR2(R2Mod=0.1514, R2Ch=.02, mod_pred=7, ch_pred=1, nlow=340, nhigh=345, by=1)
     n R2 Change)  Power
1  340       0.02 0.7965
2  341       0.02 0.7977
3  342       0.02 0.7989
4  343       0.02 0.8001
5  344       0.02 0.8012
6  345       0.02 0.8024

And required n would be = 343. Correct? Does that apply regardless of whether my variables are continuous or categorical (I have two binary variables—experimentally manipulated—and one continuous variable)?

chrisaberson commented 2 years ago

This should be an adequate sample size - manipulated variables tend to produce bigger effects so you will likely end up with a well powered design

On Thu, Jun 9, 2022 at 6:04 PM Rémi Thériault @.***> wrote:

(Sorry for the delay) Thank you. So if I get this right, assuming I am looking to determine the sample size required for detecting a three-way interaction with 80% power, an sr2/R2ch of 0.02 (for the three-way interaction term), a model R2 of 0.1514, and 7 predictors (with a single interaction of interest, the three-way interaction), I would use the function regintR2, and like so:

regintR2(R2Mod=0.1514, R2Ch=.02, mod_pred=7, ch_pred=1, nlow=340, nhigh=345, by=1)

 n R2 Change)  Power

1 340 0.02 0.7965 2 341 0.02 0.7977 3 342 0.02 0.7989 4 343 0.02 0.8001 5 344 0.02 0.8012 6 345 0.02 0.8024

And required n would be = 343. Correct? Does that apply regardless of whether my variables are continuous or categorical (I have two binary variables—experimentally manipulated—and one continuous variable)?

— Reply to this email directly, view it on GitHub https://github.com/chrisaberson/pwr2ppl/issues/12#issuecomment-1151770021, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEJYUXYMGNFJMRG63NT4NNDVOKIANANCNFSM5VPKRCRQ . You are receiving this because you commented.Message ID: @.***>