UCLA Academic Technology Services HomeServicesClassesContactJobs

Stat Computing > SAS > Textbook Examples > Latent Class Analysis

Search

SAS Textbook Examples
Latent Class Analysis by Allan L. McCutcheon

This page is still under construction!!

Note: the code on this page works with PROC LCA version 1.1.3 beta. PROC LCA is a user written by Lanza, Lemmon, Schafer and Collins from the Methodology Center at The Pennsylvania State University. It is available for download.

The fit statistic labeled G-squared in the PROC LCA output is equivalent to the fit statistic McCutcheon labels L-squared.


Page 16 data file The data are shown on page 16, and the probabilities are shown at the bottom of page 15. . Also, we have included all of the output for this analysis only. For all other analyses, we will limit the output presented only to relevant parts.

proc lca data = mcc.page16;
nclass 2;
items a b c;
categories 2 2 2; 
freq w;
seed 123456 ;
run;

                   Data Summary, Model Information, and Fit Statistics (EM Algorithm)

Data aggregated by response pattern: 300.00 subjects and 8 unique response patterns

Number of measurement items:             3
Response categories per item:            2 2 2
Number of groups in the data:            1
Number of latent classes:                2
Rho starting values were randomly generated (seed = 123456).

No parameter restrictions were specified (freely estimated).

The model converged in 1262 iterations.

Maximum number of iterations: 5000
Convergence method: maximum absolute deviation (MAD)
Convergence criterion:  0.000001000

=============================================
Fit statistics:
=============================================

Log-likelihood:      -565.59
G-squared:              0.00
AIC:                   14.00
BIC:                   39.93
Degrees of freedom:        0

                            Parameter Estimates

Gamma estimates (class membership probabilities):
Class:                     1          2
                      0.5002     0.4998

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2
  a           :       0.3330     0.6671
  b           :       0.1995     0.7006
  c           :       0.0013     0.9990

  Response category  2:
Class:                     1          2
  a           :       0.6670     0.3329
  b           :       0.8005     0.2994
  c           :       0.9987     0.0010

Page 33, Table 3.2 data file.

Complete independence (single-class) model.

Note: Fit statistics match, but this model reports only 29 degrees of freedom versus the 35 listed in Table 3.2.

proc lca data = mcc.page33;
nclass 1;
items p a u c;
categories 3 2 2 3; 
freq wt;
seed 123456 ;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2872.23
G-squared:            257.26
AIC:                  269.26
BIC:                  299.81
Degrees of freedom:       29


Gamma estimates (class membership probabilities):
Class:                     1
                      1.0000

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1
  p           :       0.7646
  a           :       0.5200
  u           :       0.8153
  c           :       0.8386

  Response category  2:
Class:                     1
  p           :       0.0865
  a           :       0.4800
  u           :       0.1847
  c           :       0.1323

  Response category  3:
Class:                     1
  p           :       0.1489
  c           :       0.0291

Two-class model.

proc lca data = mcc.page33;
nclass 2;
items p a u c;
categories 3 2 2 3; 
freq wt;
seed 123456 ;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2783.27
G-squared:             79.34
AIC:                  105.34
BIC:                  171.53
Degrees of freedom:       22


Gamma estimates (class membership probabilities):
Class:                     1          2
                      0.8077     0.1923

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2
  p           :       0.8953     0.2155
  a           :       0.6367     0.0298
  u           :       0.8327     0.7422
  c           :       0.8840     0.6478

  Response category  2:
Class:                     1          2
  p           :       0.0579     0.2066
  a           :       0.3633     0.9702
  u           :       0.1673     0.2578
  c           :       0.1043     0.2498

  Response category  3:
Class:                     1          2
  p           :       0.0468     0.5780
  c           :       0.0117     0.1024
 

An unconstrained three class model will not converge to the values reported in Tables 3.2 and 3.3 using PROC LCA. Constraining the probability of a respondent in the "ideal" class was judged to be impatient or hostile (c=3) equal to zero allows the model to converge to the values close to those shown in the text.

* constraints ;
data mcc.pg33_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  . 1   1   1

RHO   1  p 1  1   1   1
RHO   1  a 1  1   1   1
RHO   1  u 1  1   1   1
RHO   1  c 1  1   1   1

RHO   1  p 2  1   1   1
RHO   1  a 2  1   1   1
RHO   1  u 2  1   1   1
RHO   1  c 2  1   1   1

RHO   1  p 3  1   1   1
RHO   1  a 3  .   .   .
RHO   1  u 3  .   .   .
RHO   1  c 3  0   1   1
;
run;

* Starting values;
data mcc.pg33_start;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  .  .6  .2   .2 

RHO   1  p 1   .8  .8   .1
RHO   1  a 1   .5  .5   .1
RHO   1  u 1   .9  .35  .5
RHO   1  c 1   .9  .6  .65

RHO   1  p 2  .1   .1   .1
RHO   1  a 2  .5   .5   .9
RHO   1  u 2  .1   .65  .5
RHO   1  c 2  .1   .35  .25

RHO   1  p 3   .1  .1   .8
RHO   1  a 3   .   .    .
RHO   1  u 3   .   .    .
RHO   1  c 3   0  .05   .1
;
run;

proc lca data = mcc.page33 start = mcc.pg33_start
restrict = mcc.pg33_constraints;
nclass 3;
items p a u c;
categories 3 2 2 3; 
freq wt;
run;
 
=============================================
Fit statistics:
=============================================

Log-likelihood:     -2754.55
G-squared:             21.89
AIC:                   59.89
BIC:                  156.64
Degrees of freedom:       16

Gamma estimates (class membership probabilities):
Class:                     1          2          3
                      0.6208     0.2069     0.1723

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3
  p           :       0.8881     0.9117     0.1427
  a           :       0.6130     0.6478     0.0313
  u           :       1.0000     0.3130     0.7531
  c           :       0.9431     0.6897     0.6410

  Response category  2:
Class:                     1          2          3
  p           :       0.0532     0.0716     0.2246
  a           :       0.3870     0.3522     0.9687
  u           :       0.0000     0.6870     0.2469
  c           :       0.0569     0.2554     0.2561

  Response category  3:
Class:                     1          2          3
  p           :       0.0587     0.0167     0.6327
  c           :       0.0000     0.0550     0.1030

Page 40, Table 3.4.

Unrestricted three-class model - please see the analysis immediately above. (Note that the above mode contains some restrictions for identification purposes.)

Three-class model with specific value restrictions.

* P(A=2|c=3) = 1  All skeptics think surveys are "not true"
* P(U=1|c=1) = 1  All idea have a "good" understanding
* P(C=3|c=1) = 0  No ideal respondents are "impatient or hostile" for coop. 
* NOTE: in previous model P(C=3|c=1) = 0 was set;

