SAS Libary
Solving Examples from EQS Manual Using Proc Calis

 

Example 1: A Simple Regression Model on page 15

 

EQS code: manul1.eqs

SAS code

/TITLE
   STABILITY OF POWERLESSNESS 
   (EXAMPLE IN EQS MANUAL P.15)
/SPECIFICATIONS
   CAS=932; VAR=6; ME=LS;
/EQUATIONS
   V4 = 1*V2 - 1*V5 + E4;
/VARIANCES
   V2 = 9*; V5 = 9*; E4 = 2*;
/COVARIANCES
   V5,V2 = -4*;
/MATRIX
   11.834
    6.947  9.364
    6.819  5.091 12.532
    4.783  5.028  7.495  9.986
   -3.839 -3.889 -3.841 -3.625 9.610
   -2.189 -1.883 -2.175 -1.878 3.552 4.503
/END
data power(TYPE=COV);
   _type_ = 'cov'; 
   input _name_ $ v1-v6; 
   datalines;                                
   v1   11.834     .        .        .       .        .
   v2    6.947    9.364     .        .       .        .
   v3    6.819    5.091   12.532     .       .        .
   v4    4.783    5.028    7.495    9.986    .        .
   v5   -3.839   -3.889   -3.841   -3.625   9.610     .
   v6   -2.189   -1.883   -2.175   -1.878   3.552  4.503
;
run; 
proc calis cov data = power method = ls nobs = 932 ; 
      Lineqs  
         V4 = b1 v2 + b2 v5 + E4; 
      Std                      
         v2 = ev2(9),
         v5 = ev5(9),
	 e4 = ee4(2);
      Cov              
         v2 v5 = Theta (-4);    
 run;
 

Example 2: A Two-Equation Path Model on page 22

 EQS code: manul2.eqs

SAS code

 /TITLE
   PATH ANALYSIS MODEL 
   (EXAMPLE IN EQS MANUAL P.22)
/SPECIFICATIONS
   CAS=932; VAR=6; ME=ML;
/LABEL
   V1=ANOMIE67; V2=POWRLS67; 
   V3=ANOMIE71; V4=POWRLS71;
/EQUATIONS
   V3 = 1*V1 + 1*V2 + E3;
   V4 = 1*V1 + 1*V2 + E4;
/VARIANCES
   V1 TO V2 = 10*;
   E3 TO E4 =  2*;
/COVARIANCES
   V2,V1= 7*;
/MATRIX
   11.834
    6.947  9.364
    6.819  5.091 12.532
    4.783  5.028  7.495  9.986
   -3.839 -3.889 -3.841 -3.625 9.610
   -2.189 -1.883 -2.175 -1.878 3.552 4.503
/diagram
title='Diagram from Manul2';
orientation=landscape;
border=yes;
tlocation=bottom;
layout=  v1 b v3 e3&
         v2 b v4 e4;
/end
/*********************************************
 This example uses the same covariance matrix 
 from the example above. 
 
 The labels can be created in a data step 
 which we omitted here.
 ********************************************/
 
proc calis cov data=power method = ml nobs = 932;
      Lineqs 
         v3 = a3 v1 + b3 v2 + e3, 
         v4 = a4 v1 + b4 v2 + e4; 
      Std  
          v1 - v2 = ev1 - ev2,
          e3 - e4 = ee3 - ee4;
      Cov                     
         v1 v2 = Theta (.7); 
run;

 

Example 3: A Factor Analysis Model on page 29

 

  EQS code: manul3.eqs

SAS code

/TITLE
   FACTOR ANALYSIS MODEL 
   (EXAMPLE IN EQS MANUAL P.29)
/SPECIFICATIONS
   CAS=932; VAR=6; ME=GLS;
/LABEL
   V1=ANOMIA67; V2=POWRLS67; 
   V3=ANOMIA71; V4=POWRLS71;
/EQUATIONS
   V1 = 2*F1 + E1;
   V2 = 2*F1 + E2;
   V3 = 2*F2 + E3;
   V4 = 2*F2 + E4;
/VARIANCES
   F1 TO F2 = 1.0;
   E1 TO E4 =  3*;
/COVARIANCES
   F2,F1= .3*;
   e3,e1 = *;
   e4,e2 = *;
