Published on :
Statistical CREATION_INTERNE

Confirmatory Factor Analysis with PROC CALIS

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© script illustrates the use of the CALIS procedure to perform a confirmatory factor analysis. It begins by creating a covariance matrix named 'cognitive1' via a DATA step. This matrix represents the relationships between different measures of reading, mathematics, and writing. Then, two PROC CALIS analyses are performed. The first specifies a three-factor model (Reading, Math, Writing) where the factors are assumed to be uncorrelated (covariances fixed at zero). The second analysis is similar, but allows the covariances between factors to be freely estimated by the model, by commenting out the covariance constraint.
Data Analysis

Type : CREATION_INTERNE


The data is provided as a covariance matrix directly in the code using a DATA step and the 'datalines' statement. The 'cognitive1' table is therefore entirely generated by the script.

1 Code Block
DATA STEP Data
Explanation :
This block creates a SAS dataset named 'cognitive1' of type COV (covariance matrix). Data is entered manually via the 'datalines' statement. The matrix represents the covariances between nine variables measuring cognitive abilities (reading, mathematics, writing).
Copied!
1title "Confirmatory Factor Analysis Using the FACTOR Modeling Language";
2title2 "Cognitive Data";
3DATA cognitive1(type=cov);
4 _type_='cov';
5 INPUT _name_ $ reading1 reading2 reading3 math1 math2 math3
6 writing1 writing2 writing3;
7 DATALINES;
8reading1 83.024 . . . . . . . .
9reading2 50.924 108.243 . . . . . . .
10reading3 62.205 72.050 99.341 . . . . . .
11math1 22.522 22.474 25.731 82.214 . . . . .
12math2 14.157 22.487 18.334 64.423 96.125 . . . .
13math3 22.252 20.645 23.214 49.287 58.177 88.625 . . .
14writing1 33.433 42.474 41.731 25.318 14.254 27.370 90.734 . .
15writing2 24.147 20.487 18.034 22.106 26.105 22.346 53.891 96.543 .
16writing3 13.340 20.645 23.314 19.387 28.177 38.635 55.347 52.999 98.445
17;
18 
2 Code Block
PROC CALIS
Explanation :
This block performs a confirmatory factor analysis on 'cognitive1' data for 64 observations (nobs=64). It defines a three-factor orthogonal model: 'Read_Factor', 'Math_Factor', and 'Write_Factor'. Orthogonality is ensured by the 'cov' statement which fixes covariances between factors to zero. The 'modification' option requests modification indices to improve model fit.
Copied!
1PROC CALIS DATA=cognitive1 nobs=64 modification;
2 factor
3 Read_Factor ===> reading1-reading3 ,
4 Math_Factor ===> math1-math3 ,
5 Write_Factor ===> writing1-writing3 ;
6 pvar
7 Read_Factor Math_Factor Write_Factor = 3 * 1.;
8 cov
9 Read_Factor Math_Factor Write_Factor = 3 * 0.;
10RUN;
3 Code Block
PROC CALIS
Explanation :
This second block performs a similar analysis, but by commenting out the 'cov' statement. In the absence of this constraint, PROC CALIS freely estimates the covariances between the three factors. This allows testing an alternative model where reading, mathematics, and writing factors are allowed to be correlated with each other.
Copied!
1PROC CALIS DATA=cognitive1 nobs=64 modification;
2 factor
3 Read_Factor ===> reading1-reading3 ,
4 Math_Factor ===> math1-math3 ,
5 Write_Factor ===> writing1-writing3 ;
6 pvar
7 Read_Factor Math_Factor Write_Factor = 3 * 1.;
8 cov
9 Read_Factor Math_Factor Write_Factor /* = 3 * 0. */;
10RUN;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : SAS SAMPLE LIBRARY