UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

SAS Textbook Examples
Applied Longitudinal Data Analysis: Modeling Change and Event Occurrence
by Judith D. Singer and John B. Willett
Chapter 8: Modeling change using covariance structure analysis


Table 8.1 on page 282.

Part 1: Excerpt from the multivariate format data set.

data alcohol2;
  set alda.alcohol2;
  alc1 = exp(alc1);
  alc2 = exp(alc2);
  alc3 = exp(alc3);
  peer1 = exp(peer1);
  peer2 = exp(peer2);
  peer3 = exp(peer3);
  if id in (18, 21, 236, 335, 353, 555, 850, 883, 974, 1012);
run;
proc print data = alcohol2 noobs;
format alc1-alc3 4.2 peer1-peer3 female 3.0;
run;
 ID     FEMALE    ALC1    ALC2    ALC3    PEER1    PEER2    PEER3
  18       0      1.00    1.33    2.00       3        2        2
  21       0      2.00    1.00    1.33       1        5        5
 236       0      3.33    4.33    4.33       2        1        4
 335       0      1.00    1.33    1.67       1        2        1
 353       0      2.00    2.00    1.67       1        1        2
 555       1      2.67    2.33    1.67       2        3        1
 850       1      1.33    1.67    1.33       3        1        2
 883       1      3.00    2.67    3.33       4        5        1
 974       1      1.00    1.67    2.67       1        5        6
1012       1      1.00    1.67    2.33       1        2        4

Part 2: Estimated means and variance/covariance matrix for transformed data.

proc means data = alda.alcohol2 mean;
var female alc1-alc3 peer1-peer3;
run;
The MEANS Procedure
Variable            Mean
------------------------
FEMALE         0.6122995
ALC1           0.2250666
ALC2           0.2541351
ALC3           0.2879230
PEER1          0.1771944
PEER2          0.2904569
PEER3          0.3470381
------------------------
proc corr data = alda.alcohol2 ;
var female alc1-alc3 peer1-peer3;
ods output cov = cov ;
run;
proc print data = cov noobs;
format _numeric_ 5.3;
run;
Variable    FEMALE     ALC1     ALC2     ALC3    PEER1    PEER2    PEER3
 FEMALE     0.238     -.008    -.013    -.005    -.009    -.022    -.024
 ALC1       -.008     0.136    0.078    0.065    0.066    0.064    0.060
 ALC2       -.013     0.078    0.155    0.082    0.045    0.096    0.074
 ALC3       -.005     0.065    0.082    0.181    0.040    0.066    0.132
 PEER1      -.009     0.066    0.045    0.040    0.174    0.072    0.071
 PEER2      -.022     0.064    0.096    0.066    0.072    0.262    0.112
 PEER3      -.024     0.060    0.074    0.132    0.071    0.112    0.289

Table 8.2 on page 289.

Model A:

data al2;
  set alda.alcohol2;
  cons = 1;
run;
/*model A*/
proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
      f1 = b1 cons + d1,
      f2 = b2 cons + d2;
  std 
     d1-d2 = 2 * A: (2 * 3.) ,
     e1-e3 = 3* A: (3 *3.);                                                              
    cov
    d2 d1 = cov;    
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation
Chi-Square                                            0.0482
Chi-Square DF                                              1
Pr > Chi-Square                                       0.8263
Latent Variable Equations with Estimates
f1      =   0.2256*cons     +  1.0000 d1
Std Err     0.0107 b1
t Value    21.0970
f2      =   0.0360*cons     +  1.0000 d2
Std Err    0.00735 b2
t Value     4.8958
            Variances of Exogenous Variables
                                      Standard
Variable Parameter      Estimate         Error    t Value
cons                     1.00089
E1       A3              0.04847       0.00642       7.55
E2       A4              0.07577       0.00445      17.04
E3       A5              0.07677       0.00990       7.75
d1       A1              0.08712       0.00711      12.25
d2       A2              0.01978       0.00522       3.79
          Covariances Among Exogenous Variables
                                       Standard
