Mplus Textbook Examples
Applied Latent Class Analysis
Chapter 1 Latent Class Analysis by Leo A. Goodman
Table 2 on page 11 using data set https://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat.
Model H0:
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are s m freq;
weight is freq (freq);
categorical are s m;
Missing are all (-9999) ;
classes = cl(1);
Analysis:
Type = mixture;
model:
%overall%
TESTS OF MODEL FIT
Loglikelihood
H0 Value -5190.578
Information Criteria
Number of Free Parameters 8
Akaike (AIC) 10397.157
Bayesian (BIC) 10440.473
Sample-Size Adjusted BIC 10415.059
(n* = (n + 2) / 24)
Chi-Square Test of Model Fit for the Binary and Ordered Categorical (Ordinal) Outcomes
Pearson Chi-Square
Value 45.985
Degrees of Freedom 15
P-Value 0.0001
Likelihood Ratio Chi-Square
Value 47.418
Degrees of Freedom 15
P-Value 0.0000
Model H1: We have to specify two of the parameters in order for the model to be identifiable. It does not matter which of the two parameters to be fixed. Please see the discussion for detail on page 32.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat;
Variable:
Names are
s m freq;
usevariables are s m freq;
weight is freq (freq);
categorical are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
model:
%overall%
[s$1-s$5*];
[m$2 m$3*];
[m$1@-15];
%cl#1%
[s$1-s$5*];
[m$1-m$2*];
[m$3@15];
TESTS OF MODEL FIT
Loglikelihood
H0 Value -5168.243
Information Criteria
Number of Free Parameters 15
Akaike (AIC) 10366.485
Bayesian (BIC) 10447.704
Sample-Size Adjusted BIC 10400.051
(n* = (n + 2) / 24)
Entropy 0.450
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 2.743
Degrees of Freedom 8
P-Value 0.9494
Likelihood Ratio Chi-Square
Value 2.746
Degrees of Freedom 8
P-Value 0.9493
Table 3 on page 13, the observed and estimated frequencies under H0 and H1 model. To display the frequencies, we request TECH10 in the output.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are s m freq;
weight is freq (freq);
categorical are s m;
Missing are all (-9999) ;
classes = cl(1);
Analysis:
Type = mixture;
model:
%overall%
output tech10;
RESPONSE PATTERN FREQUENCIES AND CHI-SQUARE CONTRIBUTIONS
Response Frequency Standard Chi-square Contribution
Pattern Observed Estimated Residual Pearson Loglikelihood Deleted
1 64.00 48.45 2.27 4.99 35.62
2 57.00 45.31 1.76 3.02 26.17
3 57.00 53.08 0.55 0.29 8.13
4 72.00 71.02 0.12 0.01 1.98
5 36.00 49.01 1.89 3.45 -22.21
6 21.00 40.13 3.06 9.12 -27.20
7 94.00 95.01 0.11 0.01 -2.02
8 94.00 88.85 0.56 0.30 10.59
9 105.00 104.08 0.09 0.01 1.85
10 141.00 139.26 0.15 0.02 3.51
11 97.00 96.10 0.09 0.01 1.80
12 71.00 78.70 0.89 0.75 -14.61
13 58.00 57.13 0.12 0.01 1.74
14 54.00 53.43 0.08 0.01 1.15
15 65.00 62.59 0.31 0.09 4.92
16 77.00 83.74 0.76 0.54 -12.92
17 54.00 57.79 0.51 0.25 -7.32
18 54.00 47.32 0.98 0.94 14.26
19 46.00 61.40 2.00 3.86 -26.56
20 40.00 57.41 2.34 5.28 -28.91
21 60.00 67.25 0.90 0.78 -13.70
22 94.00 89.99 0.44 0.18 8.21
23 78.00 62.10 2.06 4.07 35.56
24 71.00 50.85 2.87 7.98 47.40
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat;
Variable:
Names are
s m freq;
usevariables are s m freq;
weight is freq (freq);
categorical are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
model:
%overall%
[s$1-s$5*];
[m$2 m$3*];
[m$1@-15];
%cl#1%
[s$1-s$5*];
[m$1-m$2*];
[m$3@15];
output: tech10;
RESPONSE PATTERN FREQUENCIES AND CHI-SQUARE CONTRIBUTIONS
Response Frequency Standard Chi-square Contribution
Pattern Observed Estimated Residual Pearson Loglikelihood Deleted
1 64.00 62.22 0.23 0.05 3.61
2 57.00 59.21 0.29 0.08 -4.33
3 57.00 58.21 0.16 0.03 -2.40
4 72.00 70.03 0.24 0.06 4.00
5 36.00 36.08 0.01 0.00 -0.15
6 21.00 21.26 0.06 0.00 -0.52
7 94.00 98.18 0.43 0.18 -8.17
8 94.00 92.04 0.21 0.04 3.96
9 105.00 105.26 0.03 0.00 -0.52
10 141.00 139.03 0.17 0.03 3.97
11 97.00 93.13 0.41 0.16 7.89
12 71.00 74.36 0.40 0.15 -6.57
13 58.00 56.26 0.24 0.05 3.53
14 54.00 52.55 0.20 0.04 2.95
15 65.00 62.26 0.35 0.12 5.60
16 77.00 83.80 0.76 0.55 -13.04
17 54.00 58.61 0.61 0.36 -8.85
18 54.00 48.52 0.80 0.62 11.56
19 46.00 45.34 0.10 0.01 1.32
20 40.00 41.21 0.19 0.04 -2.38
21 60.00 61.27 0.17 0.03 -2.51
22 94.00 91.14 0.31 0.09 5.81
23 78.00 77.18 0.10 0.01 1.65
24 71.00 72.86 0.22 0.05 -3.67
Table 5a on page 15 using data https://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat from table 4 on page 14.
Model M0: Null model
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(1);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
TESTS OF MODEL FIT
Loglikelihood
H0 Value -543.650
Information Criteria
Number of Free Parameters 4
Akaike (AIC) 1095.300
Bayesian (BIC) 1108.801
Sample-Size Adjusted BIC 1096.125
(n* = (n + 2) / 24)
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 104.107
Degrees of Freedom 11
P-Value 0.0000
Likelihood Ratio Chi-Square
Value 81.084
Degrees of Freedom 11
P-Value 0.0000
Model M1: Two-class model
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(2);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1-d$1];
TESTS OF MODEL FIT
Loglikelihood
H0 Value -504.468
Information Criteria
Number of Free Parameters 9
Akaike (AIC) 1026.935
Bayesian (BIC) 1057.313
Sample-Size Adjusted BIC 1028.793
(n* = (n + 2) / 24)
Entropy 0.719
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 2.720
Degrees of Freedom 6
P-Value 0.8431
Likelihood Ratio Chi-Square
Value 2.720
Degrees of Freedom 6
P-Value 0.8431
Model M3: Three-class model. Notice that this model is not identifiable until we provide at least one constraint on it. In this example, we set the threshold for variable c to be 15 for class 2.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
! starts = 50 2;
model:
%overall%
%cl#2%
[c$1@15];
TESTS OF MODEL FIT
Loglikelihood
H0 Value -503.301
Information Criteria
Number of Free Parameters 13
Akaike (AIC) 1032.602
Bayesian (BIC) 1076.481
Sample-Size Adjusted BIC 1035.286
(n* = (n + 2) / 24)
Entropy 0.560
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 0.423
Degrees of Freedom 2
P-Value 0.8096
Likelihood Ratio Chi-Square
Value 0.387
Degrees of Freedom 2
P-Value 0.8241
Table 5b on page 16, a continuation of Table 5a.
Model M3: Three-class model with constraints defined on page 41.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1 - d$1@-15];
%cl#3%
[a$1 - d$1@15];
TESTS OF MODEL FIT
Loglikelihood
H0 Value -504.248
Information Criteria
Number of Free Parameters 6
Akaike (AIC) 1020.497
Bayesian (BIC) 1040.748
Sample-Size Adjusted BIC 1021.735
(n* = (n + 2) / 24)
Entropy 0.884
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 2.282
Degrees of Freedom 9
P-Value 0.9862
Likelihood Ratio Chi-Square
Value 2.281
Degrees of Freedom 9
P-Value 0.9862
Model M4: Three-class model with constraints defined on page 41 and page 42.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1 - d$1@-15];
%cl#2%
[b$1 c$1] (1);
%cl#3%
[a$1 - d$1@15];
TESTS OF MODEL FIT
Loglikelihood
H0 Value -504.303
Information Criteria
Number of Free Parameters 5
Akaike (AIC) 1018.607
Bayesian (BIC) 1035.483
Sample-Size Adjusted BIC 1019.639
(n* = (n + 2) / 24)
Entropy 0.884
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 2.421
Degrees of Freedom 10
P-Value 0.9920
Likelihood Ratio Chi-Square
Value 2.391
Degrees of Freedom 10
P-Value 0.9924
Model M5: Three-class model with constraints defined on page 42.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1 - d$1@-15];
%cl#2%
[a$1] (p1);
[b$1 c$1] (2);
[d$1] (p2);
%cl#3%
[a$1 - d$1@15];
model constraint:
p1 = -p2;
TESTS OF MODEL FIT
Loglikelihood
H0 Value -504.469
Information Criteria
Number of Free Parameters 4
Akaike (AIC) 1016.937
Bayesian (BIC) 1030.438
Sample-Size Adjusted BIC 1017.763
(n* = (n + 2) / 24)
Entropy 0.880
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
Pearson Chi-Square
Value 2.846
Degrees of Freedom 11
P-Value 0.9926
Likelihood Ratio Chi-Square
Value 2.722
Degrees of Freedom 11
P-Value 0.9939
Table 6 on page 18 based on model M1.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(2);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1-d$1];
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES
BASED ON THE ESTIMATED MODEL
Latent
Classes
1 155.68279 0.72075
2 60.31721 0.27925
RESULTS IN PROBABILITY SCALE
Latent Class 1
A
Category 1 0.714 0.042 17.045
Category 2 0.286 0.042 6.841
B
Category 1 0.330 0.051 6.461
Category 2 0.670 0.051 13.140
C
Category 1 0.354 0.049 7.220
Category 2 0.646 0.049 13.175
D
Category 1 0.132 0.039 3.406
Category 2 0.868 0.039 22.325
Latent Class 2
A
Category 1 0.993 0.025 39.267
Category 2 0.007 0.025 0.269
B
Category 1 0.940 0.067 13.985
Category 2 0.060 0.067 0.896
C
Category 1 0.927 0.068 13.716
Category 2 0.073 0.068 1.088
D
Category 1 0.769 0.098 7.833
Category 2 0.231 0.098 2.351
Table 7 based on model M3.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1 - d$1@-15];
%cl#3%
[a$1 - d$1@15];
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASS PATTERNS
BASED ON ESTIMATED POSTERIOR PROBABILITIES
Latent
Classes
1 10.77942 0.04990
2 167.49620 0.77545
3 37.72438 0.17465
RESULTS IN PROBABILITY SCALE
Latent Class 1
A
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
B
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
C
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
D
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
Latent Class 2
A
Category 1 0.796 0.037 21.616
Category 2 0.204 0.037 5.550
B
Category 1 0.420 0.041 10.178
Category 2 0.580 0.041 14.081
C
Category 1 0.437 0.041 10.712
Category 2 0.563 0.041 13.774
D
Category 1 0.175 0.032 5.431
Category 2 0.825 0.032 25.641
Latent Class 3
A
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
B
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
C
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
D
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
Table 8 on page 21 based on model M5.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[a$1 - d$1@-15];
%cl#2%
[a$1] (p1);
[b$1 c$1] (2);
[d$1] (p2);
%cl#3%
[a$1 - d$1@15];
model constraint:
p1 = -p2;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES
BASED ON THE ESTIMATED MODEL
Latent
Classes
1 11.77754 0.05453
2 167.01151 0.77320
3 37.21095 0.17227
RESULTS IN PROBABILITY SCALE
Latent Class 1
A
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
B
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
C
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
D
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
Latent Class 2
A
Category 1 0.811 0.022 36.549
Category 2 0.189 0.022 8.498
B
Category 1 0.433 0.030 14.406
Category 2 0.567 0.030 18.876
C
Category 1 0.433 0.030 14.406
Category 2 0.567 0.030 18.876
D
Category 1 0.189 0.022 8.498
Category 2 0.811 0.022 36.549
Latent Class 3
A
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
B
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
C
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
D
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
Table A1. on page 33 using data set https://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat.
Model H1′: with constraints defined on page 32.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat;
Variable:
Names are
s m freq;
usevariables are s m freq;
weight is freq (freq);
categorical are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
model:
%overall%
[s$1-s$5*];
[m$1-m$3*];
%cl#1%
[s$1] (p1);
[s$2] (p2);
[s$3] (p3);
[s$4] (p4);
[s$5] (p5);
[m$1] (q1);
[m$2] (q2);
[m$3] (q3);
model constraint:
p1 + p2 + p3 + p4 + p5 = 15;
q1 + q2 + q3 = 15;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES
BASED ON THE ESTIMATED MODEL
Latent
Classes
1 501.44281 0.30207
2 1158.55719 0.69793
RESULTS IN PROBABILITY SCALE
Latent Class 1
S
Category 1 0.253 0.036 7.011
Category 2 0.244 0.035 6.999
Category 3 0.208 0.034 6.196
Category 4 0.224 0.037 6.046
Category 5 0.070 0.038 1.831
Category 6 0.000 0.000 0.000
M
Category 1 0.386 0.048 8.049
Category 2 0.409 0.050 8.188
Category 3 0.205 0.045 4.552
Category 4 0.000 0.000 0.000
Latent Class 2
S
Category 1 0.117 0.015 7.816
Category 2 0.106 0.015 6.979
Category 3 0.158 0.017 9.424
Category 4 0.234 0.019 12.622
Category 5 0.198 0.018 11.314
Category 6 0.187 0.017 10.757
M
Category 1 0.098 0.020 4.946
Category 2 0.343 0.026 13.189
Category 3 0.224 0.022 10.340
Category 4 0.336 0.027 12.311
Model H1”: with constraints defined on page 32. In Mplus 3, the CATEGORICAL option in the Variable statement is used to refer a binary or an ordered categorical variable. With ordered categorical variable, the thresholds should be in increasing order. The constraint on the second category of variable socioeconomic status does not follow this rule. One way to get around of this is to recode this variable. This is done using DEFINE statement shown in the first approach. The other way is to declare variable s as nominal variable and request TECH7 for displaying the distribution information. This is shown as the second approach.
Approach #1:
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are m freq s2;
weight is freq (freq);
categorical are s2 m;
Missing are all (-9999) ;
classes = cl(2);
define:
s2 = s;
if (s == 2) then s2 = 1;
if (s == 1) then s2 = 2;
Analysis:
Type = mixture;
model:
%overall%
[s2$1-s2$5*];
[m$1-m$3*];
%cl#2%
[s2$1@-15] ;
[m$1@-15] ;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES
BASED ON THE ESTIMATED MODEL
Latent
Classes
1 1270.38005 0.76529
2 389.61995 0.23471
RESULTS IN PROBABILITY SCALE
Latent Class 1
M
Category 1 0.242 0.021 11.416
Category 2 0.376 0.019 19.564
Category 3 0.214 0.016 13.576
Category 4 0.168 0.023 7.257
S2
Category 1 0.193 0.018 10.821
Category 2 0.203 0.019 10.630
Category 3 0.190 0.018 10.533
Category 4 0.228 0.020 11.674
Category 5 0.118 0.017 7.029
Category 6 0.069 0.014 4.872
Latent Class 2
M
Category 1 0.000 0.000 0.000
Category 2 0.320 0.052 6.217
Category 3 0.230 0.041 5.616
Category 4 0.450 0.051 8.843
S2
Category 1 0.000 0.000 0.000
Category 2 0.012 0.069 0.169
Category 3 0.118 0.055 2.146
Category 4 0.242 0.055 4.423
Category 5 0.297 0.058 5.103
Category 6 0.331 0.069 4.772
Approach #2:
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are s m freq ;
weight is freq (freq);
nominal are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
model:
%overall%
[s#1-s#5*];
[m#1-m#3*];
%cl#2%
[s#2@-15] ;
[m#1@-15] ;
output:
tech7;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASSES
BASED ON THE ESTIMATED MODEL
Latent
Classes
1 1270.38085 0.76529
2 389.61915 0.23471
TECHNICAL 7 OUTPUT
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 1
Variable
S
Category 1 0.203
Category 2 0.193
Category 3 0.190
Category 4 0.228
Category 5 0.118
Category 6 0.069
M
Category 1 0.242
Category 2 0.376
Category 3 0.214
Category 4 0.168
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 2
Variable
S
Category 1 0.012
Category 2 0.000
Category 3 0.118
Category 4 0.242
Category 5 0.297
Category 6 0.331
M
Category 1 0.000
Category 2 0.320
Category 3 0.230
Category 4 0.450
Table A2 on page 34 using data set https://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat.
Model H1”’: With constraints defined on page 35.
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are s m freq ;
weight is freq (freq);
nominal are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
starts = 50 4;
model:
%overall%
[s#1-s#5*];
[m#1-m#3*];
%cl#1%
[s#1] (p1);
[s#2] (p2);
[s#3] (p3);
[s#4] (p4);
[s#5] (p5);
%cl#2%
[s#2@-15];
model constraint:
p1 + p2 + p3 + p4 + p5= 15;
output: tech7;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASS PATTERNS
BASED ON ESTIMATED POSTERIOR PROBABILITIES
Latent
Classes
1 1004.71928 0.60525
2 655.28072 0.39475
TECHNICAL 7 OUTPUT
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 1
Variable
S
Category 1 0.253
Category 2 0.244
Category 3 0.208
Category 4 0.224
Category 5 0.070
Category 6 0.000
M
Category 1 0.242
Category 2 0.376
Category 3 0.214
Category 4 0.168
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 2
Variable
S
Category 1 0.012
Category 2 0.000
Category 3 0.118
Category 4 0.242
Category 5 0.297
Category 6 0.331
M
Category 1 0.098
Category 2 0.343
Category 3 0.224
Category 4 0.336
Model H1””: With constraints defined on page 35
Data:
File is c:alcahttps://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat ;
Variable:
Names are
s m freq;
usevariables are s m freq ;
weight is freq (freq);
nominal are s m;
Missing are all (-9999) ;
classes = cl(2);
Analysis:
Type = mixture;
starts = 50 4;
model:
%overall%
[s#1-s#5*];
[m#1-m#3*];
%cl#1%
[m#1] (p1);
[m#2] (p2);
[m#3] (p3);
%cl#2%
[m#1@-15];
model constraint:
p1 + p2 + p3 = 15;
output: tech7;
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASS PATTERNS
BASED ON ESTIMATED POSTERIOR PROBABILITIES
Latent
Classes
1 795.59896 0.47928
2 864.40104 0.52072
TECHNICAL 7 OUTPUT
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 1
Variable
S
Category 1 0.203
Category 2 0.193
Category 3 0.190
Category 4 0.228
Category 5 0.118
Category 6 0.069
M
Category 1 0.386
Category 2 0.409
Category 3 0.205
Category 4 0.000
UNIVARIATE SAMPLE DISTRIBUTIONS FOR CLASS 2
Variable
S
Category 1 0.117
Category 2 0.106
Category 3 0.158
Category 4 0.234
Category 5 0.198
Category 6 0.187
M
Category 1 0.000
Category 2 0.320
Category 3 0.230
Category 4 0.450
Table A3 on page 37 using data set https://stats.idre.ucla.edu/wp-content/uploads/2016/02/page11.dat. Mplus 3 does not provide the type of calculation that is involved in creating this table. The detailed calculation is explained on page 38. We will do it in Stata instead using the results from Model H1′. The second part of the Table A3 using Model H1”’ can be produced in a similar way and we omit it here.
clear input str2 category prob_y s1 0.158 s2 0.148 s3 0.173 s4 0.231 s5 0.160 s6 0.131 m1 0.185 m2 0.363 m3 0.218 m4 0.234 end gen id = _n sort id save prob_y, replace clear input str2 category prob_y_cond_x1 s1 0.253 s2 0.244 s3 0.208 s4 0.224 s5 0.070 s6 0.000 m1 0.386 m2 0.409 m3 0.205 m4 0.000 end gen id=_n sort id merge id using prob_y gen favorably = prob_y_cond_x1*.30207/prob_y gen not_favorably=1-favorably list category favorably not_favorably
+--------------------------------+
| category favora~y not_fa~y |
|--------------------------------|
1. | s1 .4836943 .5163057 |
2. | s2 .4980073 .5019927 |
3. | s3 .3631825 .6368176 |
4. | s4 .2929164 .7070836 |
5. | s5 .1321556 .8678443 |
|--------------------------------|
6. | s6 0 1 |
7. | m1 .630265 .369735 |
8. | m2 .3403488 .6596512 |
9. | m3 .2840567 .7159433 |
10. | m4 0 1 |
+--------------------------------+
Table A4 on page 42.
Model M2′:
Data:
File is c:alcapage14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#3%
[b$1@-15];
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASS PATTERNS
BASED ON ESTIMATED POSTERIOR PROBABILITIES
Latent
Classes
1 145.09603 0.67174
2 47.47451 0.21979
3 23.42947 0.10847
RESULTS IN PROBABILITY SCALE
Latent Class 1
A
Category 1 0.806 0.074 10.908
Category 2 0.194 0.074 2.621
B
Category 1 0.428 0.260 1.643
Category 2 0.572 0.260 2.199
C
Category 1 0.407 0.146 2.782
Category 2 0.593 0.146 4.055
D
Category 1 0.170 0.115 1.482
Category 2 0.830 0.115 7.236
Latent Class 2
A
Category 1 0.995 0.038 26.397
Category 2 0.005 0.038 0.121
B
Category 1 0.968 0.098 9.908
Category 2 0.032 0.098 0.327
C
Category 1 0.976 0.119 8.167
Category 2 0.024 0.119 0.203
D
Category 1 0.863 0.222 3.891
Category 2 0.137 0.222 0.616
Latent Class 3
A
Category 1 0.288 1.296 0.222
Category 2 0.712 1.296 0.549
B
Category 1 0.000 0.000 0.000
Category 2 1.000 0.000 0.000
C
Category 1 0.241 0.239 1.009
Category 2 0.759 0.239 3.183
D
Category 1 0.057 0.179 0.320
Category 2 0.943 0.179 5.254
Model M2”:
Data:
File is c:alcapage14.dat ;
Variable:
Names are
a b c d freq;
usevariables are a b c d freq;
weight is freq (freq);
categorical are a b c d;
classes = cl(3);
Missing are all (-9999) ;
Analysis:
Type = mixture ;
model:
%overall%
%cl#1%
[c$1@15];
%cl#2%
[b$1@0];
FINAL CLASS COUNTS AND PROPORTIONS FOR THE LATENT CLASS PATTERNS
BASED ON ESTIMATED POSTERIOR PROBABILITIES
Latent
Classes
1 41.63539 0.19276
2 124.96989 0.57856
3 49.39472 0.22868
RESULTS IN PROBABILITY SCALE
Latent Class 1
A
Category 1 0.998 0.036 27.506
Category 2 0.002 0.036 0.059
B
Category 1 0.980 0.095 10.327
Category 2 0.020 0.095 0.216
C
Category 1 1.000 0.000 0.000
Category 2 0.000 0.000 0.000
D
Category 1 0.913 0.193 4.741
Category 2 0.087 0.193 0.450
Latent Class 2
A
Category 1 0.845 0.119 7.102
Category 2 0.155 0.119 1.304
B
Category 1 0.500 0.000 0.000
Category 2 0.500 0.000 0.000
C
Category 1 0.449 0.114 3.945
Category 2 0.551 0.114 4.851
D
Category 1 0.202 0.081 2.496
Category 2 0.798 0.081 9.858
Latent Class 3
A
Category 1 0.483 0.173 2.794
Category 2 0.517 0.173 2.989
B
Category 1 0.096 0.300 0.319
Category 2 0.904 0.300 3.011
C
Category 1 0.269 0.183 1.475
Category 2 0.731 0.183 4.000
D
Category 1 0.075 0.110 0.684
Category 2 0.925 0.110 8.376