/MATRIX
   11.834
    6.947  9.364
    6.819  5.091 12.532
    4.783  5.028  7.495  9.986
   -3.839 -3.889 -3.841 -3.625 9.610
   -2.189 -1.883 -2.175 -1.878 3.552 4.503
/constraints
  (v1,f1) = (v3,f2);
  (v2,f1) = (v4,f2);
  (e1,e1) = (e3,e3);
  (e2,e2) = (e4,e4);
  (e3,e1) = (e4,e2);
/DIAGRAM
title='Diagram from Manul3';
tlocation=bottom;
orientation=landscape;
border=yes;
postscript='MANUL3.PS';
layout=E1   b   E2  E3  b    E4 &
       V1   b   V2  V3  b    V4 &
       b    F1  b   b   F2;
/END
/**********************************************
 This example uses the same covariance matrix
 as in example 1. 
 *********************************************/
 
proc calis cov data=power method = gls nobs = 932;
 lineqs
   v1 = a1 f1 + e1,
   v2 = a2 f1 + e2,
   v3 = a1 f2 + e3,
   v4 = a2 f2 + e4;
 std
   f1- f2 = 1.0,
   e1 e3 = ee1,
   e2 e4 = ee2;
 cov
   f1 f2 = theta1,
   e1 e3 = theta2,
   e2 e4 = theta2;
run;

 

Example 4: A Complete Latent Variable Model on page 33

 

 EQS code: manul4.eqs

SAS code

/TITLE
   A COMPLETE LATENT VARIABLE MODEL 
   (EXAMPLE IN EQS MANUAL P.33)
/SPECIFICATIONS
   CAS=932; VAR=6; ME=ML; MAT=COV; 
   data='MANUL4.DAT';
/LABEL
   V1=ANOMIA67; V2=POWRLS67; 
   V3=ANOMIA71; V4=POWRLS71;
   V5=EDUCATON; V6=OCCUPATN;
/EQUATIONS
   V1 =      F1 + E1;
   V2 = .833 F1 + E2;
   V3 =      F2 + E3;
   V4 = .833 F2 + E4;
   V5 =      F3 + E5;
   V6 =  .5 *F3 + E6;
   F1 = -.5 *F3 + D1;
   F2 =  .5 *F1 - .5*F3 + D2;
/VARIANCES
   D1 TO D2 = 4*;
   F3 = 6*;
   E1 TO E6 = 3*;
/COVARIANCES
   E1,E3 = .2*;
   E2,E4 = .2*;
/CONSTRAINTS
   (E1,E1) = (E3,E3);
   (E2,E2) = (E4,E4);
   (E3,E1) = (E4,E2);
/END
 /*********************************************
  This example uses the same covariance matrix
  as in example 1. 
  ********************************************/
  
proc calis cov data=power method = ml nobs = 932;
     lineqs
   V1 =      F1 + E1,
   V2 = .833 F1 + E2,
   V3 =      F2 + E3,
   V4 = .833 F2 + E4,
   V5 =      F3 + E5,
   V6 =   a6 F3 + E6,
   F1 =   c1 F3 + D1,
   F2 =   c2 F1 + c3 F3 + D2;
 std
   D1 - D2 = ed:,
   F3 = ef3,
   E1 = ee1,
   e3 = ee1,
   e2 = ee2,
   e4 = ee2,
   e5 = ee3,
   e6 = ee4;
 cov
    E1 E3 = theta1,
    E2 E4 = theta1;
run;

 

Example 5: A Second-order Factor Analysis Model on page 38

 

 

EQS code: manul5.eqs

SAS code

/TITLE
   A SECOND-ORDER FACTOR ANALYSIS MODEL 
   (EXAMPLE IN EQS MANUAL P.38)
/SPECIFICATIONS
   CAS=932; VAR=6; ME=GLS;
/LABEL
   V1=ANOMIA67; V2=POWRLS67; 
   V3=ANOMIA71; V4=POWRLS71;
   V5=EDUCATON; V6=OCCUPATN;
/EQUATIONS
   V1 =      F1 + E1;
   V2 =    2*F1 + E2;
   V3 =      F2 + E3;
   V4 =    2*F2 + E4;
   F1 =    1*F3 + D1;
   F2 =    1*F3 + D2;
/VARIANCES
   F3 = 1;
   F3 = 1;
   D1 TO D2 = 1*;
   E1 TO E4 = 3*;
/CONSTRAINTS
   (F1,F3) = (F2,F3);
