Lab 8 - Introduction to Mixture Models

Structural Equation Modeling - Instructor: Karen Nylund-Gibson

Adam Garber

May 22, 2020

University of California, Santa Barbara

Figure. Picture has been adapted from study by Múthen, 2006.


Lab preparation


Creating a version-controlled R-Project with Github

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

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 utilizes a dataset on undergraduate Cheating available from the poLCA package (Dayton, 1998): \(\color{blue}{\text{See documentation here}}\)

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

  3. The third examples utilizes the Kindergarten Student Entrance Profile (KSEP) (Quirk et al., 2011): \(\color{blue}{\text{See documentation here}}\)


Load packages


Enumerate and plot mixtures

Compare k-class models 1 through 6


Example 1: Undergraduate Cheating behavior

“Dichotomous self-report responses by 319 undergraduates to four questions about cheating behavior” (poLCA, 2016).


LCA indicators1
Name Label Values
LieExam lied to avoid taking an exam 0 = No, 1 = Yes
LiePaper lied to avoid handing a term paper in on time 0 = No, 1 = Yes
Fraud purchased a term paper to hand in as their own or had obtained a copy of an exam prior to taking the exam 0 = No, 1 = Yes
CopyExam copied answers during an exam from someone sitting near to them 0 = No, 1 = Yes

1 Undergraduate Cheating Behavior

Prepare data

Run a quick LCA using createMixtures

View model fit statistics with mixtureSummaryTable()

Fit Indices1
Title Classes AIC BIC aBIC Entropy T11_VLMR_PValue T11_LMR_PValue BLRT_PValue min_N max_N min_prob max_prob
1 classes 1 942.876 957.937 945.250 NA NA NA NA 319 319 1.000 1.000
2 classes 2 898.054 931.941 903.395 0.737 0.0000 0.0000 0.0000 54 265 0.818 0.955
3 classes 3 900.471 953.184 908.779 0.840 0.1656 0.1784 0.1395 12 283 0.550 0.982
4 classes 4 910.290 981.829 921.564 0.866 0.6868 0.6882 1.0000 6 290 0.390 0.992

1 Undergraduate Cheating Behavior

Extract and prepare plot data

Plot 4-class latent class posterior probability plot

save figure


Example 2: Longitudinal Study of American Youth, Science Attitudes


Load data

View LCA indicators

LCA Indicators1
Name Label Values
Enjoy I enjoy science 0 = Disagree, 1 = Agree
Useful Science useful in everday problems 0 = Disagree, 1 = Agree
Logical Science helps logical thinkng 0 = Disagree, 1 = Agree
Job Need science for a good job 0 = Disagree, 1 = Agree
Adult Will use science often as an adult 0 = Disagree, 1 = Agree

1 Longitudinal Study of American Youth

Run enumeration using mplusObject method

Compare model fit for series of enumerated models

Fit Indices1
Title LL BIC aBIC BLRT_PValue T11_VLMR_PValue
Class 1 -10250.604 20541.34 20525.45 NA NA
Class 2 -8785.317 17658.92 17623.97 0 0.0000
Class 3 -8693.569 17523.59 17469.57 0 0.0000
Class 4 -8664.090 17512.79 17439.71 0 0.0000
Class 5 -8662.386 17557.54 17465.40 1 0.6734
Class 6 -8661.541 17604.01 17492.80 1 0.8384

1 Longitudinal Study of American Youth

Compare probability plots for \(K = 1:6\) class solutions


Example 3 - Kindergarten Student Entrance Profile (KSEP)


LCA Indicators1
Name Label Values
seek_hlp Seeks adult help when appropriate 0 = Not Mastered, 1 = Mastered
cooperat Engages in cooperative play activities with peers 0 = Not Mastered, 1 = Mastered
imp_cntr Exhibits impulse control and self-regulation 0 = Not Mastered, 1 = Mastered
repeats Stays with or repeats a task 0 = Not Mastered, 1 = Mastered
separate Separates appropriately from caregiver most days 0 = Not Mastered, 1 = Mastered
new_activ Is enthusiastic and curious in approaching new activities 0 = Not Mastered, 1 = Mastered
folw_rul Follows rules when participating in routine activities 0 = Not Mastered, 1 = Mastered
name Recognizes own name 0 = Not Mastered, 1 = Mastered
writes Writes own name 0 = Not Mastered, 1 = Mastered
express Demonstrates expressive abilities 0 = Not Mastered, 1 = Mastered
quantity Understands that numbers represent quantity 0 = Not Mastered, 1 = Mastered
colors Recognizes Colors 0 = Not Mastered, 1 = Mastered
shapes Recognizes primary shapes 0 = Not Mastered, 1 = Mastered

1 Kindergarten Student Entrance Profile

Enumeration: Compare k-class models 1-6

Compare model fit for series of enumerated models

Fit Indices1
Title LL BIC aBIC BLRT_PValue T11_VLMR_PValue
Class 1 -11844.461 23783.62 23742.32 NA NA
Class 2 -9712.793 19622.26 19536.49 0 0.0000
Class 3 -9372.043 19042.74 18912.49 0 0.0000
Class 4 -9215.475 18831.58 18656.86 0 0.1240
Class 5 -9137.866 18778.34 18559.15 0 0.0722
Class 6 -9075.565 18755.71 18492.05 0 0.0394

1 Kindergarten Student Entrance Profile

Compare probability plots for \(K = 1:6\) class solutions