* * Dougherty, Introduction to Econometrics, 4th ed * Example from Section 12.3 * Fitting a model with AR(1) correction * open data demand.xls calendar(a) 1959:1 data(format=xls,org=columns) 1959:01 2003:01 adm book busi clot date dent doc dpi flow food furn gas gaso $ hous legl mags mass opht padm pbook pbusi pclot pdent pdoc pflow pfood pfurn pgas pgaso phous plegl $ pmags pmass pop popht prelg ptele ptob ptoys ptpe relg tele time tob toys tpe * set lghous = log(hous) set lgdpi = log(dpi) set lgprhous = log(100.0*phous/ptpe) * * By NLLS * nonlin rho b1 b2 b3 frml ar1frml = rho*lghous{1}+b1*(1-rho)+b2*(lgdpi-rho*lgdpi{1})+b3*(lgprhous-rho*lgprhous{1}) nlls(frml=ar1frml) lghous * * By AR1 * ar1 lghous # constant lgdpi lgprhous * * The published results don't appear to be correct. With the estimated rho fed * into AR1, we can reproduce the results in the book, but it's clearly a worse fit. * ar1(rho=.719102) lghous # constant lgdpi lgprhous