Examples from the help file

The examples in help lca_entropy, run in full

The example at the end of help lca_entropy: a two-class latent class model on the Stata Press gsem_lca1 data (four binary items on risk taking), followed by the entropy statistic.

use http://www.stata-press.com/data/r15/gsem_lca1, clear
(Latent class analysis)
gsem ( -> accident play insurance stock), logit lclass(C 2)
Fitting class model:

Iteration 0:  (class) log likelihood = -149.71979  
Iteration 1:  (class) log likelihood = -149.71979  

Fitting outcome model:

Iteration 0:  (outcome) log likelihood = -403.97142  
Iteration 1:  (outcome) log likelihood = -398.15909  
Iteration 2:  (outcome) log likelihood = -397.81953  
Iteration 3:  (outcome) log likelihood =  -397.8164  
Iteration 4:  (outcome) log likelihood =  -397.8164  

Refining starting values:

Iteration 0:  (EM) log likelihood = -570.24204
Iteration 1:  (EM) log likelihood = -576.20485
Iteration 2:  (EM) log likelihood = -577.41464
Iteration 3:  (EM) log likelihood = -576.88554
Iteration 4:  (EM) log likelihood = -575.59242
Iteration 5:  (EM) log likelihood = -573.90567
Iteration 6:  (EM) log likelihood = -571.99868
Iteration 7:  (EM) log likelihood = -569.97482
Iteration 8:  (EM) log likelihood = -567.90955
Iteration 9:  (EM) log likelihood = -565.86392
Iteration 10: (EM) log likelihood = -563.88815
Iteration 11: (EM) log likelihood = -562.02165
Iteration 12: (EM) log likelihood = -560.29231
Iteration 13: (EM) log likelihood = -558.71641
Iteration 14: (EM) log likelihood = -557.29974
Iteration 15: (EM) log likelihood = -556.03949
Iteration 16: (EM) log likelihood = -554.92679
Iteration 17: (EM) log likelihood = -553.94914
Iteration 18: (EM) log likelihood = -553.09241
Iteration 19: (EM) log likelihood = -552.34233
Iteration 20: (EM) log likelihood = -551.68539
note: EM algorithm reached maximum iterations.

Fitting full model:

Iteration 0:  Log likelihood = -504.62913  
Iteration 1:  Log likelihood = -504.47255  
Iteration 2:  Log likelihood = -504.46773  
Iteration 3:  Log likelihood = -504.46767  
Iteration 4:  Log likelihood = -504.46767  

Generalized structural equation model                      Number of obs = 216
Log likelihood = -504.46767

------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
1.C          |  (base outcome)
-------------+----------------------------------------------------------------
2.C          |
       _cons |     -0.948      0.289   -3.285   0.001       -1.514      -0.382
------------------------------------------------------------------------------

Class:    1        

Response: accident 
Family:   Bernoulli
Link:     Logit    

Response: play     
Family:   Bernoulli
Link:     Logit    

Response: insurance
Family:   Bernoulli
Link:     Logit    

Response: stock    
Family:   Bernoulli
Link:     Logit    

------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
accident     |
       _cons |      0.913      0.197    4.623   0.000        0.526       1.300
-------------+----------------------------------------------------------------
play         |
       _cons |     -0.710      0.225   -3.156   0.002       -1.151      -0.269
-------------+----------------------------------------------------------------
insurance    |
       _cons |     -0.601      0.212   -2.833   0.005       -1.018      -0.185
-------------+----------------------------------------------------------------
stock        |
       _cons |     -1.880      0.334   -5.633   0.000       -2.534      -1.226
------------------------------------------------------------------------------

Class:    2        

Response: accident 
Family:   Bernoulli
Link:     Logit    

Response: play     
Family:   Bernoulli
Link:     Logit    

Response: insurance
Family:   Bernoulli
Link:     Logit    

Response: stock    
Family:   Bernoulli
Link:     Logit    

------------------------------------------------------------------------------
             | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
-------------+----------------------------------------------------------------
accident     |
       _cons |      4.983      3.746    1.330   0.183       -2.359      12.325
-------------+----------------------------------------------------------------
play         |
       _cons |      2.747      1.166    2.357   0.018        0.462       5.032
-------------+----------------------------------------------------------------
insurance    |
       _cons |      2.535      0.964    2.628   0.009        0.644       4.425
-------------+----------------------------------------------------------------
stock        |
       _cons |      1.203      0.536    2.244   0.025        0.153       2.254
------------------------------------------------------------------------------
lca_entropy
Entropy =  0.719

The statistic is returned in r(entropy), so it can be collected across models with different numbers of classes:

display r(entropy)
.71929768
Back to top