# Using Mplus

This vignette details how you can automatically create Mplus model syntax for performing a power analysis for a bivariate random intercept cross-lagged panel model (RI-CLPM) using the Mplus software package. This might be preferred by some researchers as Monte Carlo simulations are much faster in Mplus than in R, or for reasons of convention. A disadvantage of using Mplus is that power analysis cannot be performed across multiple experimental conditions simultaneously, it requires additional effort to understand all of the output one gets, and that it is a paid option.

Using powRICLPM_Mplus(), you can create Mplus model syntax for multiple experimental conditions simultaneously (although you would then still need run each script separately in Mplus itself). The function works similarly to powRICLPM() in that it implements the procedure for computing population parameter values as proposed by Mulder (2022). As such, let’s use the same illustrating example as explained in the Vignette Get started.

## Steps 1 and 2: Experimental conditions and population parameter values

For our example, we will investigate the power to detect a small standardized cross-lagged effect of $$0.2$$ for sample sizes from 100 to 1000 (with incremental steps of 50) for an RI-CLPM with 3, 4 and 5 repeated measures. In total, this results in $$19 \times 3 = 57$$ experimental conditions. Moreover, following the example in the Get started Vignette, our population parameter values are:

Phi <- matrix(c(.4, .1, .2, .3), ncol = 2, byrow = T)
# The .2 refers to our standardized cross-lagged effect of interest
ICC <- 0.5
RI_cor <- 0.3

## Steps 3-5: Perform the power analysis

To create Mplus model syntax, use the powRICLPM_Mplus() function. You must provide:

• the range of sample sizes to simulate the power for using the search_lower, search_upper, and search_step arguments,
• the number of repeated measures using the time_points argument,
• the population values Phi, wSigma, ICC, and RI_cor,
• the number of MCMC replications you want to perform per condition in the reps argument,
• a seed to control the starting point of the random number generator, and
• a save_path, denoting the directory to which to save the Mplus input file to.

For our example, we would specify:

powRICLPM_Mplus(search_lower = 100,
search_upper = 1000,
search_step = 50,
time_points = c(3, 4, 5),
ICC = 0.5,
RI_cor = 0.3,
Phi = Phi,
within_cor = 0.3,
reps = 10000,
seed = 123456,
save_path = "./saved")

Optionally, you can specify the constraints argument to extend the basic power analysis setup. This option is further described in the Vignette Extensions.

The powRICLPM_Mplus() creates an Mplus input file (or multiple files when multiple experimental conditions are specified) and writes it to the specified directory. The file contains the Mplus model syntax needed to run a power analysis for the RI-CLPM in Mplus. More information about Monte Carlo simulations in Mplus can be found at http://statmodel.com/download/usersguide/Chapter12.pdf.

## Step 6: Summarize results

To get output, run each Mplus model syntax file in Mplus. Each time, an output file is created summarizing the results of the Mplus power analysis. A good source for interpreting this output in the context of a MONTECARLO study is Muthén and Muthén (2002).