* Constraints ;
 data mcc.pg40_constraints_1
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  . 1   1   1

RHO   1  p 1  1   1   1
RHO   1  a 1  1   1   0
RHO   1  u 1  0   1   1
RHO   1  c 1  1   1   1

RHO   1  p 2  1   1   1
RHO   1  a 2  1   1   0
RHO   1  u 2  0   1   1
RHO   1  c 2  1   1   1

RHO   1  p 3  1   1   1
RHO   1  a 3  .   .   .
RHO   1  u 3  .   .   .
RHO   1  c 3  0   1   1
;
run;

* Starting values;
data mcc.pg40_start_1;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  .  .6  .2   .2 

RHO   1  p 1   .8  .8   .1
RHO   1  a 1   .5  .6   0
RHO   1  u 1   1   .35  .5
RHO   1  c 1   .8  .6   .8

RHO   1  p 2  .1   .1   .1
RHO   1  a 2  .5   .4   1
RHO   1  u 2  0   .65   .5
RHO   1  c 2  .2  .3    .1

RHO   1  p 3  .1   .1   .8
RHO   1  a 3   .   .    .
RHO   1  u 3   .   .    .
RHO   1  c 3   0   .1   .1
;
run;

proc lca data = mcc.page33 start = mcc.pg40_start_1
restrict = mcc.pg40_constraints_1;
nclass 3;
items p a u c;
categories 3 2 2 3; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2754.67
G-squared:             22.13
AIC:                   56.13
BIC:                  142.69
Degrees of freedom:       18


Gamma estimates (class membership probabilities):
Class:                     1          2          3
                      0.6216     0.2167     0.1617

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3
  p           :       0.8824     0.8970     0.1343
  a           :       0.6115     0.6454     0.0000
  u           :       1.0000     0.3317     0.7534
  c           :       0.9430     0.6864     0.6412

  Response category  2:
Class:                     1          2          3
  p           :       0.0543     0.0769     0.2234
  a           :       0.3885     0.3546     1.0000
  u           :       0.0000     0.6683     0.2466
  c           :       0.0570     0.2580     0.2533

  Response category  3:
Class:                     1          2          3
  p           :       0.0633     0.0261     0.6424
  c           :       0.0000     0.0556     0.1055

Three-class model with specific value restrictions and equality restrictions.

* Equality constraints
* P(A=1|c=1) = P(A=1|c=2)  ideal and believer r's equally 
*    likely to say survey acuracy is "true"
* P(P=1|c=1) = P(P=1|c=2)  ideal and believer r's equally
*    likely to say the purpose of surveys are "good"
* P(P=2|c=1) = P(P=2|c=2)  ideal and believer r's equally 
*    likely to say the purpose of surveys are "depends";

* Constraints ;
data mcc.pg40_constraints_2;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  . 1   1   1

RHO   1  p 1  3   3   1
RHO   1  a 1  2   2   0
RHO   1  u 1  0   1   1
RHO   1  c 1  1   1   1

RHO   1  p 2  4   4   1
RHO   1  a 2  1   1   0
RHO   1  u 2  0   1   1
RHO   1  c 2  1   1   1

RHO   1  p 3  1   1   1
RHO   1  a 3  .   .   .
RHO   1  u 3  .   .   .
RHO   1  c 3  0   1   1
;
run;

* Starting values;
data mcc.pg40_start_2;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA 1  .  .  .6  .2   .2 

RHO   1  p 1   .8  .8   .1
RHO   1  a 1   .8  .8    0
RHO   1  u 1   1   .35  .5
RHO   1  c 1   .8  .6   .8

RHO   1  p 2  .1   .1   .1
RHO   1  a 2  .2   .2   1
RHO   1  u 2  0    .65  .5
RHO   1  c 2  .2   .3   .1

RHO   1  p 3  .1   .1   .8
RHO   1  a 3   .   .    .
RHO   1  u 3   .   .    .
RHO   1  c 3   0   .1   .1
;
run;

proc lca data = mcc.page33 start = mcc.pg40_start_2
restrict = mcc.pg40_constraints_2;
nclass 3;
items p a u c;
categories 3 2 2 3; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2756.39
G-squared:             25.59
AIC:                   53.59
BIC:                  124.87
Degrees of freedom:       21


Gamma estimates (class membership probabilities):
Class:                     1          2          3
                      0.6196     0.2225     0.1578

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3
  p           :       0.8872     0.8872     0.1103
  a           :       0.6174     0.6174     0.0000
  u           :       1.0000     0.3366     0.7652
  c           :       0.9430     0.6826     0.6488

  Response category  2:
Class:                     1          2          3
  p           :       0.0600     0.0600     0.2283
  a           :       0.3826     0.3826     1.0000
  u           :       0.0000     0.6634     0.2348
  c           :       0.0570     0.2597     0.2481

  Response category  3:
Class:                     1          2          3
  p           :       0.0529     0.0529     0.6614
  c           :       0.0000     0.0577     0.1031

Page 47 data file.

In file no = 1, yes = 2. In book, yes = 1, no = 2.

Single-class model in Table 4.2.

proc lca data = mcc.page47;
nclass 1;
items w a i v;
categories 2 2 2 2; 
freq wt;
seed 12345;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2346.67
G-squared:            262.27
AIC:                  270.27
BIC:                  291.25
Degrees of freedom:       11


Gamma estimates (class membership probabilities):
Class:                     1
                      1.0000

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1
  w           :       0.9643
  a           :       0.9244
  i           :       0.6377
  v           :       0.2846

  Response category  2:
Class:                     1
  w           :       0.0357
  a           :       0.0756
  i           :       0.3623
  v           :       0.7154

Proctor's Model.

data mcc.proctor_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5;
	datalines;
GAMMA  1  .  .   1   1   1   1   1 

RHO    1  w 1  2   2   2   2   1
RHO    1  a 1  2   2   2   1   1
RHO    1  i 1  2   2   1   1   1
RHO    1  v 1  2   1   1   1   1

RHO    1  w 2  1   1   1   1   2
RHO    1  a 2  1   1   1   2   2
RHO    1  i 2  1   1   2   2   2
RHO    1  v 2  1   2   2   2   2
;
run;

*start values;
* remember that for variable = 1, above diagonals are correct anwsers
below is error;
data mcc.proctor_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5;
	datalines;
GAMMA 1  .  .   .05  .05  .25  .4   .25

RHO   1    w 1  .8   .8   .8   .8   .2
RHO   1    a 1  .8   .8   .8   .2   .2
RHO   1    i 1  .8   .8   .2   .2   .2
RHO   1    v 1  .8   .2   .2   .2   .2

