Skip to contents

Analytic power analysis of an interaction model with covariates. Additional covariate x main effect interaction terms are additionally added.

Usage

power_interaction_r2_covs(
  cov.input,
  N,
  alpha = 0.05,
  detailed_results = FALSE,
  cl = NULL
)

Arguments

cov.input

Output of 'power_interaction_r2_covs()'. Variable correlations and reliabilities are set by first modifying this list.

N

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

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?

cl

Number of clusters to use for running simulations in parallel. Default is NULL (i.e. not in parallel). Useful when running several thousand analyses at once.

Value

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

Examples

ex1 = generate.interaction.cov.input(c.num=2)
ex1$correlations$r.y.x1x2 = c(0.1,0.2,0.3)
power_interaction_r2_covs(cov.input = ex1,N=100)
#> Performing 3 analyses
#>         pwr r.y.x1 r.y.x2 r.y.c1 r.y.c2 r.y.x1x2 r.y.c1x1 r.y.c1x2 r.y.c2x1
#> 1 0.1566418      0      0      0      0      0.1        0        0        0
#> 2 0.4712674      0      0      0      0      0.2        0        0        0
#> 3 0.8082680      0      0      0      0      0.3        0        0        0
#>   r.y.c2x2 r.x1.x2 r.x1.c1 r.x1.c2 r.x1.c1x2 r.x1.c2x2 r.x2.c1 r.x2.c2
#> 1        0       0       0       0         0         0       0       0
#> 2        0       0       0       0         0         0       0       0
#> 3        0       0       0       0         0         0       0       0
#>   r.x2.c1x1 r.x2.c2x1 r.c1.c2 r.c1.x1x2 r.c1.c2x1 r.c1.c2x2 r.c2.x1x2 r.c2.c1x1
#> 1         0         0       0         0         0         0         0         0
#> 2         0         0       0         0         0         0         0         0
#> 3         0         0       0         0         0         0         0         0
#>   r.c2.c1x2 rel.y rel.x1 rel.x2 rel.c1 rel.c2 alpha   N
#> 1         0     1      1      1      1      1  0.05 100
#> 2         0     1      1      1      1      1  0.05 100
#> 3         0     1      1      1      1      1  0.05 100