Published on :
Statistics CREATION_INTERNE

Example of Confirmatory Factor Analysis with PROC CALIS

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating a 'scores' dataset containing six variables. Then, it performs three distinct analyses with PROC CALIS on this data. Each analysis tests a different measurement model for two latent factors ('verbal' and 'math'), imposing various constraints on factor loadings and error variances. This demonstrates the flexibility of the procedure for specifying structural equation models, ranging from a simple model with strong constraints to more complex models with freely estimated parameters.
Data Analysis

Type : CREATION_INTERNE


The 'scores' dataset is created directly in the script via a DATA step and the 'datalines' statement. There are no dependencies on external data.

1 Code Block
DATA STEP Data
Explanation :
This block creates the 'scores' table in memory (WORK library). Data is directly embedded in the code using the 'datalines' statement, which is common for examples or small datasets.
Copied!
1DATA scores;
2 INPUT x1 x2 x3 y1 y2 y3;
3 DATALINES;
4 23 17 16 15 14 16
5 29 26 23 22 18 19
6 14 21 17 15 16 18
7 20 18 17 18 21 19
8 25 26 22 26 21 26
9 26 19 15 16 17 17
10 14 17 19 4 6 7
11 12 17 18 14 16 13
12 25 19 22 22 20 20
13 7 12 15 10 11 8
14 29 24 30 14 13 16
15 28 24 29 19 19 21
16 12 9 10 18 19 18
17 11 8 12 15 16 16
18 20 14 15 24 23 16
19 26 25 21 24 23 24
20 20 16 19 22 21 20
21 14 19 15 17 19 23
22 14 20 13 24 26 25
23 29 24 24 21 20 18
24 26 28 26 28 26 23
25 20 23 24 22 23 22
26 23 24 20 23 22 18
27 14 18 17 13 16 14
28 28 34 27 25 21 21
29 17 12 10 14 12 16
30 8 1 13 14 15 14
31 22 19 19 13 11 14
32 18 21 18 15 18 19
33 12 12 10 13 13 16
34 22 14 20 20 18 19
35 29 21 22 13 17 12
36;
37 
2 Code Block
PROC CALIS
Explanation :
This procedure performs a factor analysis on the 'scores' table. The 'FACTOR' statement defines a two-factor model ('verbal' and 'math'). The 'PVAR' statement imposes equality constraints: the three variables of the 'verbal' factor have the same error variance ('evar1'), and similarly for the 'math' factor ('evar2'). Factor variances are fixed to 1 for model identification.
Copied!
1PROC CALIS DATA=scores;
2 factor
3 verbal ===> x1-x3 = load1 load1 load1,
4 math ===> y1-y3 = load2 load2 load2;
5 pvar
6 verbal = 1.,
7 math = 1.,
8 x1-x3 = 3*evar1,
9 y1-y3 = 3*evar2;
10RUN;
3 Code Block
PROC CALIS
Explanation :
This second factor analysis is a variant of the first. The 'PVAR' statement is simplified to only fix the variance of the latent factors to 1. The error variances of the observed variables (x1-x3, y1-y3) are now freely estimated by the procedure, without equality constraints.
Copied!
1PROC CALIS DATA=scores;
2 factor
3 verbal ===> x1-x3 = load1 load1 load1,
4 math ===> y1-y3 = load2 load2 load2;
5 pvar
6 verbal = 1.,
7 math = 1.;
8RUN;
4 Code Block
PROC CALIS
Explanation :
This third analysis specifies a more complex model. In the 'FACTOR' statement, some factor loadings are freely estimated ('alpha', 'beta') while others are constrained. Similarly, in 'PVAR', some error variances are freely estimated ('phi', 'theta') and others are constrained to be equal. This shows how to specify models with partial constraints.
Copied!
1PROC CALIS DATA=scores;
2 factor
3 verbal ===> x1-x3 = load1 load1 alpha,
4 math ===> y1-y3 = beta load2 load2;
5 pvar
6 verbal = 1.,
7 math = 1.,
8 x1-x3 = evar1 evar1 phi,
9 y1-y3 = theta evar2 evar2;
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 : S A S S A M P L E L I B R A R Y