RHO   1    w 2  .2   .2   .2   .2   .8
RHO   1    a 2  .2   .2   .2   .8   .8
RHO   1    i 2  .2   .2   .8   .8   .8
RHO   1    v 2  .2   .8   .8   .8   .8
;
run;

proc lca data = mcc.page47 start = mcc.proctor_starts
restrict =mcc.proctor_constraints;
nclass 5;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2284.64
G-squared:            138.19
AIC:                  148.19
BIC:                  174.42
Degrees of freedom:       10


Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5
                      0.2430     0.4259     0.2919     0.0191     0.0201

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5
  w           :       0.9545     0.9545     0.9545     0.9545     0.0455
  a           :       0.9545     0.9545     0.9545     0.0455     0.0455
  i           :       0.9545     0.9545     0.0455     0.0455     0.0455
  v           :       0.9545     0.0455     0.0455     0.0455     0.0455

  Response category  2:
Class:                     1          2          3          4          5
  w           :       0.0455     0.0455     0.0455     0.0455     0.9545
  a           :       0.0455     0.0455     0.0455     0.9545     0.9545
  i           :       0.0455     0.0455     0.9545     0.9545     0.9545
  v           :       0.0455     0.9545     0.9545     0.9545     0.9545

Item-specific error rates.


 * Constraint is that each item has the same error rate across classes;
data mcc.iser_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5;
	datalines;
GAMMA 1  .  .  1   1   1   1   1 

RHO    1  w 1  2   2   2   2   1
RHO    1  a 1  3   3   3   1   1
RHO    1  i 1  4   4   1   1   1
RHO    1  v 1  5   1   1   1   1

RHO    1  w 2  1   1   1   1   2
RHO    1  a 2  1   1   1   3   3
RHO    1  i 2  1   1   4   4   4
RHO    1  v 2  1   5   5   5   5
;
run;

* Note starts for this model are the same as the proctor starts for consistancy;
proc lca data = mcc.page47 start = mcc.proctor_starts
restrict =mcc.iser_constraints;
nclass 5;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2233.79
G-squared:             36.50
AIC:                   52.50
BIC:                   94.47
Degrees of freedom:        7



Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5
                      0.2845     0.4578     0.2030     0.0331     0.0216

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5
  w           :       0.9853     0.9853     0.9853     0.9853     0.0147
  a           :       0.9750     0.9750     0.9750     0.0250     0.0250
  i           :       0.7871     0.7871     0.2129     0.2129     0.2129
  v           :       0.9999     0.0001     0.0001     0.0001     0.0001

  Response category  2:
Class:                     1          2          3          4          5
  w           :       0.0147     0.0147     0.0147     0.0147     0.9853
  a           :       0.0250     0.0250     0.0250     0.9750     0.9750
  i           :       0.2129     0.2129     0.7871     0.7871     0.7871
  v           :       0.0001     0.9999     0.9999     0.9999     0.9999

True-type-specific error rates.

The text reports one more degree of freedom than the output for this model does because the book counts parameters estimated to be zero as fixed.

* Set constraints;
* constraint is that each class has the same error rate across items;
data mcc.ttser_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5;
	datalines;
GAMMA  1 .  .  1   1   1   1   1 

RHO    1  w 1  2   3   4   5   1
RHO    1  a 1  2   3   4   1   1
RHO    1  i 1  2   3   1   1   1
RHO    1  v 1  2   1   1   1   1

RHO    1  w 2  1   1   1   1   6
RHO    1  a 2  1   1   1   5   6
RHO    1  i 2  1   1   4   5   6
RHO    1  v 2  1   3   4   5   6
;
run;

* Note starts for this model are the same as the proctor starts for consistancy;
proc lca data = mcc.page47 start = mcc.proctor_starts
restrict =mcc.ttser_constraints;
nclass 5;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;
=============================================
Fit statistics:
=============================================

Log-likelihood:     -2260.05
G-squared:             89.02
AIC:                  107.02
BIC:                  154.23
Degrees of freedom:        6


Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5
                      0.2145     0.3962     0.3691     0.0046     0.0156

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5
  w           :       0.9932     0.9750     0.8959     0.8269     0.0000
  a           :       0.9932     0.9750     0.8959     0.1731     0.0000
  i           :       0.9932     0.9750     0.1041     0.1731     0.0000
  v           :       0.9932     0.0250     0.1041     0.1731     0.0000

  Response category  2:
Class:                     1          2          3          4          5
  w           :       0.0068     0.0250     0.1041     0.1731     1.0000
  a           :       0.0068     0.0250     0.1041     0.8269     1.0000
  i           :       0.0068     0.0250     0.8959     0.8269     1.0000
  v           :       0.0068     0.9750     0.8959     0.8269     1.000

Lazardfeld's Latent Distance Model

Class proportions appears in Table 4.5, on page 56.


* Constraint is that except for the end points (most extreme items) all "correct" yeses have
* the same error rate for each item, and all "correct" nos have the correct error rate for each
* item. See page 55;

* Constraints;
data mcc.laz_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5;
	datalines;
GAMMA 1   . .  1   1   1   1   1 

RHO    1  w 1  2   2   2   2   1
RHO    1  a 1  3   3   3   1   1
RHO    1  i 1  4   4   1   1   1
RHO    1  v 1  5   1   1   1   1

RHO    1  w 2  1   1   1   1   2
RHO    1  a 2  1   1   1   7   7
RHO    1  i 2  1   1   6   6   6
RHO    1  v 2  1   5   5   5   5
;
run;

* Note starts for this model are the same as the proctor starts for consistancy;

proc lca data = mcc.page47 start = mcc.proctor_starts
restrict =mcc.ttser_constraints;
nclass 5;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2222.92
G-squared:             14.76
AIC:                   34.76
BIC:                   87.21
Degrees of freedom:        5



Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5
                      0.2846     0.4784     0.1551     0.0484     0.0335

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5
  w           :       0.9977     0.9977     0.9977     0.9977     0.0023
  a           :       0.9726     0.9726     0.9726     0.3843     0.3843
  i           :       0.7845     0.7845     0.1651     0.1651     0.1651
  v           :       1.0000     0.0000     0.0000     0.0000     0.0000

  Response category  2:
Class:                     1          2          3          4          5
  w           :       0.0023     0.0023     0.0023     0.0023     0.9977
  a           :       0.0274     0.0274     0.0274     0.6157     0.6157
  i           :       0.2155     0.2155     0.8349     0.8349     0.8349
  v           :       0.0000     1.0000     1.0000     1.0000     1.000

