Power analysis for interaction models, by simulation. A set of n.iter simulations is run for each unique combination of model settings.
Usage
power_interaction(
n.iter,
N,
r.x1.y,
r.x2.y,
r.x1x2.y,
r.x1.x2,
rel.x1 = 1,
rel.x2 = 1,
rel.y = 1,
k.x1 = 0,
k.x2 = 0,
k.y = 0,
adjust.correlations = TRUE,
alpha = 0.05,
q = 2,
cl = NULL,
ss.IQR = 1.5,
N.adjustment = 1e+06,
detailed_results = FALSE,
full_simulation = FALSE,
tol = 0.005,
iter = 10,
skew.x1 = NA,
skew.x2 = NA,
skew.y = NA
)
Arguments
- n.iter
Number of iterations. The number of simulations to run for each unique setting combination. Must be a positive integer.
- 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.
- k.x1
Number of discrete values for x1. Can be used to make a variable binary or ordinal.
- k.x2
Number of discrete values for x2. Can be used to make a variable binary or ordinal.
- k.y
Number of discrete values for y. Can be used to make a variable binary or ordinal.
- adjust.correlations
If variables are ordinal or binary, should correlations be adjusted so that output data has the specified correlation structure? Default is TRUE.
- alpha
The alpha. At what p-value is the interaction deemed significant? Default is 0.05.
- q
Simple slopes. How many quantiles should x2 be split into for simple slope testing? Default is 2. Simple slope testing returns the effect-size (slope) of y~x1 for the two most extreme quantiles of x2. If q=3 then the two slopes are y~x1 for the bottom 33% of x2, and the top 33% of x2.
- cl
Number of clusters to use for running simulations in parallel (recommended). Default is 1 (i.e. not in parallel).
- ss.IQR
Simple slope IQR. Multiplier when estimating the distribution of simple slopes within each simulation setting. Default is 1.5.
- N.adjustment
Sample size for simulations where correlation matrix is corrected to allow for binary/ordinal variables. Default is 1000000
- detailed_results
Default is FALSE. Should detailed results be reported?
- full_simulation
Default is FALSE. If TRUE, will return a list that includes the full per-simulation results.
- tol
Correlation adjustment tolerance. When adjust.correlations = TRUE, correlations are adjusted so that the population correlation is within r='tol' of the target. Default = 0.005.
- iter
Max number of iterations to run the correlation adjustment for. Typically only a couple are needed. Default = 10.
- skew.x1
No longer supported.
- skew.x2
No longer supported.
- skew.y
No longer supported.