This script creates an internal 'measures' dataset and performs a series of analyses to demonstrate the specification of measurement error models. It compares a simple path analysis (equivalent to OLS regression), a regression via PROC REG, and several structural models with PROC CALIS incorporating known error variances on exogenous and endogenous variables.
Data Analysis
Type : INTERNAL_CREATION
Data is generated directly in the script via the DATA step 'measures' using datalines.
1 Code Block
DATA STEP Data
Explanation : Creation of the 'measures' dataset containing variables x and y via continuous reading (Reading multi-column and multi-line data).
Copied!
data measures;
input x y @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
datalines;
7.91736 13.8673 6.10807 11.7966 6.94139 12.2174
7.61290 12.9761 6.77190 11.6356 6.33328 11.7732
7.60608 12.8040 6.65642 12.8866 6.26643 11.9382
...
;
1
DATA measures;
2
INPUT x y @code_sas_json/8_SAS_Intro_ReadFile_MultiCol_@@.json;
3
DATALINES;
4
7.9173613.86736.1080711.79666.9413912.2174
5
7.6129012.97616.7719011.63566.3332811.7732
6
7.6060812.80406.6564212.88666.2664311.9382
7
...
8
;
2 Code Block
PROC CALIS
Explanation : Simple path analysis estimating the linear relationship between x and y without assuming measurement error.
Copied!
proc calis data=measures;
path
x ===> y;
run;
1
PROC CALISDATA=measures;
2
path
3
x ===> y;
4
RUN;
3 Code Block
PROC REG
Explanation : Standard linear regression (OLS) used as a comparison point for PROC CALIS results.
Copied!
proc reg data=measures;
model y = x;
run;
1
PROC REGDATA=measures;
2
model y = x;
3
RUN;
4 Code Block
PROC CALIS
Explanation : Path analysis including mean structure (the 'meanstr' option), allowing estimation of intercepts and variable means.
Copied!
proc calis data=measures meanstr;
path
x ===> y;
pvar
x y;
run;
1
PROC CALISDATA=measures meanstr;
2
path
3
x ===> y;
4
pvar
5
x y;
6
RUN;
5 Code Block
PROC CALIS
Explanation : Model with measurement error on the independent variable x. 'x' is defined as a manifestation of the latent variable 'Fx' with an error variance fixed at 0.019.
Copied!
proc calis data=measures;
path
x <=== Fx = 1.,
Fx ===> y;
pvar
x = 0.019,
Fx, y;
run;
1
PROC CALISDATA=measures;
2
path
3
x <=== Fx = 1.,
4
Fx ===> y;
5
pvar
6
x = 0.019,
7
Fx, y;
8
RUN;
6 Code Block
PROC CALIS
Explanation : Complete measurement error model on both variables. x and y are indicators of the latent variables Fx and Fy, with error variances fixed at 0.019 and 0.022 respectively.
Copied!
proc calis data=measures;
path
x <=== Fx = 1.,
Fx ===> Fy ,
Fy ===> y = 1.;
pvar
x = 0.019,
y = 0.022,
Fx Fy;
run;
1
PROC CALISDATA=measures;
2
path
3
x <=== Fx = 1.,
4
Fx ===> Fy ,
5
Fy ===> y = 1.;
6
pvar
7
x = 0.019,
8
y = 0.022,
9
Fx Fy;
10
RUN;
7 Code Block
PROC CALIS
Explanation : Structural model with error variances forced to zero. This theoretical model should produce results identical to standard OLS regression.
Copied!
proc calis data=measures;
path
x <=== Fx = 1.,
Fx ===> Fy ,
Fy ===> y = 1.;
pvar
x = 0.,
y = 0.,
Fx Fy;
run;
1
PROC CALISDATA=measures;
2
path
3
x <=== Fx = 1.,
4
Fx ===> Fy ,
5
Fy ===> y = 1.;
6
pvar
7
x = 0.,
8
y = 0.,
9
Fx Fy;
10
RUN;
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.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.