Page 58, Table 4.6, uses the same data as the previous example.

Intrinsically unscalable. This model has the same number of degrees of freedom as the model in the text, however, the G-squared and L-squared statistics (fit statistics) do not match.


* The constraint is that there are no errors, that is, probabilities are equal to either zero or one.

*  constraints;
data mcc.goodman_v1_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6;
	datalines;
GAMMA 1  .  .   1   1   1   1   1   1

RHO   1  w  1   0   0   0   0   0   1
RHO   1  a  1   0   0   0   0   0   1
RHO   1  i  1   0   0	0   0   0   1
RHO   1  v  1   0   0	0   0   0   1

RHO   1  w  2   0   0   0   0   0   1
RHO   1  a  2   0   0   0   0   0   1
RHO   1  i  2   0   0   0   0   0   1
RHO   1  v  2   0   0   0   0   0   1
;
run;

* starting values ;
data mcc.goodman_v1_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6;
	datalines;
GAMMA 1  .  .  .2211 .3873 .2418 .0285 .0193 .102

RHO   1  w  1   1     0     0     0     0    .5
RHO   1  a  1   1     1     0     0     0    .5
RHO   1  i  1   1     1     1     0     0    .5
RHO   1  v  1   1     1     1     1     0    .5

RHO   1  w  2   0     1     1     1     1    .5
RHO   1  a  2   0     0     1     1     1    .5
RHO   1  i  2   0     0     0     1     1    .5
RHO   1  v  2   0     0     0     0     1    .5
;
run;

proc lca data = mcc.page47 start = mcc.goodman_v1_starts
restrict =mcc.goodman_v1_constraints;
nclass 6;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2233.72
G-squared:             36.35
AIC:                   54.35
BIC:                  101.57
Degrees of freedom:        6



Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5          6
                      0.1475     0.0000     0.0000     0.0000     0.0189     0.8336

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5          6
  w           :       1.0000     0.0000     0.0000     0.0000     0.0000     0.9798
  a           :       1.0000     1.0000     0.0000     0.0000     0.0000     0.9319
  i           :       1.0000     1.0000     1.0000     0.0000     0.0000     0.5880
  v           :       1.0000     1.0000     1.0000     1.0000     0.0000     0.1644

  Response category  2:
Class:                     1          2          3          4          5          6
  w           :       0.0000     1.0000     1.0000     1.0000     1.0000     0.0202
  a           :       0.0000     0.0000     1.0000     1.0000     1.0000     0.0681
  i           :       0.0000     0.0000     0.0000     1.0000     1.0000     0.4120
  v           :       0.0000     0.0000     0.0000     0.0000     1.0000     0.8356
  

The Proctor-Goodman Model. This model has the same number of degrees of freedom as the model in the text, however, the G-squared and L-squared statistics (fit statistics) do not match. The solution places 83% of respondents into the unscalable class, this is inconsistant with the raw data, which shows most respondents conform to one of the patterns. Varrying starting values did not allow the model to converge to another solution.

* constant error rates, no restrictions on unscalable class;

* constraints ;
data mcc.goodman_v2_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6;
	datalines;
GAMMA 1  .  .   1   1   1   1   1   1

RHO   1  w  1   2   3   3   3   3   1
RHO   1  a  1   2   2   3   3   3   1
RHO   1  i  1   2   2   2   3   3   1
RHO   1  v  1   2   2   2   2   3   1

RHO   1  w  2   3   2   2   2   2   1
RHO   1  a  2   3   3   2   2   2   1
RHO   1  i  2   3   3   3   2   2   1
RHO   1  v  2   3   3   3   3   2   1
;
run;

* starting values ;
* Starting values for gammas equal to the proportion of respondents in each class based
on frequency tables on page 47.;
data mcc.goodman_v2_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6;
	datalines;
GAMMA 1  .  .  .2211 .3873 .2418 .0285 .0193 .102

RHO   1  w  1  .7    .3    .3    .3    .3    .5
RHO   1  a  1  .7    .7    .3    .3    .3    .5
RHO   1  i  1  .7    .7    .7    .3    .3    .5
RHO   1  v  1  .7    .7    .7    .7    .3    .5

RHO   1  w  2  .3    .7    .7    .7    .7    .5
RHO   1  a  2  .3    .3    .7    .7    .7    .5
RHO   1  i  2  .3    .3    .3    .7    .7    .5
RHO   1  v  2  .3    .3    .3    .3    .7    .5
;
run;

proc lca data = mcc.page47 start = mcc.goodman_v2_starts
restrict = mcc.goodman_v2_constraints;
nclass 6;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -2233.72
G-squared:             36.36
AIC:                   56.36
BIC:                  108.81
Degrees of freedom:        5


Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5          6
                      0.1475     0.0000     0.0000     0.0000     0.0189     0.8336

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5          6
  w           :       1.0000     0.0000     0.0000     0.0000     0.0000     0.9798
  a           :       1.0000     1.0000     0.0000     0.0000     0.0000     0.9319
  i           :       1.0000     1.0000     1.0000     0.0000     0.0000     0.5880
  v           :       1.0000     1.0000     1.0000     1.0000     0.0000     0.1644

  Response category  2:
Class:                     1          2          3          4          5          6
  w           :       0.0000     1.0000     1.0000     1.0000     1.0000     0.0202
  a           :       0.0000     0.0000     1.0000     1.0000     1.0000     0.0681
  i           :       0.0000     0.0000     0.0000     1.0000     1.0000     0.4120
  v           :       0.0000     0.0000     0.0000     0.0000     1.0000     0.8356

The Biform scale model. This model has the same number of degrees of freedom as the model in the text, however, the G-squared and L-squared statistics (fit statistics) do not match. Further, the solution is not consistent with the raw data.

* constraints ;
* alows patterns (1111) (1112) (1122) (1222) (2222) AND (1121) plus one unconstrained class;
* in book NYNN = (2122) 
* Total number of classes = 7
* Error rate is constant among six scalable types;

* constraints ;
data mcc.goodman_v3_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6 estc7;
	datalines;

GAMMA 1  .  .   1   1   1   1   1   1   1

RHO   1  w  1   1   1	1   1   0   1   1
RHO   1  a  1   1   1   1   0   0   1   1
RHO   1  i  1   1   1   0   0   0   0   1
RHO   1  v  1   1   0   0   0   0   1   1

RHO   1  w  2   0   0   0   0   1   0   1
RHO   1  a  2   0   0   0   1   1   0   1
RHO   1  i  2   0   0   1   1   1   1   1
RHO   1  v  2   0   1   1   1   1   0   1
;
run;

* starting values ;
data mcc.goodman_v3_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6 estc7;
	datalines;