Var1 Var2 Parameter      Estimate         Error    t Value
d1   d2   cov            -0.01249       0.00458      -2.73

Model B:

proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
      f1 = b1 cons + c1 female + d1,
      f2 = b2 cons + c2 female + d2;
  std 
     d1-d2 = 2 * A: (2 * 3.) ,
     e1-e3 = 3 * A: (3 *3.);                                                              
    cov
    d2 d1 = cov;    
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation

Chi-Square                                            1.5434
Chi-Square DF                                              2
Pr > Chi-Square                                       0.4622
Latent Variable Equations with Estimates
f1      =  -0.0419*FEMALE   +  0.2513*cons     +  1.0000 d1
Std Err     0.0219 c1          0.0171 b1
t Value    -1.9128            14.6546
f2      =  0.00788*FEMALE   +  0.0312*cons     +  1.0000 d2
Std Err     0.0151 c2          0.0118 b2
t Value     0.5222             2.6401
            Variances of Exogenous Variables
                                      Standard
Variable Parameter      Estimate         Error    t Value
FEMALE                   0.61285
cons                     1.00089
E1       A3              0.04890       0.00642       7.62
E2       A4              0.07556       0.00444      17.03
E3       A5              0.07715       0.00990       7.79
d1       A1              0.08640       0.00709      12.19
d2       A2              0.01950       0.00521       3.74
            Covariances Among Exogenous Variables
                                           Standard
Var1   Var2   Parameter      Estimate         Error    t Value
FEMALE cons                   0.61285
d1     d2     cov            -0.01217       0.00457      -2.66


Baseline model to be compared with for model B:

proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
      f1 = b1 cons + 0 female + d1,
      f2 = b2 cons + 0 female + d2;
  std 
     d1-d2 = 2 * A: (2 * 3.) ,
     e1-e3 = 3 * A: (3 *3.);                                                              
    cov
    d2 d1 = cov;    
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation
Chi-Square                                            5.3617
Chi-Square DF                                              4
Pr > Chi-Square                                       0.2522

Model C:

proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
      f1 = b1 cons + b3 female + d1,
      f2 = b2 cons + 0 female + d2;
  std 
     d1-d2 = 2 * A: (2 * 3.) ,
     e1-e3 = 3 * A: (3 *3.);                                                              
    cov
    d2 d1 = cov;    
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation

Chi-Square                                            1.8157
Chi-Square DF                                              3
Pr > Chi-Square                                       0.6115
Latent Variable Equations with Estimates
f1      =  -0.0366*FEMALE   +  0.2480*cons     +  1.0000 d1
Std Err     0.0194 b3          0.0160 b1
t Value    -1.8861            15.5264
f2      =   0.0360*cons     +  1.0000 d2
Std Err    0.00735 b2
t Value     4.8958
            Variances of Exogenous Variables
                                      Standard
Variable Parameter      Estimate         Error    t Value
FEMALE                   0.61285
cons                     1.00089
E1       A3              0.04884       0.00642       7.61
E2       A4              0.07556       0.00444      17.03
E3       A5              0.07726       0.00990       7.80
d1       A1              0.08645       0.00709      12.19
d2       A2              0.01950       0.00521       3.74
            Covariances Among Exogenous Variables
                                           Standard
Var1   Var2   Parameter      Estimate         Error    t Value
FEMALE cons                   0.61285
d1     d2     cov            -0.01220       0.00457      -2.67

Model D:

proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
    peer1 = f11 +    0 f22 + e4,
    peer2 = f11 +  .75 f22 + e5,
    peer3 = f11 + 1.75 f22 + e6,
    f1 = b1 cons + c11 f11 + c12 f22 + d3,
    f2 = b2 cons + c21 f11 + c22 f22 + d4,
    f11 = b3 cons + d1,
    f22 = b4 cons + d2;
  std 
     d1-d4 = 4 * A: (4 * 3.),
     e1-e6 = 6 * A: (6 *3.) ;                                                              
    cov
	d1 d2 = cov0, /* covariance of pi_0' and pi_1' */
    d3 d4 = cov1, /* covariance of pi_0 and pi_1*/
	e1 e4 = cov3, /* covariance of delta1 and epsilon1 */
	e2 e5 = cov4, /* covarinace of delta2 and epsilon2 */
	e3 e6 = cov5; /* covarinace of delta3 and epsilon3 */
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation
Chi-Square                                           11.5469
Chi-Square DF                                              4
Pr > Chi-Square                                       0.0211
Latent Variable Equations with Estimates
f1      =   0.7986*f11      +  0.0804*f22      +  0.0666*cons +  1.0000 d3
Std Err     0.1023 c11         0.1824 c12         0.0156 b1
t Value     7.8072             0.4410             4.2699
f2      =  -0.1433*f11      +  0.5767*f22      + 0.00830*cons +  1.0000 d4
Std Err     0.0759 c21         0.1922 c22         0.0145 b2
t Value    -1.8876             3.0008             0.5715
f11     =   0.1882*cons     +  1.0000 d1
Std Err     0.0119 b3
t Value    15.7882
f22     =   0.0962*cons     +  1.0000 d2
Std Err    0.00966 b4
t Value     9.9512
Variances of Exogenous Variables
                                      Standard
Variable Parameter      Estimate         Error    t Value
cons                     1.00089
E1       A5              0.04808       0.00636       7.56
E2       A6              0.07628       0.00443      17.23
E3       A7              0.07635       0.00975       7.83
e4       A8              0.10588       0.01075       9.85
e5       A9              0.17143       0.00873      19.65
e6       A10             0.12907       0.01756       7.35
d3       A3              0.04220       0.00745       5.67
d4       A4              0.00923       0.00542       1.70
d1       A1              0.06975       0.01036       6.73
d2       A2              0.02850       0.00884       3.22
           Covariances Among Exogenous Variables
                                         Standard
Var1  Var2  Parameter      Estimate         Error    t Value
E1    e4    cov3            0.01094       0.00613       1.78
E2    e5    cov4            0.03403       0.00466       7.31
E3    e6    cov5            0.03745       0.01019       3.68
d3    d4    cov1           -0.00637       0.00509      -1.25
d1    d2    cov0            0.00118       0.00707       0.17

Baseline model for comparing with model D:

proc calis noint ucov data = al2 method=ml;
  lineqs                                                                     
    alc1 =  F1  +    0 F2  + E1,                                                      
    alc2 =  F1  +  .75 F2  + E2,                                                      
    alc3 =  F1  + 1.75 F2  + E3,
    peer1 = f11 +    0 f22 + e4,
    peer2 = f11 +  .75 f22 + e5,
    peer3 = f11 + 1.75 f22 + e6,
    f1 = b1 cons + 0 f11 + 0 f22 + d3,
    f2 = b2 cons + 0 f11 + 0 f22 + d4,
    f11 = b3 cons + d1,
    f22 = b4 cons + d2;
  std 
     d1-d4 = 4 * A: (4 * 3.),
     e1-e6 = 6 * A: (6 *3.) ;                                                              
    cov
	d1 d2 = cov0, /* covariance of pi_0' and pi_1' */
    d3 d4 = cov1, /* covariance of pi_0 and pi_1*/
	e1 e4 = cov3, /* covariance of delta1 and epsilon1 */
	e2 e5 = cov4, /* covarinace of delta2 and epsilon2 */
	e3 e6 = cov5; /* covarinace of delta3 and epsilon3 */
run;
quit; 
The CALIS Procedure
Covariance Structure Analysis: Maximum Likelihood Estimation
Chi-Square                                          342.3423
Chi-Square DF                                              8
Pr > Chi-Square                                       <.0001

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