/* This program generates realizations from a Stochastic Level model ala A.C. Harvey's (1989) book on structural time series models. This model turns out to be mathematically equivalent to an ARIMA(0,1,1) Box-Jenkins model. */ data mc; mu1 = 0; do t = 0 to 500; eta = rannor(4947); epsilon = rannor(68247); mu = mu1 + eta; y = mu + 0.5*epsilon; if t > 0 then output; mu1 = mu; end; proc gplot data=mc; symbol v=dot c=black i=join h=.8; title1 'Monte Carlo of the Stochastic Level model'; title2 'X=Time Y=Stochastic Level data'; axis1 order=(0 to 500 by 25) label=(f=duplex 'Obs'); axis2 order=(-100 to 100 by 20) label=(f=duplex 'Y'); plot y*t / haxis=axis1 vaxis=axis2; data mc; set mc; dy = y - lag1(y); run; title 'ACF and PACF for the Stochastic Level model'; proc arima data=mc; identify var = y; run; title 'ACF and PACF for Differenced Stochastic Level data'; proc arima data=mc; identify var = y(1); run; proc gplot data=mc; symbol v=dot c=black i=join h=.8; title1 'Differenced Stochastic Level Data'; title2 'X=Time Y=DY Series'; axis1 order=(0 to 500 by 25) label=(f=duplex 'Obs'); axis2 order=(-10 to 10 by 5) label=(f=duplex 'DY Series'); plot dy*t / haxis=axis1 vaxis=axis2; run;