* * Example 5.2 * AR1.PRG * cal 1959 all 1998:1 open data ar1.prn data(format=prn,org=columns) * * OLS regression * linreg y # constant x * * First difference regression. This may be the best choice if the * autocorrelation coefficient is close to 1. * set dx = x-x{1} set dy = y-y{1} linreg dy # dx * * 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(robusterrors,lags=4,lwindow=neweywest) y # constant x