options linesize=76 pagesize=76; data use; infile cards; input time gnp houses unemp int_rate lines plastic; /* data comes from Gujarati "Basic Econometrics" ch.8 #32. */ cards; 68 1051.8 1503.6 3.6 5.80 5.90 5873 69 1078.8 1486.7 3.5 6.70 4.50 7852 70 1075.3 1434.8 5.0 8.40 4.20 8189 71 1107.5 2035.6 6.0 6.20 4.20 7497 72 1171.1 2360.8 5.6 5.40 4.90 8534 73 1235.0 2043.9 4.9 5.90 5.00 8688 74 1217.8 1331.9 5.6 9.40 4.10 7270 75 1202.3 1160.0 8.5 9.40 3.40 5020 76 1271.0 1535.0 7.7 7.20 4.20 6035 77 1332.7 1961.8 7.0 6.60 4.50 7425 78 1399.2 2009.3 6.0 7.60 3.90 9400 79 1431.6 1721.9 6.0 10.6 4.40 9350 80 1480.7 1298.0 7.2 14.9 3.90 6540 81 1510.3 1100.0 7.6 16.6 3.10 7675 82 1492.2 1039.0 9.2 17.5 0.60 7419 83 1535.4 1200.0 8.8 16.0 1.50 7923 ; title1 "Initial Regression Ignoring Autocorrelation"; title2 "First collect the residuals in the output data set err"; title3 "and call the residuals resid."; proc reg data=use; model gnp = houses unemp int_rate lines plastic / acov dw spec; output out=err r=resid; data errors; set err; resid1=lag1(resid); title1 "Now use the residuals in a second regression to test"; title2 "for autocorrelation of lag length 3 (I chose 3 arbitrarily)."; title3 " The LM test is formed with the R-squared of this regression."; proc reg data=errors; model resid= houses unemp int_rate lines plastic resid1 ; data errors; set err; e2=resid**2; e2_1= lag1(e2); title1 "Now use the squared residuals e2 in a second regression to test"; title2 "for ARCH of lag length 3 (I chose 3 arbitrarily)."; title3 " The LM test is formed with the R-squared of this regression."; proc reg data=errors; model e2 = e2_1 ;