TITLE: this is an example of a cross-classified time series analysis
with a univariate first-order autoregressive AR(1) model for a
continuous dependent variable with a covariate, linear trend, and random slope
Same as mcex9.38
Montecarlo:
names are y x w xm;
nobservations = 20000;
nreps = 1;
CSIZES = 200[100(1)];
ncsize = 1[1];
lagged = y(1);
Between = (level2b)w (level2b)xm;
within = x;
save = ex9.39.dat;
ANALYSIS: TYPE = CROSS random;
estimator=bayes; process=2;
fbiter = 200; ! full convergence not needed to generate the data
model population:
%within%
sx | y ON x;
sy | y ON y&1;
y*1; x*1;
%between LEVEL2A% ! time
y*.5; sx*.2; sy@0;
%between LEVEL2B% ! subject
y*.5; [y*2];
w*1; xm*1;
w with xm*.5;
[sx*.5]; sx*.2;
[sy*.3]; sy*.02;
y on w*.3 xm*.4;
sx on w*.2 xm*.3;
sy on w*.05 xm*.05;
model:
%within%
sx | y ON x;
sy | y ON y&1;
y*1; x*1;
%between LEVEL2A% ! time
y*.5; sx*.2; sy@0; ! random AR over time takes a long time
%between LEVEL2B% ! subject
y*.5; [y*2];
w*1; xm*1;
w with xm*.5;
[sx*.5]; sx*.2;
[sy*.3]; sy*.02;
y on w*.3 xm*.4;
sx on w*.2 xm*.3;
sy on w*.05 xm*.05;
output: tech8 tech9;