TITLE: this is an example of a two-level confirmatory factor analysis (CFA)
with continuous factor indicators,
covariates, and a factor with a random residual variance
DATA: FILE = ex9.29.dat;
VARIABLE: NAMES ARE y1-y4 x1 x2 w clus;
WITHIN = x1 x2;
BETWEEN = w;
CLUSTER = clus;
ANALYSIS: TYPE = TWOLEVEL RANDOM;
ESTIMATOR = BAYES;
PROCESSORS = 2;
BITERATIONS = (10000);
MODEL: %WITHIN%
fw BY y1-y4;
fw ON x1 x2;
logv | fw;
%BETWEEN%
fb BY y1-y4;
fb ON w;
logv ON w;
OUTPUT: TECH1 TECH8;
PLOT: TYPE = PLOT3;