Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: bug in areg when using lag notation

From   Tatyana Deryugina <>
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.


Tatyana Deryugina

Lecturer, Department of Finance
University of Illinois, Urbana-Champaign
(925) 349 - 8999 (cell)
*   For searches and help try:

© Copyright 1996–2016 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index