MPLus notes / Workshop index

Interactions Among Latent Variables using MPlus

Files used for "Estimating and Interpreting Latent Variable Interactions: A tutorial for applying the latent moderated structural equations method," Julie Maslowsky, Justin Jager, and Douglas Hemken, International Journal of Behavioral Development January 2015 vol. 39 no. 1 87-96

UPDATE: as of MPlus version 7.4, a number of the statistics computed using R (below) are now available in MPlus itself (and handled in a much more elegant and efficient way, from the look of the documentation).

A collection of code used to produce a model with a latent variable interaction, simulate data from the estimated model using different distributional assumptions, and assess the power of the likelihood ratio fit statistic.

Note that in order to use these files, you will have to adjust file names and locations, as well as the number of observations per data set and the number of data sets. Even with these adjustments, this will NOT reproduce our results exactly, because no random seed is set.

The Main Model

Model Specification, the MPlus input file

Model Estimation, the MPlus output file

Simulating the Model

Generating Simulated Data

We simulated data from 4 distributions: (1) multivariate normal, with no interaction, (2) multivariate normal with an interaction between the latent variables, (3) multivariate chi-square with no interaction, and (4) multivariate chi-square with a latent interaction. The correlation between the latent variables is taken to be the same in all four simulations, and the mean and variance of each observed variable is the same across simulations.

Although it is easy to simulate MVN and MVNI data using MPlus, we simulated all our data using R. Our R code deliberately avoids some of the more graceful and powerful methods available in that language, in the hope that this makes it easier to understand for non-R users.

To analyze a collection of simulated data, MPlus requires a separate text file with each simulated data set, as well as a text file with a list of file names for the data sets. Given these inputs, MPlus will produce a summary of the estimation results for each parameter across the collection of data sets.


MVNI (with comments)

MVChi (with comments)


Estimation with Simulated Data

In order to calculate the change in the log-likelihood due to the latent interaction term, each data set is used to estimate a model without the interaction and a model with the interaction.

Using MPlus, we estimate first the model without an interaction for all of the data sets in a given collection, and the fit statistics are saved in a single file. Then the process is repeated with the same data sets for the model with the interaction. This will set us up to analyze the change in log-likelihood in the next step.

No Interaction With Interaction
MPlus input MPlus output MPlus input MPlus output
MVN0.inp MVN0.out MVN1.inp MVN1.out
MVNI0.inp MVNI0.out MVNI1.inp MVNI1.out
MVChi0.inp MVChi0.out MVChi1.inp MVChi1.out
MVChiI0.inp MVChiI0.out MVChiI1.inp MVChiI1.out

A similar set of analyses were carried out to produce fully standardized parameter estimates.

Analysis of the Estimation Results

We switch back to R again to calculate the likelihood ratio comparing models with and without latent interactions for every single simulated data set.

Import parameter estimates, including log-likelihood: functions, import

Calculate change in log-likelihood: functions and calculation, summary of likelihood ratio analyses.