Type: Package
Title: Calculating Parameters for Simulation-Based Regression Interaction Power Analysis
Version: 0.1.0
Description: Provides functionality for analytically calculating parameters (via the 'InteractionPoweR' package) useful for simulation of moderated multiple regression, based on the correlations among the predictors and outcome and the reliability of predictors.
Imports: InteractionPoweR
License: GPL-2
Encoding: UTF-8
URL: https://github.com/statisfactions/simpr.interaction/
BugReports: https://github.com/statisfactions/simpr.interaction/issues/
RoxygenNote: 7.2.3
NeedsCompilation: no
Packaged: 2025-03-20 08:59:14 UTC; EthanBrown
Author: Ethan C. Brown ORCID iD [aut, cre]
Maintainer: Ethan C. Brown <ethancbrown@gmail.com>
Repository: CRAN
Date/Publication: 2025-03-22 11:30:02 UTC

Extract simulation parameters for power analysis of regression interaction models.

Description

Extract useful simulation parameters for regression.interaction models, computed via change in R2. This function is largely a wrapper for power_interaction_r2() from the InteractionPoweR package which calculates useful quantities based on correlations and reliabilities. This function then massages the output into a more convenient format for simpr as well as calculating R2 and sigma.

Usage

interaction_params(
  r.x1.y,
  r.x2.y,
  r.x1x2.y,
  r.x1.x2,
  rel.x1 = 1,
  rel.x2 = 1,
  rel.y = 1
)

Arguments

r.x1.y

Pearson's correlation between x1 and y. Must be between -1 and 1.

r.x2.y

Pearson's correlation between x2 and y. Must be between -1 and 1. Assumed to be the 'moderator' in some functions.

r.x1x2.y

Pearson's correlation between the interaction term x1x2 (x1 * x2) and y. Must be between -1 and 1.

r.x1.x2

Pearson's correlation between x1 and x2. Must be between -1 and 1. Has no default value.

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 y (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.

Value

A list with the following elements:

b1:

Slope for simulation of x1

b2:

Slope for simulation of x2

b3:

Slope for simulation of x1:x2

obs.r.x1.x2:

Adjusted correlation of x1 and x2

obs.r.x1.y:

Adjusted correlation of x1 and y

obs.r.x2.y:

Adjusted correlation of x1 and y

obs.r.x1x2.y:

Adjusted correlation of x1:x2 and y

r2:

R-squared

sigma:

Sigma

cov:

Adjusted correlation matrix of x1 and x2

Examples

params_all = interaction_params(r.x1.y = -0.18,
 r.x2.y = -0.03,
 r.x1.x2 = 0.64,
 r.x1x2.y = 0.1,
 rel.y = 0.79,
 rel.x1 = 0.89,
 rel.x2 = 0.95)