/* This program generates some monte carlo data for use in the forecasting class. The first series is a stationary AR(1) process with phi1 = 0.8. The second series is a stationary AR(1) process with phi1 = -0.8. */ options pagesize=60 linesize=74 nodate; goptions device=win gsfname=plot rotate=landscape gsfmode=append target=hpljs3; *border; /* This segment of the program generates the stationary AR(1) model with phi1 = 0.8. */ data mc1; x1 = 50; iseed = 12345; do t = 0 to 100; a = rannor(iseed); x2 = 10.0 + 0.8*x1 + a; if t > 0 then output; x1 = x2; end; keep t x2; proc gplot data=mc1; symbol v=dot c=black i=join h=.8; title1 'Monte Carlo AR(1) data with phi(1) = 0.8'; title2 'X=Time Y=AR(1) Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(40 to 60 by 10) label=(f=duplex 'AR(1) Series'); plot x2*t / haxis=axis1 vaxis=axis2; title ' Monte Carlo AR(1) data with phi(1) = 0.8'; proc arima data = mc1; identify var = x2; run; /* This segment of the program generates the stationary AR(1) model with phi1 = -0.8. */ data mc2; x1 = 50; iseed = 12345; do t = 0 to 100; a = rannor(iseed); x2 = 90.0 - 0.8*x1 + a; if t > 0 then output; x1 = x2; end; keep t x2; proc gplot data=mc2; symbol v=dot c=black i=join h=.8; title1 'Monte Carlo AR(1) data with phi(1) = -0.8'; title2 'X=Time Y=AR(1) Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(40 to 60 by 10) label=(f=duplex 'AR(1) Series'); plot x2*t / haxis=axis1 vaxis=axis2; run; title ' Monte Carlo AR(1) data with phi(1) = -0.8'; proc arima data = mc2; identify var = x2; run;