* Autocorrelation * Reference: Chapter 12 of * R. Carter Hill, William E. Griffiths and George G. Judge, * Undergraduate Econometrics, Second Edition, Wiley. SAMPLE 1 34 READ (TAB12-1.shd) AREA PRICE * Use the DIM command to allocate variables that can be used in * a forecasting exercise to come later in the chapter. DIM LA 36 LP 36 GENR LA=LOG(AREA) GENR LP=LOG(PRICE) * OLS estimation - Equation (R12.1), p.260 * The LIST option lists the OLS residuals (Table 12.2, p.260) and * a crude residual plot. * The RSTAT option gives the RHO estimate - Equation (R12.4), p.269 * The DWPVALUE option gives the Durbin-Watson p-value - * Equation (R12.8), p.273 OLS LA LP / LOGLOG LIST RSTAT DWPVALUE COEF=BETA STDERR=SEOLS RESID=EHAT * Confidence interval estimates for the coefficient on LP - * Equation (R12.3), p.265 CONFID LP / TCRIT=2.037 * Save the value of RHO stored in the temporary variable $RHO GEN1 RHO=$RHO * Calculate adjusted standard errors using Equation (12.3.4) STAT LP / CPDEV=VX MEAN=XBAR GEN1 SUM=0 SET NODOECHO NOOUTPUT DO #=1,33 GEN1 A=#+1 DO $=A,34 GEN1 I=# GEN1 J=$ GEN1 XI=LP:# GEN1 XJ=LP:$ GEN1 SUM=SUM+2*(XI-XBAR)*(XJ-XBAR)*(RHO**(J-I)) ENDO ENDO SET OUTPUT GEN1 SEBETA2=SEOLS*SQRT(1+SUM/VX) PRINT SEBETA2 * 95% confidence interval estimate using the adjusted standard error - * Equation (R12.3), p.265 SAMPLE 1 1 GEN1 ALPHA=0.025 * Get a critical value from the t-distribution DISTRIB ALPHA / TYPE=T DF=32 INVERSE CRITICAL=TVAL GEN1 LOW=BETA:1-TVAL*SEBETA2 GEN1 UP=BETA:1+TVAL*SEBETA2 PRINT TVAL LOW UP * Generalized Least Squares - Equation (R12.7), p.270 SAMPLE 1 34 AUTO LA LP / LOGLOG ITER=1 * A Lagrange Multplier Test - Section 12.6.2, pp. 274-275 * The variable EHAT contains the residuals from the OLS regression. GENR LEHAT=LAG(EHAT) * Set the initial values to zero. SAMPLE 1 1 GENR LEHAT=0 SAMPLE 1 34 OLS LA LP LEHAT * Prediction with AR(1) errors - Section 12.7 * Predict for a sugar-cane price of 0.4 * Allocate variables for the prediction exercise. DIM LA1 36 LP1 36 LYHAT 36 FCSE 36 * Repeat the GLS estimation. SAMPLE 1 34 GENR LA1=LA GENR LP1=LP SAMPLE 35 36 GENR LP1=LOG(0.4) SAMPLE 1 34 AUTO LA1 LP1 / LOGLOG ITER=1 * The FC command specifies the following options: * ESTEND= The final observation T of the estimation period * BLUP "Best predictor" * PREDICT= Save the log predictions in the variable LYHAT * Note: The forecast diagnostics listed by the FC command have * no meaningful interpretation in this example that computes * out-of-sample predictions. * The forecast diagnostics are only valid for within sample predictions. FC / MODEL=AUTO ESTEND=34 BEG=34 END=36 BLUP LIST PREDICT=LYHAT FCSE=FCSE * Take anti-logs to get the predictions. SAMPLE 35 36 GENR YHAT=EXP(LYHAT) PRINT YHAT * The correct anti-log predictions are below. GENR YHAT=EXP(LYHAT+FCSE*FCSE/2) PRINT YHAT * A reference for anti-log prediction is: * Charles R. Nelson, Applied Time Series Analysis for Managerial * Forecasting, 1973, Holden-Day (see, pp. 161-165). STOP