GAMMA 1  .  .   .142 .142 .142 .142 .142 .142 .148

RHO   1  w  1    1    1    1    1    0    1    .5
RHO   1  a  1    1    1    1    0    0    1    .5
RHO   1  i  1    1    1    0    0    0    0    .5
RHO   1  v  1    1    0    0    0    0    1    .5

RHO   1  w  2    0    0    0    0    1    0    .5
RHO   1  a  2    0    0    0    1    1    0    .5
RHO   1  i  2    0    0    1    1    1    1    .5
RHO   1  v  2    0    1    1    1    1    0    .5

;
run;

proc lca data = mcc.page47 start = mcc.goodman_v3_starts
restrict = mcc.goodman_v3_constraints;
nclass 7;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -2218.92
G-squared:              6.76
AIC:                   26.76
BIC:                   79.22
Degrees of freedom:        5


Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5          6          7
                      0.2153     0.2931     0.1003     0.0000     0.0174     0.0504     0.3235

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5          6          7
  w           :       1.0000     1.0000     1.0000     1.0000     0.0000     1.0000     0.9435
  a           :       1.0000     1.0000     1.0000     0.0000     0.0000     1.0000     0.8201
  i           :       1.0000     1.0000     0.0000     0.0000     0.0000     0.0000     0.3996
  v           :       1.0000     0.0000     0.0000     0.0000     0.0000     1.0000     0.0585

  Response category  2:
Class:                     1          2          3          4          5          6          7
  w           :       0.0000     0.0000     0.0000     0.0000     1.0000     0.0000     0.0565
  a           :       0.0000     0.0000     0.0000     1.0000     1.0000     0.0000     0.1799
  i           :       0.0000     0.0000     1.0000     1.0000     1.0000     1.0000     0.6004
  v           :       0.0000     1.0000     1.0000     1.0000     1.0000     0.0000     0.9415

Biform scale with Type 2 excluded.

* Biform model minus class 2 (pattern is YYYN in book, but NYYY (1222) in our dataset)  order = waiv

* constraints ;
data mcc.goodman_v3_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6 ;
	datalines;
GAMMA 1  .  .   1   1   1   1   1   1

RHO   1  w  1   1   1   1   0   1   1
RHO   1  a  1   1   1   1   0   1   1
RHO   1  i  1   1   1   0   0   0   1
RHO   1  v  1   1   0   0   0   1   1

RHO   1  w  2   0   0   0   1   0   1
RHO   1  a  2   0   0   0   1   0   1
RHO   1  i  2   0   0   1   1   1   1
RHO   1  v  2   0   1   1   1   0   1
;
run;


* starting values ;
data mcc.goodman_v3_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 est1c4 estc5 estc6;
	datalines;
GAMMA 1  .  .   .166 .166 .166 .166 .166  .17

RHO   1  w  1    1    1    1    0    1    .5
RHO   1  a  1    1    1    1    0    1    .5
RHO   1  i  1    1    1    0    0    0    .5
RHO   1  v  1    1    0    0    0    1    .5

RHO   1  w  2    0    0    0    1    0    .5
RHO   1  a  2    0    0    0    1    0    .5
RHO   1  i  2    0    0    1    1    1    .5
RHO   1  v  2    0    1    1    1    0    .5
;
run;

proc lca data = mcc.page47 start = mcc.goodman_v3b_starts
restrict = mcc.goodman_v3_constraints;
nclass 6;
items w a i v;
categories 2 2 2 2; 
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -2218.92
G-squared:              6.76
AIC:                   24.76
BIC:                   71.97
Degrees of freedom:        6


Gamma estimates (class membership probabilities):
Class:                     1          2          3          4          5          6
                      0.2153     0.2931     0.1003     0.0174     0.0504     0.3235

Rho estimates (item response probabilities):
  Response category  1:
Class:                     1          2          3          4          5          6
  w           :       1.0000     1.0000     1.0000     0.0000     1.0000     0.9435
  a           :       1.0000     1.0000     1.0000     0.0000     1.0000     0.8201
  i           :       1.0000     1.0000     0.0000     0.0000     0.0000     0.3996
  v           :       1.0000     0.0000     0.0000     0.0000     1.0000     0.0585

  Response category  2:
Class:                     1          2          3          4          5          6
  w           :       0.0000     0.0000     0.0000     1.0000     0.0000     0.0565
  a           :       0.0000     0.0000     0.0000     1.0000     0.0000     0.1799
  i           :       0.0000     0.0000     1.0000     1.0000     1.0000     0.6004
  v           :       0.0000     1.0000     1.0000     1.0000     0.0000     0.9415

Page 70 data file.

Unrestricted, Heterogeneous, T-class Model. This model does not converge to the proper solution without restrictions. Degrees of freedom in input does not match the degrees of freedom listed in the text, however, results are otherwise consistent.

* Constraints: 
	P(u=2|c=1,g=1) = 0 
	P(c=3|c=1,g=1) = 0 
	P(a=1|c=3,g=2) = 0;

* constraints;
data mcc.twogroup_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA	1   .   .   1   1   1
GAMMA	2   .   .   1   1   1

RHO     1   p   1   1   1   1
RHO     1   a   1   1   1   1
RHO     1   c   1   1   1   1
RHO     1   u   1   1   1   1

RHO     1   p   2   1   1   1
RHO     1   a   2   1   1   1
RHO     1   c   2   1   1   1
RHO     1   u   2   0   1   1

RHO     1   p   3   1   1   1
RHO     1   a   3   0   0   0
RHO     1   c   3   0   1   1
RHO    	1   u   3   0   0   0

RHO     2   p   1   1   1   1
RHO     2   a   1   1   1   1
RHO     2   c   1   1   1   1
RHO     2   u   1   1   1   1

RHO     2   p   2   1   1   1
RHO     2   a   2   1   1   1
RHO     2   c   2   1   1   0
RHO     2   u   2   1   1   1

RHO     2   p   3   1   1   1
RHO     2   a   3   0   0   0
RHO     2   c   3   1   1   1
RHO     2   u   3   0   0   0
;
run;


data mcc.twogroup_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA	1   .   .   .33   .33   .34
GAMMA	2   .   .   .33   .33   .34

RHO     1   p   1   .33   .33   .6
RHO     1   a   1   .5    .5    .5
RHO     1   c   1   .5    .33   .33
RHO     1   u   1   1     .5    .5

RHO     1   p   2   .33   .33   .2
RHO     1   a   2   .5    .5    .5
RHO     1   c   2   .5    .33   .33
RHO     1   u   2   0     .5    .5

