*
* AR1.RPF
* Example of estimation of a model with AR(1) errors
* RATS User's Guide, Example from Section 2.4.
*
cal(a) 1959
open data ar1.prn
data(format=prn,org=columns) 1959:1 1998:1
*
* OLS regression
*
linreg y
# constant x
*
* First difference regression. This may be the best choice if the
* autocorrelation coefficient is close to 1. (Note that the coefficient
* on the CONSTANT gets zeroed out, since it's eliminated by first
* differencing).
*
ar1(rho=1.0) y
# constant x
*
* AR1 regression using several methods. HILU and CORC should give almost
* identical answers unless there are multiple roots.
*
ar1(method=hilu) y
# constant x
ar1(method=corc) y
# constant x
ar1(method=maxl) y
# constant x
*
* OLS with Newey-West standard errors. This allows for autocorrelation
* of up to four lags.
*
linreg(robust,lwindow=neweywest,lags=4) y
# constant x