Lab 10.2 - Latent Profile Analysis

Structural Equation Modeling - Instructor: Karen Nylund-Gibson

Adam Garber

June 07, 2020

University of California, Santa Barbara

Figure. Gaussian mixture models. Data simulated from a 2-class model.


Lab preparation


Creating a version-controlled R-Project with Github

Download repository here: https://github.com/garberadamc/SEM-Lab10

On the Github repository webpage:

  1. fork your own branch of the lab repository
  2. copy the repository web URL address from the clone or download menu

Within R-Studio:

  1. click “NEW PROJECT”
  2. choose option Version Control
  3. choose option Git
  4. paste the repository web URL path copied from the clone or download menu on Github page
  5. choose location of the R-Project

Data source:

  1. The first example closely follows the vignette used to demonstrate the tidyLPA package (Rosenberg, 2019): \(\color{blue}{\text{See detailed documentation of this model here}}\)

This model utilizes the PISA data collected in the U.S. in 2015. To learn more about this data \(\color{blue}{\text{see here}}\).

To access the 2015 US PISA data in R use the following code: a. devtools::install_github("jrosen48/pisaUSA15") b. library(pisaUSA15) c. open_codebook()

  1. The second examples utilizes 4 test score measures from the public-use dataset, The Longitudinal Survey of American Youth (LSAY): \(\color{blue}{\text{See documentation here}}\)

Load packages

Load data


Latent Profile Analysis


Figure. Picture adapted from tutorial (Rosenberg, 2019).

  • model 1: Equal variances, and covariances fixed to 0 (Class-invariant / Diagonal)
  • model 2: Free variances and covariances fixed to 0 (Class-varying / Diagonal)
  • model 3: Equal variances and equal covariances (Class-invariant / Non-Diagonal)
  • model 4: Free variances, and equal covariances
  • model 5: Equal variances, and free covariances
  • model 6: Free variances and free covariances (Class Varying / Non-Diagonal)

Example 1: PISA dataset from the tidyLPA package


Enumerate using estimate_profiles():

  • Estimate models with classes \(K = 1:3\) using Mplus
  • Model has 4 continuous indicators
  • Default variance-covariance sprecifications is model 1
  • In the followind example model 1 and model 6 are compared
  • Add line scale() %>% to center indicator means

Plot 3-class model

Note: single imputation is used in this example as plot_profiles() requires complete cases


Plot densities for classes k = 1:4


Which variance-covariance specification is appropriate?

In this tutorial we consider the following three models: A. equal variances and covariances fixed to zero (default) B. free variances and covariances fixed to zero (Model 2) C. free variances and free covariance for Physics and Science test scores (Model 6)