2  MPlus Fundamentals

Mplus is software devoted to fitting a broad variety of structural equations models. The variety of these models is enormous.

The software is designed to make fairly easy fitting many specialized models within the SEM world: by understanding a few key commands and understanding the defaults for options left unspecified, many models can be fit with just a few lines of code.

2.1 Overview

In the discussion that follows, we will look at simple examples that illustrate the use of the MPlus programming language. Although the commands are specified completely here, much of the output is skipped. To get the most out of the following discussion, run each example yourself using MPlus, and be sure you understand which part of the output illustrates the points being made.

  • Sample Stats: Generating sample statistics. This introduces the default analysis type, the default means-and-variances model, and plots.
  • Model Specification: Path model specification, and regression.
  • Mediation: Using labeled paths, specifying additional effects.
  • Exploratory Factor Analysis: More analysis specification.
  • Latent Variables: Confirmatory factor analysis, model identification constraints.
  • Grouped Analysis: Comparing parameters across groups (interaction effects), freeing and fixing parameters, measurement models.
  • Multilevel Models: Some rough notes on the simplest models.

2.2 MPlus in the SSCC

Mplus is available on Winstat, and on Linstat through Slurm.

On Winstat you can use the MPlus editor, and view diagrams. Linstat/Slurm has a command line interface. For simple projects - where you have just a few models to consider, your data set has only a few thousand cases, and the estimation algorithm does not require hundreds of iterations or numerous random starts - we suggest you write your code on Winstat using the MPlus editor.

If your model requires a lot of computing power or time to estimate, then develop and debug your code on Winstat using a subset of your data, and then move to Linstat/Slurm for your final runs.

2.3 The Basic Workflow

MPlus takes your data from a text file, plus your analysis commands from an input (inp) text file, and produces output in the form of a text file (out) and sometimes a diagram (dgm).

The text file containing your data can come in a few different forms, but at a minimum your input file needs to tell MPlus the name of the file with your data, and the names of the variables it contains.

2.4 The MPlus Input File

Your input file will typically center around a command specifying the model you want to estimate. You will have one model per input file. It is common style to also include a title for each model/file.

The input file typically has several sections. Only the DATA and VARIABLE sections are required - everything else has a default!

TITLE:
DATA:
VARIABLE:
MODEL:
ANALYSIS:
OUTPUT:
  • TITLE: a description of the analysis in this file
  • DATA: specifies the file containing the data
  • VARIABLE: names the input variables, specifies the variables used for analysis, and their type
  • MODEL: describes the relations among the variables
  • ANALYSIS: specifies the estimation algorithm
  • OUTPUT: specifies the output statistics

Less commonly, there may also be sections for MONTECARLO data simulation, of to SAVEDATA.