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:
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
To create Mplus model syntax, use the powRICLPM()
function, and set software = "Mplus"
. You must provide:
search_lower
, search_upper
, and search_step
arguments,time_points
argument, Phi
, wSigma
, ICC
, and RI_cor
,reps
argument,seed
to control the starting point of the random number generator, andsave_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.
::: {.callout-warning}
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 @muthen_monte-carlo_2002.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.