* R. Carter Hill, William E. Griffiths and Guay C. Lim, * Principles of Econometrics, Fourth Edition, Wiley, 2011. * Chapter 9.3.2 Serially Correlated Errors READ (phillips_aus.dat) / names GEN1 nobs=$N * Estimation of a Phillips Curve, Equation (9.22), page 352. GENR du=u-LAG(u) SAMPLE 2 nobs * The DWPVALUE option calculates an exact p-value for the * Durbin-Watson test statistic. OLS inf du / RSTAT DWPVALUE RESID=ehat * With the DIAGNOS command the ACF option reports: * RHO the autocorrelations, values for the first five lags are * listed on page 353. * T-STAT the Z test statistics as described on page 349. DIAGNOS / ACF * Chapter 9.4.1 A Lagrange Multplier Test * The estimated residuals were saved earlier in ehat. GENR Lehat1=LAG(ehat) * Set the initial values to zero. SAMPLE 1 2 GENR Lehat1=0 SAMPLE 2 nobs * Estimate Equation (9.24), page 354. OLS inf du Lehat1 * The LM-test statistic is the t-test statistic reported for * the coefficient on Lehat - see the numeric results reported * for (ii) in the middle of page 354. * Alternative method - Estimate Equation 9.26, page 354. OLS ehat du Lehat1 * Calculate the LM test statistic as reported in (iv), top of page 355. GEN1 LM=$N*$R2 * Calculate a p-value DISTRIB LM / TYPE=CHI DF=1 GEN1 pvalue=1-$CDF PRINT LM pvalue * Testing Correlation at Longer Lags DO #=2,4 GENR Lehat#=LAG(ehat,#) * Set initial values to zero. GEN1 n1=#+1 SAMPLE 1 n1 GENR Lehat#=0 SAMPLE 2 nobs ENDO * Run the artificial regression OLS ehat du Lehat1-Lehat4 * Calculate the LM test statistic as reported in (vi), page 355. GEN1 LM=$N*$R2 * Calculate a p-value DISTRIB LM / TYPE=CHI DF=4 GEN1 pvalue=1-$CDF PRINT LM pvalue * Least squares estimation with Newey-West standard errors, page 358. * Note: the textbook warns that different software packages may use * different calculation methods for the standard errors. OLS inf du / AUTCOV=1 * Chapter 9.5.2.b Nonlinear Least Squares Estimation * Estimate Equation (9.44), page 362. GENR Linf=LAG(inf) GENR Ldu=LAG(du) SAMPLE 3 nobs NL 1 / NCOEF=3 EQ inf = b1*(1-rho) + b2*du + rho*Linf - rho*b2*Ldu END * Estimate Equation (9.49), page 364. OLS inf Linf du Ldu * The chi-square test proposed on page 364. * On the TEST command the variable names represent coefficients. TEST Ldu=-Linf*du * Estimate Equation (9.51), page 364. SAMPLE 2 nobs OLS inf Linf du * Estimate Equation (9.57), page 368. * A distributed lag for an explanatory variable is specified with * the special notation x(first.last). SAMPLE 1 nobs OLS inf inf(1.4) du STOP