* * Empirical example from pp 140-143 * open data consump.dat calendar 1950 data(format=prn,org=columns) 1950:1 1993:1 year y c * set logc = log(c) set logy = log(y) * linreg logc # constant logc{1} logy cdf(title="Durbin h test") normal sqrt(%nobs)*%rho/sqrt(1-%nobs*%stderrs(2)**2) linreg %resids # constant logc{1} logy %resids{1} cdf(title="Breusch-Godfrey SC Test") chisqr %trsq 1 * * Preliminary IV estimates * instruments constant logy{0 1 2} linreg(inst) logc / resc # constant logc{1} logy * * Wallis estimate of rho. This is most easily computed by using the CORRELATE * instruction with the option METHOD=YULE. That computes the ratio of the sums, * which just needs to be rescaled and the bias term added. * corr(nocenter,number=1,method=yule,corrs=rhow,print) resc compute rhowallis=rhow(2)*%nobs/(%nobs-1)+3.0/%nobs * ar1(method=pw,rho=rhowallis) logc # constant logc{1} logy * * Hatanaka two-step estimator * The Hatanaka estimate of rho is most easily done using the CMOM instruction. * This gets the inner products over the correct samples. * cmom # resc resc{1} compute rhohatanaka=%cmom(1,2)/%cmom(1,1) set cstar = logc-rhohatanaka*logc{1} set ystar = logy-rhohatanaka*logy{1} set istar = 1-rhohatanaka * * This is slightly different from the procedure shown in the text because the * intercept should also be adjusted, either before (as is done here), or after * estimation. * linreg cstar # istar cstar{1} ystar resc{1} * * This uses LINREG with CREATE to produce full regression output. The coefficient * on the lagged residual is adjusted to show the two step estimate of rho. * compute %beta(4)=%beta(4)+rhohatanaka linreg(create,form=chisquared,covmat=%xx*%seesq,title="Hatanaka Two-Step") logc # constant logc{1} logy resc{1} * * The reason for the two and three step methods is that the Cochrane-Orcutt step * is based upon inconsistent estimates, and it's quite likely that there will be * multiple local minima in the sum of squared residuals surface. An alternative, * which does provide consistent estimates, is to use the Hildreth-Lu search * method. * ar1(method=hilu) logc # constant logc{1} logy