RHO     1   p   3   .34   .34   .2
RHO     1   a   3   0     0     0
RHO     1   c	3   0     .34   .34
RHO     1   u   3   0     0     0

RHO     2   p   1   .6   .33   .33
RHO     2   a   1   .5   .5    0
RHO     2   c   1   .33  .33   .33
RHO     2   u   1   .9   .5    .5

RHO     2   p   2   .2   .33   .33
RHO     2   a   2   .5   .5    1
RHO     2   c   2   .33  .33   .33
RHO     2   u   2   .1   .5    .5

RHO     2   p   3   .2   .34   .34
RHO     2   a   3   0    0     0
RHO     2   c   3   .34  .34   .34
RHO     2   u   3   0    0     0
;
run;


proc lca data = mcc.page70 start = mcc.twogroup_starts
restrict = mcc.twogroup_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3890.75
G-squared:             40.86
AIC:                  114.86
BIC:                  314.95
Degrees of freedom:       34


Gamma estimates (class membership probabilities):
Class:                     1          2          3
  Group      1:       0.6208     0.1723     0.2070
  Group      2:       0.4874     0.3577     0.1549

Rho estimates (item response probabilities):
  Group      1:
  Response category  1:
Class:                     1          2          3
  p           :       0.8881     0.1427     0.9117
  a           :       0.6130     0.0313     0.6478
  c           :       0.9431     0.6410     0.6897
  u           :       1.0000     0.7531     0.3131

  Response category  2:
Class:                     1          2          3
  p           :       0.0532     0.2246     0.0716
  a           :       0.3870     0.9687     0.3522
  c           :       0.0569     0.2561     0.2553
  u           :       0.0000     0.2469     0.6869

  Response category  3:
Class:                     1          2          3
  p           :       0.0587     0.6327     0.0167
  c           :       0.0000     0.1030     0.0550

  Group      2:
  Response category  1:
Class:                     1          2          3
  p           :       0.8440     0.9140     0.1297
  a           :       0.5133     0.6391     0.0000
  c           :       0.9961     0.5622     0.5571
  u           :       0.9549     0.4054     0.6517

  Response category  2:
Class:                     1          2          3
  p           :       0.0933     0.0445     0.1525
  a           :       0.4867     0.3609     1.0000
  c           :       0.0000     0.3639     0.3300
  u           :       0.0451     0.5946     0.3483

  Response category  3:
Class:                     1          2          3
  p           :       0.0627     0.0415     0.7178
  c           :       0.0039     0.0739     0.1129

Partial Homogeneity Models

H1:

*Constraints are:
* p(a=1|g=1,c=3) = p(a=1|g=2,c=3) = p(c=3|g=1,c=1) = p(c=3|g=2,c=1)
  = p(u=2|g=1,c=1) = p(u=2|g=2,c=1) = 0 ;
  
* constraints ;
  data mcc.twogroup_H1_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   1   1   1
RHO      1   a   1   1   1   0
RHO      1   c   1   1   1   1
RHO      1   u   1   1   1   1

RHO      1   p   2   1   1   1
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   1
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   1   1
RHO      1   u   3   0   0   0

RHO      2   p   1   1   1   1
RHO      2   a   1   1   1   0
RHO      2   c   1   1   1   1
RHO      2   u   1   1   1   1

RHO      2   p   2   1   1   1
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   1
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   1   1
RHO      2   u   3   0   0   0
;
run;

* Starting values;
data mcc.twogroup_H1_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA   1   .   .   .4   .4   .2
GAMMA   2   .   .   .4   .4   .2

RHO     1   p   1   .33  .33  .6
RHO     1   a   1   .5   .5   0
RHO     1   c   1   .5   .45  .33
RHO     1   u   1   1    .5   .5

RHO     1   p   2   .33  .33  .2
RHO     1   a   2   .5   .5   1
RHO     1   c   2   .5   .45  .33
RHO     1   u   2   0    .5   .5

RHO     1   p   3   .34  .34   .2
RHO     1   a   3   0    0     0
RHO     1   c   3   0    .1    .34
RHO     1   u   3   0    0     0

RHO     2   p   1   .8   .8    .33
RHO     2   a   1   .5   .5    0
RHO     2   c   1   .8   .33   .33
RHO     2   u   1   1    .5    .5

RHO     2   p   2   .1   .1   .33
RHO     2   a   2   .5   .5   1
RHO     2   c   2   .2   .33  .33
RHO     2   u   2   0    .5   .5

RHO      2   p   3  .1   .1   .34
RHO      1   a   3  0    0    0
RHO      2   c   3  0    .34  .34
RHO      1   u   3  0    0    0
;
run;


proc lca data = mcc.page70 start = mcc.twogroup_H1_starts
restrict = mcc.twogroup_H1_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3890.29
G-squared:             39.95
AIC:                  107.95
BIC:                  291.82
Degrees of freedom:       37

H2:

* All H1 constraints plus:
* Note, values in are the constraint number used to constrain the parameters to equality.
* (2) p(p=1|g=1,c=1) = p(p=1|g=2,c=1)  
* (3) p(p=1|g=1,c=2) = p(p=1|g=2,c=2)
* (4) p(p=1|g=1,c=3) = p(p=1|g=2,c=3)
* (5) p(c=1|g=1,c=3) = p(c=1|g=2,c=3) 
* (6) p(c=2|g=1,c=3) = p(c=2|g=2,c=3) ;

* constraints ;
data mcc.twogroup_H2_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   1   0
RHO      1   c   1   1   1   5
RHO      1   u   1   1   1   1

RHO      1   p   2   1   1   1
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   1   1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   1   0
RHO      2   c   1   1   1   5
RHO      2   u   1   1   1   1

RHO      2   p   2   1   1   1
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   1   1
RHO      2   u   3   0   0   0
;
run;

* Starting values;
data mcc.twogroup_H2_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   .4   .4   .2
GAMMA    2   .   .   .4   .4   .2

RHO      1   p   1   .33  .3   .6
RHO      1   a   1   .5   .5   0
RHO      1   c   1   .5   .45  .33
RHO      1   u   1   1    .5   .5

RHO      1   p   2   .33  .3   .2
RHO      1   a   2   .5   .5   1
RHO      1   c   2   .5   .45  .33
RHO      1   u   2   0    .5   .5

RHO      1   p   3   .34  .4   .2
RHO      1   a   3   0    0    0
RHO      1   c   3   0    .1   .34
RHO      1   u   3   0    0    0

RHO      2   p   1   .33  .3   .6
RHO      2   a   1   .5   .5   0
RHO      2   c   1   .8   .45  .33
RHO      2   u   1   1    .5   .5

