Skip to contents

powRICLPM_Mplus() creates and saves (a) syntax file(s) for performing a Monte Carlo power analysis for the random intercept cross-lagged panel model (RI-CLPM) in Mplus. Mplus model syntax can be created across multiple experimental conditions simultaneously. Conditions are defined in terms of sample size, number of time points, and proportion of between-unit variance (ICC). See "Details" for information on a) the naming conventions of parameters, and b) the various constraints that can be imposed on the model.

Usage

powRICLPM_Mplus(
  search_lower = NULL,
  search_upper = NULL,
  search_step = 20,
  sample_size = NULL,
  time_points,
  ICC,
  RI_cor,
  Phi,
  within_cor,
  reps = 1000,
  seed = NA,
  save_path = getwd(),
  constraints = "none"
)

Arguments

search_lower

A positive integer, denoting the lower bound of a range of sample sizes.

search_upper

A positive integer, denoting the upper bound of a range of sample sizes.

search_step

A positive integer, denoting an increment in sample size.

sample_size

(optional) An integer (vector), indicating specific sample sizes at which to evaluate power, rather than specifying a range using the search_* arguments.

time_points

An integer (vector) with elements at least larger than 3, indicating number of time points.

ICC

A double (vector) with elements between 0 and 1, denoting the proportion of (true score) variance at the between-unit level. When measurement error is included in the data generating model, ICC is computed as the variance of the random intercept factor divided by the true score variance (i.e., controlled for measurement error).

RI_cor

A double between 0 and 1, denoting the correlation between random intercepts.

Phi

A matrix, with standardized autoregressive effects (on the diagonal) and cross-lagged effects (off-diagonal) in the population. Columns represent predictors and rows represent outcomes.

within_cor

A double between 0 and 1, denoting the correlation between the within-unit components.

reps

A positive integer, denoting the number of Monte Carlo replications to be used during simulations.

seed

An integer of length 1. If multiple cores are used, a seed of length 1 will be used to generate a full L'Ecuyer-CMRG seed for all cores (see furrr_options).

save_path

A character string, denoting the path to the folder to save the Mplus syntax files in (default: current working directory).

constraints

(optional) A character string, specifying the type of constraints that should be imposed on the estimation model (see "Details").

Value

No return value, called for side effects.

Details

Syntax generation

Mplus model syntax is created in multiple steps: First, the MODEL POPULATION command syntax is created in which parameters are constrained to population values. Second, the MODEL command syntax is created for model estimation. Optionally, syntax for constraints on the estimation model, in the MODEL CONSTRAINTS command, is created next. Ultimately, the parameter tables are combined to form character vectors containing the Mplus syntax to be exported (see "Details" of powRICLPM for more information on the constraints options).

Naming conventions

Details on the naming conventions can be found in the "Details" section of powRICLPM.

Examples

# Define population parameters for lagged effects
Phi <- matrix(c(.4, .1, .2, .3), ncol = 2, byrow = TRUE)

# Create and save Mplus model syntax
powRICLPM_Mplus(
  sample_size = c(400, 500),
  time_points = 3,
  ICC = 0.5,
  RI_cor = 0.3,
  Phi = Phi,
  within_cor = 0.3,
  reps = 10000,
  seed = 1234,
  save_path = tempdir()
)
#>  Mplus model syntax created:
#> 
#>   Directory: C:\Users\5879167\AppData\Local\Temp\RtmpwlXe3Y
#>   Sample size(s): 400 500
#>   Number of time points: 3
#>   Proportion(s) random intercept variance: 0.5

# \dontshow{
unlink(file.path(tempdir(), c("Mplus_N400_T3_ICC0.5.txt", "Mplus_N500_T3_ICC0.5.txt")))
# }