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.txt ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
       %overall%
       cb#1 on ca#1 (1);
       cc#1 on cb#1 (1);
       cd#1 on cc#1 (1);
       ce#1 on cd#1 (1);
       [ca#1];
       [cb#1 cc#1 cd#1 ce#1] (2);
     model ca:
          %ca#1%
          [a$1@15];
          %ca#2%
          [a$1@-15]; !for variable a;
    model cb:
          %cb#1%
          [b$1@15];
          %cb#2%
          [b$1@-15]; !for variable b;
    model cc:
          %cc#1%
          [c$1@15];
          %cc#2%
          [c$1@-15]; !for variable c;
    model cd:
          %cd#1%
          [d$1@15];
          %cd#2%
          [d$1@-15]; !for variable d;
    model ce:
          %ce#1%
          [e$1@15];
          %ce#2%
          [e$1@-15]; !for variable e;
   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 d:\alca\chap11.dat ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
          %overall%
       cb#1 on ca#1 ;
       cc#1 on cb#1 ;
       cd#1 on cc#1 ;
       ce#1 on cd#1 ;

       [ca#1 cb#1 cc#1 cd#1 ce#1] ;
     model ca:
          %ca#1%
          [a$1@15];
          %ca#2%
          [a$1@-15]; !for variable a;
    model cb:
          %cb#1%
          [b$1@15];
          %cb#2%
          [b$1@-15]; !for variable b;
    model cc:
          %cc#1%
          [c$1@15];
          %cc#2%
          [c$1@-15]; !for variable c;
    model cd:
          %cd#1%
          [d$1@15];
          %cd#2%
          [d$1@-15]; !for variable d;
    model ce:
          %ce#1%
          [e$1@15];
          %ce#2%
          [e$1@-15]; !for variable e;
FINAL CLASS COUNTS AND PROPORTIONS FOR EACH LATENT CLASS VARIABLE
BASED ON THE ESTIMATED MODEL

  Latent Class
    Variable    Class

    CA             1      2237.99976          0.43482
                   2      2909.00024          0.56518
    CB             1      2531.99976          0.49194
                   2      2615.00000          0.50806
    CC             1      2594.99976          0.50418
                   2      2552.00000          0.49582
    CD             1      2520.00000          0.48961
                   2      2627.00000          0.51039
    CE             1      2353.99976          0.45735
                   2      2793.00000          0.54265
LATENT TRANSITION PROBABILITIES BASED ON THE ESTIMATED MODEL

  CA Classes (Rows) by CB Classes (Columns)

            1        2

   1     0.718    0.282
   2     0.318    0.682

  CB Classes (Rows) by CC Classes (Columns)

            1        2

   1     0.715    0.285
   2     0.300    0.700

  CC Classes (Rows) by CD Classes (Columns)

            1        2

   1     0.704    0.296
   2     0.272    0.728

  CD Classes (Rows) by CE Classes (Columns)

            1        2

   1     0.686    0.314
   2     0.238    0.762

Table 3 on page 315.

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

  data:
    file is d:\alca\chap11.dat ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
          %overall%

       cb#1 on ca#1 (1);
       cc#1 on cb#1 (1);
       cd#1 on cc#1 (1);
       ce#1 on cd#1 (1);

       [ca#1];
       [cb#1 cc#1 cd#1 ce#1] (2);

     model ca:
          %ca#1%
          [a$1@15];
          %ca#2%
          [a$1@-15]; !for variable a;
    model cb:
          %cb#1%
          [b$1@15];
          %cb#2%
          [b$1@-15]; !for variable b;
    model cc:
          %cc#1%
          [c$1@15];
          %cc#2%
          [c$1@-15]; !for variable c;
    model cd:
          %cd#1%
          [d$1@15];
          %cd#2%
          [d$1@-15]; !for variable d;
    model ce:
          %ce#1%
          [e$1@15];
          %ce#2%
          [e$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 d:\alca\chap11.dat ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
          %overall%
       cb#1 on ca#1 ;
       cc#1 on cb#1 ;
       cd#1 on cc#1 ;
       ce#1 on cd#1 ;

      ! [ca#1 cb#1 cc#1 cd#1 ce#1] ;

     model ca:
          %ca#1%
          [a$1@15];
          %ca#2%
          [a$1@-15]; !for variable a;
    model cb:
          %cb#1%
          [b$1@15];
          %cb#2%
          [b$1@-15]; !for variable b;
    model cc:
          %cc#1%
          [c$1@15];
          %cc#2%
          [c$1@-15]; !for variable c;
    model cd:
          %cd#1%
          [d$1@15];
          %cd#2%
          [d$1@-15]; !for variable d;
    model ce:
          %ce#1%
          [e$1@15];
          %ce#2%
          [e$1@-15]; !for variable e;

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 3a (MS): MS Mover-Stayer with time homogenous transition probabilities. 

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

data:
    file is chap11_dat.txt ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
          %overall%
       cb#1 on ca#1 (1);
       cc#1 on cb#1 (1);
       cd#1 on cc#1 (1);
       ce#1 on cd#1 (1);
       [cb#1 cc#1 cd#1 ce#1] (2);
     model ca:
          %ca#1%
          [a$1]    (3);
          %ca#2%
          [a$1]    (4); !for variable a;
    model cb:
          %cb#1%
          [b$1]    (3);
          %cb#2%
          [b$1]    (4); !for variable b;
    model cc:
          %cc#1%
          [c$1]    (3);
          %cc#2%
          [c$1]    (4); !for variable c;
    model cd:
          %cd#1%
          [d$1]    (3);
          %cd#2%
          [d$1]    (4); !for variable d;
    model ce:
          %ce#1%
          [e$1]    (3);
          %ce#2%
          [e$1]    (4); !for variable e;
output: tech10;
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.txt ;
  variable:
    names are
      a b c d e count group;
    missing are all (-9999) ;
    usevariables are a b c d e count;
    weight is count (freq);
    categorical are a b c d e;
    classes = ca(2) cb(2) cc(2) cd(2) ce(2);
  analysis:
      type = mixture;
  model:
          %overall%
       cb#1 on ca#1 ;
       cc#1 on cb#1 ;
       cd#1 on cc#1 ;
       ce#1 on cd#1 ;
       [cb#1 cc#1 cd#1 ce#1] ;
     model ca:
          %ca#1%
          [a$1]    (3);
          %ca#2%
          [a$1]    (4); !for variable a;
    model cb:
          %cb#1%
          [b$1]    (3);
          %cb#2%
          [b$1]    (4); !for variable b;
    model cc:
          %cc#1%
          [c$1]    (3);
          %cc#2%
          [c$1]    (4); !for variable c;
    model cd:
          %cd#1%
          [d$1]    (3);
          %cd#2%
          [d$1]    (4); !for variable d;
    model ce:
          %ce#1%
          [e$1]    (3);
          %ce#2%
          [e$1]    (4); !for variable e;
output: tech10;
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

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.