RHO      2   p   2   .33  .3   .2
RHO      2   a   2   .5   .5   1
RHO      2   c   2   .2   .45  .33
RHO      2   u   2   0    .5   .5

RHO      2   p   3   .34   .4   .2
RHO      2   a   3   0     0    0
RHO      2   c   3   0    .1    .34
RHO      2   u   3   0     0    0
;
run;


proc lca data = mcc.page70 start = mcc.twogroup_H2_starts
restrict = mcc.twogroup_H2_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -3890.40
G-squared:             40.17
AIC:                   98.17
BIC:                  255.00
Degrees of freedom:       42

H3:

* All H1 and H2 constraints, plus:
* H3 * (7)  p(a=1|g=1,c=2) = p(a=1|g=2,c=2)
* H3 * (8)  p(p=2|g=1,c=1) = p(p=2|g=2,c=1)
* H3 * (9)  p(p=2|g=1,c=2) = p(p=2|g=2,c=2)
* H3 * (10) p(c=3|g=1,c=2) = p(c=3|g=2,c=2) ;

* Constraints;
data mcc.twogroup_H3_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   7   0
RHO      1   c   1   1   1   5
RHO      1   u   1   1   1   1

RHO      1   p   2   8   9   1
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0  10   1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   7   0
RHO      2   c   1   1   1   5
RHO      2   u   1   1   1   1

RHO      2   p   2   8   9   1
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0  10   1
RHO      2   u   3   0   0   0
;
run;

* Starting values ;
data mcc.twogroup_H3_starts;
    input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
    datalines;
GAMMA    1    .    .   .4     .4    .2
GAMMA    2    .    .   .4     .4    .2

RHO      1    p    1    .33   .3    .6
RHO      1    a    1    .5    .5    0
RHO      1    c    1    .5    .45   .33
RHO      1    u    1    1     .5    .5

RHO      1    p    2    .33   .3    .2
RHO      1    a    2    .5    .5    1
RHO      1    c    2    .5    .45   .33
RHO      1    u    2    0     .5    .5

RHO      1    p    3    .34   .4    .2
RHO      1    a    3    0     0     0
RHO      1    c    3    0     .1    .34
RHO      1    u    3    0     0     0

RHO      2    p    1    .33   .3    .6
RHO      2    a    1    .5    .5    0
RHO      2    c    1    .8    .45   .33
RHO      2    u    1    1     .5    .5

RHO      2    p    2    .33  .3   .2
RHO      2    a    2    .5   .5   1
RHO      2    c    2    .2   .45  .33
RHO      2    u    2    0    .5   .5

RHO      2    p    3    .34   .4   .2
RHO      2    a    3    0     0    0
RHO      2    c    3    0     .1   .34
RHO      2    u    3    0     0    0
;
run;


proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H3_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3891.73
G-squared:             42.83
AIC:                   92.83
BIC:                  228.03
Degrees of freedom:       46

H4:

* All constraints from H1-H3, plus:
* (11) p(u=1|g=1,c=3) = p(u=1|g=2,c=3)
* (12) p(p=2|g=1,c=3) = p(p=2|g=2,c=3);

* Constraints ;
data mcc.twogroup_H4_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   7   0
RHO      1   c   1   1   1   5
RHO      1   u   1   1   1   11

RHO      1   p   2   8   9   12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   7   0
RHO      2   c   1   1   1   5
RHO      2   u   1   1   1   11

RHO      2   p   2   8   9   12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;


* Note, this model uses the same starting values as H3.;
proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H4_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -3892.31
G-squared:             43.99
AIC:                   89.99
BIC:                  214.37
Degrees of freedom:       48

H5:

* All cosntraints from H1-H4, plus:
* (13) p(c=1|g=1,c=2) = p(c=1|g=2,c=2);

* Constraints;
data mcc.twogroup_H5_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   7   0
RHO      1   c   1   1   13  5
RHO      1   u   1   1   1   11

RHO      1   p   2   8   9   12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   7   0
RHO      2   c   1   1   13  5
RHO      2   u   1   1   1   11

RHO      2   p   2   8   9   12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;

* Note, this model uses the same starting values as H3.;
proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H5_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -3893.27
G-squared:             45.92
AIC:                   89.92
BIC:                  208.89
Degrees of freedom:       49

H6:

* All constraints from H1-H6, plus:
* (14) p(c=1|g=1,c=1) = p(c=1|g=2,c=1) ;

* constraints;
data mcc.twogroup_H6_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   7   0
RHO      1   c   1   14  13  5
RHO      1   u   1   1   1   11

RHO      1   p   2   8   9   12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   7   0
RHO      2   c   1   14  13  5
RHO      2   u   1   1   1   11

RHO      2   p   2   8   9   12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;

* Note, this model uses the same starting values as H3.;
proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H6_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -3894.03
G-squared:             47.42
AIC:                   89.42
BIC:                  202.99
Degrees of freedom:       50

H7:

* All constraints from H1-H6, plus:
* (15) p(u=1|g=1,c=2) = p(u=1|g=2,c=2);

* constraints;
data mcc.twogroup_H7_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   1   7   0
RHO      1   c   1   14  13   5
RHO      1   u   1   1   15  11

RHO      1   p   2   8   9   12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   1   7   0
RHO      2   c   1   14  13  5
RHO      2   u   1   1   15  11

RHO      2   p   2   8   9   12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;


* Note, this model uses the same starting values as H3.;
proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H7_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3894.03
G-squared:             47.43
AIC:                   87.43
BIC:                  195.59
Degrees of freedom:       51

H8:

* All constraints from H1-H7, plus:
* (16) p(a=1|g=1,c=1) = p(a=1|g=2,c=1)  ;

* constraints ;
data mcc.twogroup_H8_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   2   3   4
RHO      1   a   1   16  7   0
RHO      1   c   1   14  13   5
RHO      1   u   1   1   15  11

RHO      1   p   2   8   9   12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   2   3   4
RHO      2   a   1   16  7   0
RHO      2   c   1   14  13   5
RHO      2   u   1   1   15  11

RHO      2   p   2   8   9   12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;


* Note, this model uses the same starting values as H3.;
proc lca data = mcc.page70 start = mcc.twogroup_H3_starts
restrict = mcc.twogroup_H8_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3895.23
G-squared:             49.82
AIC:                   87.82
BIC:                  190.57
Degrees of freedom:       52

H9:

* All constraints from H1-H8, plus:
* (17)  p(a=1|g=1,c=1) = p(a=1|g=1,c=2) = p(a=1|g=2,c=1) = p(a=1|g=2,c=2)      
     replaces previous constraints 7 & 17;
