/* This program generates the Variance Change model */ data mc; iseed = 111; do t = 1 to 50; a = rannor(iseed); x2 = a; output; end; iseed = 777; do t = 51 to 100; a = rannor(iseed); x2 = 3*a; output; end; keep t x2; data mc; set mc; y = x2; time=_N_; run; proc gplot data=mc; symbol v=dot c=black i=join h=.8; title1 'Monte Carlo Variance Change '; title2 'X=Time Y=Variance Change Data'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(-6 to 6 by 1) label=(f=duplex 'y'); plot y*time / haxis=axis1 vaxis=axis2; run; title; proc arima data=mc; identify var = y; estimate p = 0; forecast lead=20 id=time out=pred1; data pred1; set pred1; fore1=forecast; u95_1 = U95; l95_1 = L95; drop forecast U95 L95; run; proc gplot data=pred1; title1 'Forecasts Based on AR(0) Model using ALL of the data'; title2 'X=Time Y=Forecasting While Ignoring the Variance Change'; symbol1 i=none v=star h=0.5; symbol2 i=spline v=circle h=0.5; symbol3 i=spline l=5; plot y * time = 1 fore1 * time = 2 ( l95_1 u95_1 ) * time = 3 / overlay href = 100.5; run; proc arima data=mc(where = (time > 50)); identify var = y; estimate p = 0; forecast lead=20 id=time out=pred2; run; data pred2; set pred2; fore2=forecast; u95_2 = U95; l95_2 = L95; drop forecast U95 L95; run; data combine; merge pred1 pred2; by time; run; proc print data = combine; run; proc gplot data=combine; title1 'Interval Forecasts Based Two Different Variance Regimes'; title2 'X=Time Y=Var. Change Data'; symbol1 i=none v=star h=0.5; symbol2 i=spline v=circle h=0.5; symbol3 i = spline v=diamond h=0.5; symbol4 i=spline l=5; symbol5 i=spline l=5; plot y * time = 1 fore1 * time = 2 fore2 * time = 3 ( l95_1 u95_1 ) * time = 4 ( l95_2 u95_2 ) * time = 5 / overlay href = 100.5; where time > 50; run;