Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Tatyana Deryugina <tatyanad@mit.edu> |
To | statalist@hsphsun2.harvard.edu |
Subject | st: bug in areg when using lag notation |
Date | Fri, 18 Nov 2011 15:21:05 -0600 |
Hi everyone, It seems as though there's a problem with the "areg" command when one has lag notation in the equation and is trying to predict residuals: webuse abdata, clear tsset id year areg wage L.emp, absorb(id) predict wage_r, resid You get a "not sorted" error, which is not solved by re-running the tsset command right before the predict or by running "sort id year" right before the predict. This error doesn't show up when you're trying to compute fitted values (e.g., "predict wage_hat"). It's definitely caused by the lag notation. The following DOES not give you an error: webuse abdata, clear gen Lemp=L.emp areg wage Lemp, absorb(id) predict wage_r2, resid Just thought I'd put that out there. It seems like this bug should be pretty easy to fix, given that fitted values are easily computed. Best, Tatyana --------------------------------------------------------------- Tatyana Deryugina Lecturer, Department of Finance University of Illinois, Urbana-Champaign (925) 349 - 8999 (cell) * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/