* (18) p(p=1|g=1,c=1) = p(p=1|g=1,c=2) = p(p=1|g=2,c=1) = p(p=1|g=2,c=2)   
     replaces previous constraints 2 & 3;
* (19) p(p=2|g=1,c=1) = p(p=2|g=1,c=2) = p(p=2|g=2,c=1) = p(p=2|g=2,c=2)
     replaces previous constraints 8 & 9 ;
		
* constraints ;
data mcc.twogroup_H9_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   1
GAMMA    2   .   .   1   1   1

RHO      1   p   1   18  18  4
RHO      1   a   1   17  17  0
RHO      1   c   1   14  13  5
RHO      1   u   1   1   15  11

RHO      1   p   2   19  19  12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   18  18  4
RHO      2   a   1   17  17  0
RHO      2   c   1   14  13  5
RHO      2   u   1   1   15  11

RHO      2   p   2   19  19  12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;


* starting values;
data mcc.twogroup_H9_starts;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   .4   .4   .2
GAMMA    2   .   .   .4   .4   .2

RHO      1   p   1   .33  .33  .6
RHO      1   a   1   .5   .5   0
RHO      1   c   1   .5   .45  .33
RHO      1   u   1   1    .5   .5

RHO      1   p   2   .33  .33  .2
RHO      1   a   2   .5   .5   1
RHO      1   c   2   .5   .45  .33
RHO      1   u   2   0    .5   .5

RHO      1   p   3   .34  .34  .2
RHO      1   a   3   0    0    0
RHO      1   c   3   0    .1   .34
RHO      1   u   3   0    0    0

RHO      2   p   1   .33  .33  .6
RHO      2   a   1   .5   .5   0
RHO      2   c   1   .8   .45  .33
RHO      2   u   1   1    .5   .5

RHO      2   p   2   .33  .33  .2
RHO      2   a   2   .5   .5   1
RHO      2   c   2   .2   .45  .33
RHO      2   u   2   0    .5   .5

RHO      2   p   3   .34  .34  .2
RHO      2   a   3   0    0    0
RHO      2   c   3   0    .1   .34
RHO      2   u   3   0    0    0
;
run;


proc lca data = mcc.page70 start = mcc.twogroup_H9_starts
restrict = mcc.twogroup_H9_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3896.18
G-squared:             51.73
AIC:                   83.73
BIC:                  170.26
Degrees of freedom:       55

H10:

* All constraints from H1-H9, plus:
* (20) fix proportions for class three across groups ;

* constraints ;
data mcc.twogroup_H10_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   1   20
GAMMA    2   .   .   1   1   20

RHO      1   p   1   18  18  4
RHO      1   a   1   17  17  0
RHO      1   c   1   14  13  5
RHO      1   u   1   1   15  11

RHO      1   p   2   19  19  12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   18  18  4
RHO      2   a   1   17  17  0
RHO      2   c   1   14  13  5
RHO      2   u   1   1   15  11

RHO      2   p   2   19  19  12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;

* Note, this model uses the same starting values as H9.;
proc lca data = mcc.page70 start = mcc.twogroup_H9_starts
restrict = mcc.twogroup_H10_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;


=============================================
Fit statistics:
=============================================

Log-likelihood:     -3896.88
G-squared:             53.13
AIC:                   83.13
BIC:                  164.25
Degrees of freedom:       56


Gamma estimates (class membership probabilities):
Class:                     1          2          3
  Group      1:       0.6069     0.2123     0.1808
  Group      2:       0.4612     0.3580     0.1808

Rho estimates (item response probabilities):
  Group      1:
  Response category  1:
Class:                     1          2          3
  p           :       0.8901     0.8901     0.1733
  a           :       0.6186     0.6186     0.0000
  c           :       0.9492     0.6480     0.6625
  u           :       1.0000     0.3305     0.7524

  Response category  2:
Class:                     1          2          3
  p           :       0.0587     0.0587     0.2131
  a           :       0.3814     0.3814     1.0000
  c           :       0.0508     0.2880     0.2371
  u           :       0.0000     0.6695     0.2476

  Response category  3:
Class:                     1          2          3
  p           :       0.0512     0.0512     0.6135
  c           :       0.0000     0.0639     0.1004

  Group      2:
  Response category  1:
Class:                     1          2          3
  p           :       0.8901     0.8901     0.1733
  a           :       0.6186     0.6186     0.0000
  c           :       0.9492     0.6480     0.6625
  u           :       1.0000     0.3305     0.7524

  Response category  2:
Class:                     1          2          3
  p           :       0.0587     0.0587     0.2131
  a           :       0.3814     0.3814     1.0000
  c           :       0.0508     0.2880     0.2371
  u           :       0.0000     0.6695     0.2476

  Response category  3:
Class:                     1          2          3
  p           :       0.0512     0.0512     0.6135
  c           :       0.0000     0.0639     0.1004

Restricted, Complete Homogeneity Model.

* All constraints from H1-H10, plus:
* (21) fix proportions for class two across groups;

* constraints ;
data mcc.twogroup_homogeneity_constraints;
	input param $ group variable $ respcat est1c1 est1c2 est1c3 ;
	datalines;
GAMMA    1   .   .   1   21   20
GAMMA    2   .   .   1   21   20

RHO      1   p   1   18  18  4
RHO      1   a   1   17  17  0
RHO      1   c   1   14  13  5
RHO      1   u   1   1   15  11

RHO      1   p   2   19  19  12
RHO      1   a   2   1   1   1
RHO      1   c   2   1   1   6
RHO      1   u   2   0   1   1

RHO      1   p   3   1   1   1
RHO      1   a   3   0   0   0
RHO      1   c   3   0   10  1
RHO      1   u   3   0   0   0

RHO      2   p   1   18  18  4
RHO      2   a   1   17  17  0
RHO      2   c   1   14  13  5
RHO      2   u   1   1   15  11

RHO      2   p   2   19  19  12
RHO      2   a   2   1   1   1
RHO      2   c   2   1   1   6
RHO      2   u   2   0   1   1

RHO      2   p   3   1   1   1
RHO      2   a   3   0   0   0
RHO      2   c   3   0   10  1
RHO      2   u   3   0   0   0
;
run;


* Note, this model uses the same starting values as H9.;
proc lca data = mcc.page70 start = mcc.twogroup_H9_starts
restrict = mcc.twogroup_homogeneity_constraints;
nclass 3;
items p a c u;
categories 3 2 3 2; 
groups race;
freq wt;
run;

=============================================
Fit statistics:
=============================================

Log-likelihood:     -3919.33
G-squared:             98.03
AIC:                  126.03
BIC:                  201.74
Degrees of freedom:       57

How to cite this page

Report an error on this page

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.