/MATRIX
   11.834
    6.947  9.364
    6.819  5.091 12.532
    4.783  5.028  7.495  9.986
   -3.839 -3.889 -3.841 -3.625 9.610
   -2.189 -1.883 -2.175 -1.878 3.552 4.503
/END
/*********************************************
 This example uses the same covariance matrix
  as in example 1. 
 ********************************************/
 
proc calis cov data=power method = gls nobs=932; 
 lineqs
   V1 =      F1 + E1,
   V2 =   c1 F1 + E2,
   V3 =      F2 + E3,
   V4 =   c2 F2 + E4,
   F1 =   c3 F3 + D1,
   F2 =   c3 F3 + D2;
 std
   F3 = 1,
   D1 - D2 = ed:,
   E1 - E4 = ee:;
run;

 

Example 6: A Nonstandard Model on page 104

 

 

EQS code: manul6.eqs

 SAS code

/TITLE
 EXAMPLE IN EQS MANUAL P.104
/SPECIFICATIONS
 CASES = 122; VARIABLES = 8; 
 MATRIX=CORRELATION; ANALYSIS=COVARIANCE;
/LABELS
 V1 = PERFORM;  V2 = SATISFC1; 
 V3 = SATISFC2; V4 = ACHMOTV1;
 V5 = ACHMOTV2; V6 = SLFESTM1; 
 V7 = SLFESTM2; V8 = VERBALIQ;
 F1 = JOBSATSF; F2 = N-ACHIEV; F3 = ESTEEM;
/EQUATIONS
 V1 =           1*F3 + .5*V8 + E1;
 V2 =   F1                   + E2;
 V3 = 1*F1                   + E3;
 V4 =        F2              + E4;
 V5 =      1*F2              + E5;
 V6 =             F3         + E6;
 V7 =           1*F3         + E7;
 F1 =      1*F2      + .5*V1 + D1;
/VARIANCES
 V8 = 10*;
 F2 TO F3 = 1*;
 E1 TO E7 = 5*;
 D1 = 1*;
/COVARIANCES
 F2,F3 = *;
 F2,V8 = *;
 F3,V8 = *;
/MATRIX
 1.000
  .418 1.000
  .394  .627 1.000
  .129  .202  .266 1.000
  .189  .284  .208  .365 1.000
  .544  .281  .324  .201  .161 1.000
  .507  .225  .314  .172  .174  .546 1.000
 -.357 -.156 -.038 -.199 -.277 -.294 -.174 1.000
/STANDARD DEVIATIONS
 2.09  3.43  2.81  1.95  2.08  2.16  2.06  3.65
/print
  effect=yes; covariance=yes; correlation=yes;
/LMTEST
/wtest
/END
data bagozzi (TYPE=CORR); 
   input _type_ $ _name_ $ v1-v8;
   label  V1 = 'PERFORM'
          V2 = 'SATISFC1'
          V3 = 'SATISFC2'
          V4 = 'ACHMOTV1'
          V5 = 'ACHMOTV2'
          V6 = 'SLFESTM1'
          V7 = 'SLFESTM2'
          V8 = 'VERBALIQ';
   datalines;     
mean   .     0     0     0     0     0     0     0     0
std    .  2.09  3.43  2.81  1.95  2.08  2.16  2.06  3.65
N      .   122   122   122   122   122   122   122   122
corr  v1 1.000     .     .     .     .     .     .     .
corr  v2  .418 1.000     .     .     .     .     .     .
corr  v3  .394  .627 1.000     .     .     .     .     .
corr  v4  .129  .202  .266 1.000     .     .     .     .
corr  v5  .189  .284  .208  .365 1.000     .     .     .
corr  v6  .544  .281  .324  .201  .161 1.000     .     .
corr  v7  .507  .225  .314  .172  .174  .546 1.000     .
corr  v8 -.357 -.156 -.038 -.199 -.277 -.294 -.174 1.000
;
run;

proc calis cov data = bagozzi pall;
 lineqs
    V1 =    a1 F3 + a2 V8 + E1,
    V2 =       F1         + E2,
    V3 =    c1 F1         + E3,
    V4 =       F2         + E4,
    V5 =    d1 F2         + E5,
    V6 =       F3         + E6,
    V7 =    e1 F3         + E7,
    F1 =    f1 F2 + f2 V1 + D1;
 std
   V8 = ev8,
   F2 - F3 = ef2 - ef3,
   E1 - E7 = ee1 - ee7,
   D1 = ed1;
 cov 
  F2 F3 = theta1,
  F2 V8 = theta2,
  F3 V8 = theta3;
