Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: using lags within -xi-


From   Scott Cunningham <[email protected]>
To   [email protected]
Subject   Re: st: RE: using lags within -xi-
Date   Tue, 22 Aug 2006 14:35:37 -0400

On Aug 22, 2006, at 2:30 PM, Jason Yackee wrote:

Stata 8 does not support the l. command with xtreg, though it does with xtpcse. In stata 8 to use a lagged dv with xtreg you have to generate the lag as a separate variable, e.g. by gen lag2gdp = l2.gdp. You can't do it on the fly. xtreg gdp l.gdp inflation l.inflation will not work in xtreg. On the other hand, xtpcse gdp l1.gdp inf l1.ing will work.

Stata 9 _does_ support the l. command with xtreg (a good reason to upgrade). I just did it. Don't know why it is not working for you unless your data isn't tsset and sorted correctly.

When generating your lagged variables, make sure you have tsset your data first, & that it is sorted by unit then year. this may be your problem

JY
By unit, then year. That appears to have been it. My unit is four different identifiers, and I had -egen- a group variable, and then - tsset- on that. I had forgotten this when I was sorting. Thanks for reminding me. It's working now. -sc

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index