UCLA Academic Technology Services HomeServicesClassesContactJobs
Help the Stat Consulting Group by giving a gift             
Loading

Mplus Textbook Examples
Applied Latent Class Analysis
Chapter 11 Latent Markov Chains by Rolf Langeheine and Frank van de Pol

The data set can be downloaded following the link here.


Expected frequencies of Table 1 on page 310 based on the simple Markov model with time homogeneous transition probabilities.

data:
file is chap11.dat;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
model:
    %overall%
    c2#1 on c1#1 (1);
    c3#1 on c2#1 (1);
    c4#1 on c3#1 (1);
    c5#1 on c4#1 (1);
    [c1#1];
    [c2#1 c3#1 c4#1 c5#1] (2);
model c1:
    %c1#1%
    [u1$1@-15];
    %c1#2%
    [u1$1@15]; 
model c2:
    %c2#1%
    [u2$1@-15];
    %c2#2%
    [u2$1@15]; 
model c3:
    %c3#1%
    [u3$1@-15];
    %c3#2%
    [u3$1@15]; 
model c4:
    %c4#1%
    [u4$1@-15];
    %c4#2%
    [u4$1@15]; 
model c5:
    %c5#1%
    [u5$1@-15];
    %c5#2%
    [u5$1@15];    
output: tech10;
   RESPONSE PATTERN FREQUENCIES AND CHI-SQUARE CONTRIBUTIONS
    Response          Frequency      Standard  Chi-square Contribution
     Pattern    Observed  Estimated  Residual  Pearson   Loglikelihood  Deleted
         1       891.00     553.84     15.17    205.25       847.29
         2       237.00     288.85      3.14      9.31       -93.79
         3       120.00      92.85      2.84      7.94        61.56
         4       136.00     293.64      9.47     84.63      -209.36
         5       111.00      92.85      1.90      3.55        39.64
         6        80.00      48.43      4.56     20.59        80.32
         7        54.00      94.39      4.20     17.28       -60.31
         8        99.00     298.50     11.90    133.34      -218.53
         9       119.00      92.85      2.74      7.37        59.06
        10        68.00      48.43      2.83      7.91        46.17
        11        51.00      15.57      8.99     80.66       121.05
        12        64.00      49.23      2.12      4.43        33.59
        13        52.00      94.39      4.40     19.04       -62.00
        14        51.00      49.23      0.25      0.06         3.61
        15        49.00      95.95      4.84     22.97       -65.86
        16       172.00     303.45      7.78     56.94      -195.30
        17       176.00     231.40      3.73     13.26       -96.33
        18       107.00     120.69      1.26      1.55       -25.76
        19        64.00      38.79      4.06     16.38        64.08
        20        95.00     122.69      2.53      6.25       -48.59
        21        60.00      38.79      3.42     11.59        52.33
        22        75.00      20.23     12.20    148.25       196.53
        23        50.00      39.44      1.69      2.83        23.73
        24       165.00     124.72      3.65     13.01        92.36
        25       106.00     235.23      8.63     71.00      -168.99
        26       107.00     122.69      1.43      2.01       -29.28
        27        67.00      39.44      4.41     19.27        71.02
        28       187.00     124.72      5.65     31.10       151.49
        29        92.00     239.13      9.74     90.53      -175.76
        30       200.00     124.72      6.82     45.44       188.90
        31       176.00     243.09      4.41     18.52      -113.68
        32      1066.00     768.79     11.62    114.90       696.84

Table 2 based on the simple Markov chain model with time heterogeneous transition probabilities.

data:
file is chap11.dat ;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
model:
    %overall%
    c2#1 on c1#1 ;
    c3#1 on c2#1 ;
    c4#1 on c3#1 ;
    c5#1 on c4#1 ;
    [c1#1 c2#1 c3#1 c4#1 c5#1] ;
model c1:
    %c1#1%
    [u1$1@-15];
    %c1#2%
    [u1$1@15]; 
model c2:
    %c2#1%
    [u2$1@-15];
    %c2#2%
    [u2$1@15]; 
model c3:
    %c3#1%
    [u3$1@-15];
    %c3#2%
    [u3$1@15]; 
model c4:
    %c4#1%
    [u4$1@-15];
    %c4#2%
    [u4$1@15]; 
model c5:
    %c5#1%
    [u5$1@-15];
    %c5#2%
    [u5$1@15]; 
FINAL CLASS COUNTS AND PROPORTIONS FOR EACH LATENT CLASS VARIABLE
BASED ON THE ESTIMATED MODEL
  Latent Class
    Variable    Class
    C1             1      2908.99976          0.56518
                   2      2237.99976          0.43482
    C2             1      2615.00000          0.50806
                   2      2532.00000          0.49194
    C3             1      2551.99976          0.49582
                   2      2595.00000          0.50418
    C4             1      2627.00000          0.51039
                   2      2520.00000          0.48961
    C5             1      2793.00000          0.54265
                   2      2353.99976          0.45735
LATENT TRANSITION PROBABILITIES BASED ON THE ESTIMATED MODEL
  C1 Classes (Rows) by C2 Classes (Columns)
            1        2
   1     0.682    0.318
   2     0.282    0.718
  C2 Classes (Rows) by C3 Classes (Columns)
            1        2
   1     0.700    0.300
   2     0.285    0.715
  C3 Classes (Rows) by C4 Classes (Columns)
            1        2
   1     0.728    0.272
   2     0.296    0.704
  C4 Classes (Rows) by C5 Classes (Columns)
            1        2
   1     0.762    0.238
   2     0.314    0.686

Table 3 on page 315.

Model 1a (M): Simple Markov model with time homogeneous transition probabilities

data:
file is chap11.dat ;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
 model:
       %overall%
       c2#1 on c1#1 (1);
       c3#1 on c2#1 (1);
       c4#1 on c3#1 (1);
       c5#1 on c4#1 (1);
       [c1#1];
       [c2#1 c3#1 c4#1 c5#1] (2);
     model c1:
          %c1#1%
          [u1$1@-15];
          %c1#2%
          [u1$1@15]; !for variable a;
    model c2:
          %c2#1%
          [u2$1@-15];
          %c2#2%
          [u2$1@15]; !for variable b;
    model c3:
          %c3#1%
          [u3$1@-15];
          %c3#2%
          [u3$1@15]; !for variable c;
    model c4:
          %c4#1%
          [u4$1@-15];
          %c4#2%
          [u4$1@15]; !for variable d;
    model c5:
          %c5#1%
          [u5$1@-15];
          %c5#2%
          [u5$1@15]; !for variable e;
TESTS OF MODEL FIT

Loglikelihood

          H0 Value                      -15893.523

Information Criteria

          Number of Free Parameters              3
          Akaike (AIC)                   31793.046
          Bayesian (BIC)                 31812.685
          Sample-Size Adjusted BIC       31803.152
            (n* = (n + 2) / 24)
          Entropy                            1.000

Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes

          Pearson Chi-Square

          Value                           1287.146
          Degrees of Freedom                    28
          P-Value                           0.0000

          Likelihood Ratio Chi-Square

          Value                           1266.023
          Degrees of Freedom                    28
          P-Value                           0.0000

Model 1b (M): Simple Markov model with time heterogeneous  transition probabilities

data:
file is chap11.dat ;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
model:
    %overall%
    c2#1 on c1#1 ;
    c3#1 on c2#1 ;
    c4#1 on c3#1 ;
    c5#1 on c4#1 ;
    [c1#1 c2#1 c3#1 c4#1 c5#1] ;
model c1:
    %c1#1%
    [u1$1@-15];
    %c1#2%
    [u1$1@15]; 
model c2:
    %c2#1%
    [u2$1@-15];
    %c2#2%
    [u2$1@15]; 
model c3:
    %c3#1%
    [u3$1@-15];
    %c3#2%
    [u3$1@15]; 
model c4:
    %c4#1%
    [u4$1@-15];
    %c4#2%
    [u4$1@15]; 
model c5:
    %c5#1%
    [u5$1@-15];
    %c5#2%
    [u5$1@15]; 
TESTS OF MODEL FIT

Loglikelihood

          H0 Value                      -15865.184

Information Criteria

          Number of Free Parameters              9
          Akaike (AIC)                   31748.367
          Bayesian (BIC)                 31807.283
          Sample-Size Adjusted BIC       31778.684
            (n* = (n + 2) / 24)
          Entropy                            1.000

Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes

          Pearson Chi-Square

          Value                           1239.474
          Degrees of Freedom                    22
          P-Value                           0.0000

          Likelihood Ratio Chi-Square

          Value                           1209.345
          Degrees of Freedom                    22
          P-Value                           0.0000

Model 2a (MS): MS Mover-Stayer with time homogenous transition probabilities. 

data:
  file is chap11_dat.txt ;

variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c(2) c1(2) c2(2) c3(2) c4(2) c5(2);

analysis:
    type = mixture;

model:
	%overall%

	!c#1 is the mover class
	!c#2 is the stayer class

	[c#1]; !  estimates prob of being in the mover class

	[c1#1]; ! estimates prob of being in unsatisfied class
			
	c1#1 on c#1; ! adding this to [c1#1] estimates prob of being
                 ! in the unsatisfied c1 class for movers (c#1)


	[c2#1@-10]; ! fixes prob=0 for unsatisfied c2#1 class 
		    ! in the stayer class (c#2), 
		    ! for satisfied c1#2 class (see ~ on c1 below
	            ! in model c statement)
	[c3#1@-10]; ! same as above for c3#1
	[c4#1@-10]; ! same as above for c4#1
	[c5#1@-10]; ! same as above for c5#1

	c2#1 on c#1 (2); ! adding this to [c2#1@-10] estimates prob
			 ! of being in the unsatisfied c2#1 class
			 ! in the mover class (c#1),
			 ! for the unsatisfied c1#1 class
	c3#1 on c#1 (2);
	c4#1 on c#1 (2);
        c5#1 on c#1 (2);

model c:
	%c#1%

	c2#1 on c1#1 (3); 
	c3#1 on c2#1 (3);
	c4#1 on c3#1 (3);
        c5#1 on c4#1 (3);

	%c#2%

	c2#1 on c1#1@20; 
	c3#1 on c2#1@20;
	c4#1 on c3#1@20;
        c5#1 on c4#1@20;

model c1:
    %c1#1%
    [u1$1@15]; 
    %c1#2%
    [u1$1@-15];

model c2:
    %c2#1%
    [u2$1@15];
    %c2#2%
    [u2$1@-15];

model c3:
    %c3#1%
    [u3$1@15];
    %c3#2%
    [u3$1@-15];

model c4:
    %c4#1%
    [u4$1@15];
    %c4#2%
    [u4$1@-15];

model c5:
    %c5#1%
    [u5$1@15];
    %c5#2%
    [u5$1@-15];
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15422.306
Information Criteria
          Number of Free Parameters              5
          Akaike (AIC)                   30854.613
          Bayesian (BIC)                 30887.343
          Sample-Size Adjusted BIC       30871.455
            (n* = (n + 2) / 24)
          Entropy                            0.951
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                            322.878
          Degrees of Freedom                    26
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                            323.590
          Degrees of Freedom                    26
          P-Value                           0.0000
 

Model 2b (MS): MS Mover-Stayer with time heterogeneous transition probabilities. 

data:
  file is chap11_dat.txt ;

variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c(2) c1(2) c2(2) c3(2) c4(2) c5(2);

analysis:
    type = mixture;

model:
	%overall%

	!c#1 is the mover class
	!c#2 is the stayer class

	[c#1]; !  estimates prob of being in the mover class

	[c1#1]; ! estimates prob of being in unsatisfied class
			
	c1#1 on c#1; ! adding this to [c1#1] estimates prob of being
                     ! in the unsatisfied c1 class for movers (c#1)

	[c2#1@-10]; ! fixes prob=0 for unsatisfied c2#1 class 
		    ! in the stayer class (c#2), 
		    ! for satisfied c1#2 class 

	[c3#1@-10]; ! same as above for c3#1
	[c4#1@-10]; ! same as above for c4#1
	[c5#1@-10]; ! same as above for c5#1

	c2#1 on c#1 ; 
	c3#1 on c#1 ;
	c4#1 on c#1 ;
        c5#1 on c#1 ;

model c:
	%c#1%

	c2#1 on c1#1 ; 
	c3#1 on c2#1 ;
	c4#1 on c3#1 ;
        c5#1 on c4#1 ;

	%c#2%

	c2#1 on c1#1@20; 
	c3#1 on c2#1@20;
	c4#1 on c3#1@20;
        c5#1 on c4#1@20;

model c1:
    %c1#1%
    [u1$1@15]; 
    %c1#2%
    [u1$1@-15];

model c2:
    %c2#1%
    [u2$1@15];
    %c2#2%
    [u2$1@-15];

model c3:
    %c3#1%
    [u3$1@15];
    %c3#2%
    [u3$1@-15];

model c4:
    %c4#1%
    [u4$1@15];
    %c4#2%
    [u4$1@-15];

model c5:
    %c5#1%
    [u5$1@15];
    %c5#2%
    [u5$1@-15];
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15395.927
Information Criteria
          Number of Free Parameters             11
          Akaike (AIC)                   30813.853
          Bayesian (BIC)                 30885.861
          Sample-Size Adjusted BIC       30850.907
            (n* = (n + 2) / 24)
          Entropy                            0.951
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                            272.340
          Degrees of Freedom                    20
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                            270.830
          Degrees of Freedom                    20
          P-Value                           0.0000

Model 3a (MM): Two-chain mixed Markov with time homogeneous transition probabilities.

data:
  file is chap11_dat.txt ;

variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c(2) c1(2) c2(2) c3(2) c4(2) c5(2);

analysis:
    type = mixture;

model:
	%overall%

	[c#1]; 

	[c1#1]; 
			
	c1#1 on c#1; 

	[c2#1 c3#1 C4#1 C5#1] (1); 

	c2#1 on c#1 (2); 
	c3#1 on c#1 (2);
	c4#1 on c#1 (2);
        c5#1 on c#1 (2);

model c:
	%c#1%

	c2#1 on c1#1 (3); 
	c3#1 on c2#1 (3);
	c4#1 on c3#1 (3);
        c5#1 on c4#1 (3);
	
        %c#2%

	c2#1 on c1#1 (4); 
	c3#1 on c2#1 (4);
   	c4#1 on c3#1 (4);
        c5#1 on c4#1 (4);

model c1:
    %c1#1%
    [u1$1@15]; 
    %c1#2%
    [u1$1@-15];

model c2:
    %c2#1%
    [u2$1@15];
    %c2#2%
    [u2$1@-15];

model c3:
    %c3#1%
    [u3$1@15];
    %c3#2%
    [u3$1@-15];

model c4:
    %c4#1%
    [u4$1@15];
    %c4#2%
    [u4$1@-15];

model c5:
    %c5#1%
    [u5$1@15];
    %c5#2%
    [u5$1@-15];
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15333.600
Information Criteria
          Number of Free Parameters              7
          Akaike (AIC)                   30681.201
          Bayesian (BIC)                 30727.024
          Sample-Size Adjusted BIC       30704.780
            (n* = (n + 2) / 24)
          Entropy                            0.943
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                            148.901
          Degrees of Freedom                    24
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                            146.176
          Degrees of Freedom                    24
          P-Value                           0.0000

Model 3b (MM): Two-chain mixed Markov with time heterogeneous transition probabilities.

data:
  file is chap11_dat.txt ;

variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c(2) c1(2) c2(2) c3(2) c4(2) c5(2);

analysis:
    type = mixture;

model:
	%overall%

	[c#1]; 

	[c1#1]; 
			
	c1#1 on c#1; 

	[c2#1 c3#1 C4#1 C5#1] ; 

	c2#1 on c#1 ; 
	c3#1 on c#1 ;
	c4#1 on c#1 ;
        c5#1 on c#1 ;

model c:
	%c#1%
	c2#1 on c1#1 ; 
	c3#1 on c2#1 ;
   	c4#1 on c3#1 ;
        c5#1 on c4#1 ;

	%c#2%
	c2#1 on c1#1 ; 
	c3#1 on c2#1 ;
   	c4#1 on c3#1 ;
        c5#1 on c4#1 ;
model c1:
    %c1#1%
    [u1$1@15]; 
    %c1#2%
    [u1$1@-15];

model c2:
    %c2#1%
    [u2$1@15];
    %c2#2%
    [u2$1@-15];

model c3:
    %c3#1%
    [u3$1@15];
    %c3#2%
    [u3$1@-15];

model c4:
    %c4#1%
    [u4$1@15];
    %c4#2%
    [u4$1@-15];

model c5:
    %c5#1%
    [u5$1@15];
    %c5#2%
    [u5$1@-15];
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15307.952
Information Criteria
          Number of Free Parameters             19
          Akaike (AIC)                   30653.903
          Bayesian (BIC)                 30778.280
          Sample-Size Adjusted BIC       30717.905
            (n* = (n + 2) / 24)
          Entropy                            0.944
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                             97.495
          Degrees of Freedom                    12
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                             94.879
          Degrees of Freedom                    12
          P-Value                           0.0000 

Model 4a (MMS): 2 Markov and 2 Stayer chains with time homogeneous transition probabilities.

Model 7a (LM): Latent Markov with time homogeneous transition probabilities.

data:
file is chap11.dat ;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
model:
    %overall%
    c2#1 on c1#1 (1);
    c3#1 on c2#1 (1);
    c4#1 on c3#1 (1);
    c5#1 on c4#1 (1);
    [c2#1 c3#1 c4#1 c5#1] (2);
model c1:
    %c1#1%
    [u1$1]   (3);
    %c1#2%
    [u1$1]   (4); 
model c2:
    %c2#1%
    [u2$1]   (3);
    %c2#2%
    [u2$1]   (4); 
model c3:
    %c3#1%
    [u3$1]   (3);
    %c3#2%
    [u3$1]   (4);
model c4:
    %c4#1%
    [u4$1]   (3);
    %c4#2%
    [u4$1]   (4);
model c5:
    %c5#1%
    [u5$1]   (3);
    %c5#2%
    [u5$1]   (4);
   
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15378.476
Information Criteria
          Number of Free Parameters              5
          Akaike (AIC)                   30766.952
          Bayesian (BIC)                 30799.683
          Sample-Size Adjusted BIC       30783.795
            (n* = (n + 2) / 24)
          Entropy                            0.777
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                            243.841
          Degrees of Freedom                    26
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                            235.928
          Degrees of Freedom                    26
          P-Value                           0.0000

Model 7b (LM): Latent Markov with time heterogeneous transition probabilities.

data:
file is chap11.dat ;
variable:
names are
u1 u2 u3 u4 u5 count group;
missing are all (-9999) ;
usevariables are u1 u2 u3 u4 u5 count;
weight is count (freq);
categorical are u1 u2 u3 u4 u5;
classes = c1(2) c2(2) c3(2) c4(2) c5(2);
analysis:
type = mixture;
starts = 50 5;
model:
    %overall%
    c2#1 on c1#1 ;
    c3#1 on c2#1 ;
    c4#1 on c3#1 ;
    c5#1 on c4#1 ;
    [c2#1 c3#1 c4#1 c5#1] ;
model c1:
    %c1#1%
    [u1$1]   (3);
    %c1#2%
    [u1$1]   (4); 
model c2:
    %c2#1%
    [u2$1]   (3);
    %c2#2%
    [u2$1]   (4); 
model c3:
    %c3#1%
    [u3$1]   (3);
    %c3#2%
    [u3$1]   (4);
model c4:
    %c4#1%
    [u4$1]   (3);
    %c4#2%
    [u4$1]   (4);
model c5:
    %c5#1%
    [u5$1]   (3);
    %c5#2%
    [u5$1]   (4);
TESTS OF MODEL FIT
Loglikelihood
          H0 Value                      -15325.635
Information Criteria
          Number of Free Parameters             11
          Akaike (AIC)                   30673.271
          Bayesian (BIC)                 30745.279
          Sample-Size Adjusted BIC       30710.324
            (n* = (n + 2) / 24)
          Entropy                            0.802
Chi-Square Test of Model Fit for the Binary and Ordered Categorical
(Ordinal) Outcomes
          Pearson Chi-Square
          Value                            131.025
          Degrees of Freedom                    20
          P-Value                           0.0000
          Likelihood Ratio Chi-Square
          Value                            130.246
          Degrees of Freedom                    20
          P-Value                           0.0000



How to cite this page

Report an error on this page or leave a comment

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.