/* This program generates some graphs of monte carlo data for use in the Econometrics classes. The first graph is a stationary series (I(0)). The second and third series have a unit root in them. (They are I(1)). The fourth series is a Trend Stationary (TS) series. */ options pagesize=60 linesize=74 nodate; goptions device=win gsfname=plot rotate=landscape gsfmode=replace target=hpljs3; /* This segment of the program generates the stationary AR(1) model */ data mc0; x1 = 0; iseed = 12345; do t = 0 to 100; a = rannor(iseed); x2 = 0.5*x1 + a; if t > 0 then output; x1 = x2; end; keep t x2; title ' Monte Carlo AR(1) data with phi(1) = 0.5'; proc gplot data=mc0; symbol v=dot c=black i=join h=.8; title1 'Figure 1'; title2 'Monte Carlo AR(1) data with phi(1) = 0.5'; title3 'X=Time Y=AR(1) Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(-5 to 5 by 1.0) label=(f=duplex 'AR(1) Series'); plot x2*t / haxis=axis1 vaxis=axis2; /* This segment of the program generates a Random Walk without Drift */ data mc1; x1 = 0; iseed = 8888; do t = 0 to 100; a = rannor(iseed); x2 = 1.0*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 'Figure 2'; title2 'Monte Carlo Random Walk Without Drift Data'; title3 'X=Time Y=RW Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(-10 to 10 by 2.0) label=(f=duplex 'RW Series'); plot x2*t / haxis=axis1 vaxis=axis2; /* This segment of the program generates a Random Walk with Drift */ data mc2; x1 = 0; iseed = 2468; do t = 0 to 100; a = rannor(iseed); x2 = 1.0 + 1.0*x1 + 2*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 'Figure 3'; title2 'Monte Carlo Random Walk With Drift Data'; title3 'X=Time Y=RW Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(-10 to 120 by 10) label=(f=duplex 'RW Series'); plot x2*t / haxis=axis1 vaxis=axis2; /* This segment of the program generates a Deterministic Trend model */ data mc3; x1 = 0; iseed = 7654321; do t = 0 to 100; a = rannor(iseed); x2 = 10.0 + 4.0*t + 10*a; if t > 0 then output; end; keep t x2; proc gplot data=mc3; symbol v=dot c=black i=join h=.8; title1 'Figure 4'; title2 'Deterministic Trend Data'; title3 'X=Time Y=Trend Series'; axis1 order=(0 to 100 by 10) label=(f=duplex 'Obs'); axis2 order=(0 to 450 by 25) label=(f=duplex 'Trend Series'); plot x2*t / haxis=axis1 vaxis=axis2; run;