This vignette details how you can automatically create Mplus model syntax for performing a power analysis for the RI-CLPM and STARTS modl 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.

In the `powRICLPM()`

function, set the
`software = ...`

argument to `"Mplus"`

. This
creates Mplus model syntax for multiple experimental conditions
simultaneously, and saves them the folder specified in the
`save_path = "..."`

argument. After the Mplus input-files
(.inp) have been created, you can edit them, run them one-by-one in
Mplus, or run them simultaneously from R using the
`runModels()`

function from the MplusAutomation R
package.

Let us use the same illustrating example as explained in the Vignette Get started.

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:

To create Mplus model syntax, use the `powRICLPM()`

function, and set `software = "Mplus"`

. 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_(
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"
software = "Mplus"
)
```

Optionally, you can extend this power analysis as described in the Vignette Extensions.

Note that it is not possible to generate skewed or kurtosed data in
Mplus via the `powRICLPM`

package. Furthermore, bounded
estimation is not available in Mplus. Therefore, the
`skewness`

, `kurtosis`

, and `bounds`

will be ignored when `software = "Mplus"`

.

The `powRICLPM()`

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.

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).

Muthén, Linda K., and Bengt O. Muthén. 2002. “How to use a Monte Carlo study to decide on sample size
and determine power.” *Structural Equation
Modeling* 9 (4): 599–620. https://doi.org/10.1207/S15328007SEM0904_8.