/* This program uses the %logtest to determine the appropriate transformation for the Dow Jones series (None or Log) and uses the "stationary" option for the ARIMA procedure to examine whether a unit root is in the data or if a deterministic trend for the data is appropriate (Case 3 ADF test). */ data dj; input date:monyy5. dji @@; format date monyy5.; title 'Dow Jones Index Data'; title2 'Monthly Average'; datalines; jan84 1258.89 feb84 1164.46 mar84 1161.97 apr84 1152.71 may84 1143.42 jun84 1121.14 jul84 1113.27 aug84 1212.82 sep84 1213.51 oct84 1199.30 nov84 1211.30 dec84 1188.96 jan85 1238.16 feb85 1283.23 mar85 1268.83 apr85 1266.36 may85 1279.40 jun85 1314.00 jul85 1343.17 aug85 1326.18 sep85 1317.95 oct85 1351.58 nov85 1432.88 dec85 1517.02 jan86 1534.86 feb86 1652.73 mar86 1757.35 apr86 1807.05 may86 1801.80 jun86 1867.70 jul86 1809.92 aug86 1843.45 sep86 1813.47 oct86 1817.04 nov86 1883.65 dec86 1924.07 jan87 2065.13 feb87 2202.34 mar87 2292.61 apr87 2302.64 may87 2291.11 jun87 2384.02 jul87 2481.72 aug87 2655.01 sep87 2570.80 oct87 2224.59 nov87 1931.86 dec87 1910.07 jan88 1947.35 feb88 1980.65 mar88 2044.31 apr88 2036.13 may88 1988.91 jun88 2104.94 jul88 2104.22 aug88 2051.29 sep88 2080.06 oct88 2144.31 nov88 2099.04 dec88 2148.58 jan89 2234.68 feb89 2304.30 mar89 2283.11 apr89 2348.91 may89 2439.55 jun89 2494.90 jul89 2554.03 aug89 2691.11 sep89 2693.41 oct89 2692.01 nov89 2642.49 dec89 2728.47 jan90 2679.24 feb90 2614.18 mar90 2700.13 apr90 2708.26 may90 2793.81 jun90 2894.82 jul90 2934.23 aug90 2681.89 sep90 2550.69 oct90 2460.54 nov90 2518.56 dec90 2610.92 jan91 2587.60 feb91 2863.04 mar91 2920.11 apr91 2925.53 may91 2928.42 jun91 2968.13 jul91 2978.18 aug91 3006.08 sep91 3010.35 oct91 3019.73 nov91 2986.12 dec91 2958.64 jan92 3227.06 feb92 3257.27 mar92 3247.41 apr92 3294.08 may92 3376.78 jun92 3337.79 jul92 3329.40 aug92 3307.45 sep92 3293.92 oct92 3198.69 nov92 3238.49 dec92 3303.15 jan93 3277.71 feb93 3367.26 mar93 3440.73 apr93 3423.62 may93 3478.17 jun93 3513.81 jul93 3529.43 aug93 3597.01 sep93 3592.28 oct93 3625.80 nov93 3674.69 dec93 3743.62 jan94 3868.36 feb94 3905.61 ; /* In the following %logtest runs, we are trying to determine the proper transformation of the data. */ title '%logtest with AR=4 assumed'; %logtest(dj,dji,dif=(1),ar=4,out=result4,print=yes); run; title '%logtest with AR=3 assumed'; %logtest(dj,dji,dif=(1),ar=3,out=result3,print=yes); run; title '%logtest with AR=2 assumed'; %logtest(dj,dji,dif=(1),ar=2,out=result2,print=yes); run; title '%logtest with AR=1 assumed'; %logtest(dj,dji,dif=(1),ar=1,out=result1,print=yes); run; title '%logtest with AR=0 assumed'; %logtest(dj,dji,dif=(1),ar=0,out=result0,print=yes); run; /* Using the "majority rule" it appears that the log transformation should be applied to the data. */ data dj; set dj; ldji = log(dji); /* In the following code we are going to actually determine the appropriate lag length for the above %logtests. We do so by applying Proc ARIMA to ARIMA(p,1,0) models to determine the correct lag length to use. Given the below results, the appropriate lag length to use for the %logtest is AR=1. */ proc arima data = dj; identify var = ldji(1) noprint; estimate p = 4; estimate p = 3; estimate p = 2; estimate p = 1; run; /* Here we use the "stationary" option in the ARIMA procedure to examine the augmented Dickey-Fuller test results for the logged Dow Jones series. */ title 'ADF tests for log of Dow Jones Index'; proc arima data = dj; identify var = ldji stationarity = (ADF=4); run;