* R. Carter Hill, William E. Griffiths and Guay C. Lim, * Principles of Econometrics, Third Edition, Wiley, 2008. * Chapter 9 SAMPLE 1 34 READ (bangla.shd) PRICE AREA STAT PRICE AREA GENR LA=LOG(AREA) GENR LP=LOG(PRICE) * OLS estimation - Equation (9.16), p. 233. * The LIST option lists the OLS residuals (Table 9.1, p. 233) and * a crude residual plot. * The RSTAT option gives the RHO estimate - Equation (9.18), p. 234. OLS LA LP / LOGLOG LIST RSTAT RESID=EHAT * Save the value of RHO stored in the temporary variable $RHO GEN1 RHO=$RHO * The SHAZAM output reports a correlation between one-period * apart residuals of 0.3992. * The textbook gives the estimate 0.404. * The reason for this numerical difference is not known. * ----------------------------------------------------------- * Check the calculation of RHO using Equation (9.18), p. 234. SAMPLE 2 34 * The variable EHAT contains the residuals from the OLS regression. GENR E1=EHAT*LAG(EHAT) GENR E2=LAG(EHAT)*LAG(EHAT) STAT E1 E2 / SUMS=TOT GEN1 RHO1=TOT:1/TOT:2 PRINT RHO RHO1 * ----------------------------------------------------------- * On the OLS command the AUTCOV= option is used for calculating * Newey-West standard errors (p. 235) SAMPLE 1 34 OLS LA LP / LOGLOG AUTCOV=1 * Note: The numeric estimates of the standard errors are different * from the textbook. Differences in the calculation method * need to be tracked down. * Nonlinear Least Squares of an AR(1) error model SAMPLE 2 34 GENR LAGA=LAG(LA) GENR LAGP=LAG(LP) * Equation 9.24, p. 236 and Equation 9.25, p. 237 NL 1 / NCOEF=3 EQ LA = b1*(1-r) + b2*LP + r*LAGA - r*b2*LAGP END * Note: Differences in calculated standard errors compared to * those reported in the textbook may be due to estimation * algorithm differences. * Another variation of the estimation of an AR(1) error model * Equation (9.28), page 239 OLS LA LP LAGP LAGA * Chapter 9.4 Testing for Autocorrelation SAMPLE 1 34 * The DWPVALUE option gives the Durbin-Watson p-value - * Appendix 9B (R12.8), pp. 261-2. OLS LA LP / LOGLOG RSTAT DWPVALUE * The ACF option on the DIAGNOS command reports the residual * correlogram, p. 240. DIAGNOS / ACF * On the SHAZAM output the STD ERR column reports the standard error * of the autocorrelation as 1/sqrt(T) where T is the sample size. * SHAZAM results for the correlogram are different from the results * printed at the bottom of p. 240. * This numerical difference may reflect a difference in * methodology. * A Lagrange Multplier Test - Chapter 9.4.2, pp. 242-3. * The estimated residuals were saved earlier in EHAT. GENR LEHAT=LAG(EHAT) * Set the initial values to zero. SAMPLE 1 1 GENR LEHAT=0 SAMPLE 1 34 * Estimate Equation 9.34, page 242. OLS LA LP LEHAT * The LM-test statistic is the t-test statistic reported for * the coefficient on LEHAT - see the numeric results reported * above Equation 9.34, page 242. * Alternative method - Estimate Equation 9.35, page 243. OLS EHAT LP LEHAT GEN1 LM=$N*$R2 * Calculate a p-value DISTRIB LM / TYPE=CHI DF=1 GEN1 pvalue=1-$CDF PRINT LM pvalue STOP