run;

 

Example 7: A Simulated Confirmatory Factory Analysis Example on page 117

EQS code: manul7.eqs

 SAS code

/TITLE
 SIMULATED CONFIRMATORY FACTOR ANALYSIS EXAMPLE
 (EXAMPLE IN EQS MANUAL P.117)
 RAW SCORES IN BENTLER (1985, P.105)
 DEFAULT START VALUES
/SPECIFICATIONS
 CASES = 50; VARIABLES = 6; ME = ML, ROBUST;
 MA = RA; FO='(1X,6F6.3)'; DATA='MANUL7.DAT';
/EQUATIONS
 V1 = *F1      + E1;
 V2 = *F1      + E2;
 V3 = *F1      + E3;
 V4 =      *F2 + E4;
 V5 =      *F2 + E5;
 V6 =      *F2 + E6;
/VARIANCES
 F1 TO F2 = 1;
 E1 TO E6 = *;
/COVARIANCE
 F1,F2 = *;
/diagram
 title='Diagram from Manul7'; tlocation=top;
 oritntation=landscaape; border=yes;
 postscript='MANUL7.PS';
 layout = e1 v1 b  b  b  b b v4 e4&
          e2 v2 b  f1 b f2 b v5 e5&
          e3 v3 b  b  b  b b v6 e6;
/END
data data67;

proc calis cov data = data67 method = ml;
 lineqs
   V1 = a1 F1 + E1,
   V2 = b1 F1 + E2,
   V3 = c1 F1 + E3,
   V4 = d1 F2 + E4,
   V5 = e1 F2 + E5,
   V6 = f1 F2 + E6;
 std
    F1 = 1,
    F2 = 1,
    E1 - E6 = ee:;
 cov 
  F1 F2 = theta1;
run;

 

Example 8: Growth in Wisc Scores on page 175

 

EQS code: manul9.eqs

SAS code

/TITLE
GROWTH IN WISC SCORES 
(EXAMPLE IN EQS MANUAL P. 175)
OSBORNE DATA (MCARDLE & EPSTEIN, 1987, P.113)
/SPECIFICATIONS
CASES = 204; VAR = 4; 
ANALYSIS=MOMENT;  MATRIX = CORRELATIONS;
/EQUATIONS
V1 =   F1 +        E1 - 3*V999;
V2 = 1*F1 +        E2;
V3 =         F2 +  E3;
V4 =       1*F2 +  E4;
F1 =                   21*V999 + D1;
F2 = 1*F1 +             8*V999 + D2;
/VARIANCES
D1 = 30*; D2 = 3*;
E1 TO E3 = 8*; E4 = 16*;
/TECHNICAL
   TOL=0.01;
/PRINT
EFFECT = YES;
/MEANS
    18.034 25.819 35.255 46.593
/STANDARD DEVIATIONS
    6.374 7.319 7.796 10.386
/MATRIX
 1.000
  .809 1.000
  .806  .850 1.000
  .765  .831  .867 1.000
 /END
data growth (TYPE=CORR);
   input _type_ $ _name_ $ v1-v4;
   datalines;     
mean  .    18.034 25.819 35.255 46.593
std   .     6.374  7.319  7.796 10.386
N     .       204    204    204    204
corr v1     1.000      .      .      .
corr v2      .809  1.000      .      .
corr v3      .806   .850  1.000      .
corr v4      .765   .831   .867  1.000
;
run;

/****************************************************
  The output of the following procedure gives the 
  same parameter estimates and standard errors as the
  EQS code on the left. It is worth noticing that it 
  uses the uncorrected standard deviation instead of
  corrected standard deviation for the mean as in EQS.
  This is because the extra constant term involved. 
*****************************************************/

proc calis ucov data = growth augment nobs = 204;
 lineqs
  V1 =  a0 Intercept + F1 + E1,
  V2 =  b1 F1 + E2,
  V3 =     F2 + E3,
  V4 =  b4 F2 + E4,
  F1 = d0 Intercept + D1,
  F2 = e0 Intercept + e1 F1 + D2;
 std
   d1 = ed1,
   d2 = ed2,
   E1 -E4 = ee:;
run;

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.