Skip to contents

Power analysis for interaction models, computed via change in R2. Valid for interactions with continuous, normally distributed, variables.

Usage

power_interaction_r2(
  N,
  r.x1.y,
  r.x2.y,
  r.x1x2.y,
  r.x1.x2,
  rel.x1 = 1,
  rel.x2 = 1,
  rel.y = 1,
  alpha = 0.05,
  detailed_results = FALSE
)

Arguments

N

Sample size. Must be a positive integer. Has no default value. Can be a single value or a vector of values.

r.x1.y

Pearson's correlation between x1 and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.

r.x2.y

Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions. Has no default value. Can be a single value or a vector of values.

r.x1x2.y

Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.

r.x1.x2

Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value. Can be a single value or a vector of values.

rel.x1

Reliability of x1 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.

rel.x2

Reliability of x2 (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.

rel.y

Reliability of xy (e.g. test-retest reliability, ICC, Cronbach's alpha). Default is 1 (perfect reliability). Must be greater than 0 and less than or equal to 1.

alpha

The alpha. At what p-value is the interaction deemed significant? Default is 0.05.

detailed_results

Default is FALSE. Should detailed results be reported?

Value

A data frame containing the power for each unique setting combination.

Examples

power_interaction_r2(N=seq(100,300,by=10),r.x1.y=0.2, r.x2.y=.2,r.x1x2.y=0.2,r.x1.x2=.2)
#>      N       pwr
#> 1  100 0.5234529
#> 2  110 0.5644556
#> 3  120 0.6029253
#> 4  130 0.6388492
#> 5  140 0.6722526
#> 6  150 0.7031912
#> 7  160 0.7317444
#> 8  170 0.7580089
#> 9  180 0.7820942
#> 10 190 0.8041182
#> 11 200 0.8242037
#> 12 210 0.8424759
#> 13 220 0.8590596
#> 14 230 0.8740776
#> 15 240 0.8876497
#> 16 250 0.8998908
#> 17 260 0.9109111
#> 18 270 0.9208148
#> 19 280 0.9297000
#> 20 290 0.9376587
#> 21 300 0.9447766