Statalist The Stata Listserver


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

Re: st: lagged averages in a panel, if data is not available for every year


From   "Austin Nichols" <austinnichols@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: lagged averages in a panel, if data is not available for every year
Date   Tue, 5 Jun 2007 10:47:46 -0400

Carmine da Napoli --
I recommend you make the averages by hand, which will create the
average as missing if any period in the window is missing, and offer
flexibility limited only by your imagination (see -help tsvarlist- for
operators):

webuse grunfeld, clear
tsset
g ak=(L.ks+L2.ks+L3.ks)/3
la var ak "Average of prior three periods capital"
g ai=(L.inv+L2.inv+L3.inv)/3
la var ai "Average of prior three periods investment"
xtreg mv ak ai, fe cluster(com)

but be aware that the estimated impact of a three-prior-period average
need look nothing like the average impact of the three prior periods:

xtreg mv L(1/3).ks L(1/3).inv, fe cluster(com)
nlcom (_b[L.kstock]+_b[L2.kstock]+_b[L3.kstock])/3
nlcom (_b[L.inv]+_b[L2.inv]+_b[L3.inv])/3

On 5 Jun 2007 13:06:18 -0000, <dist@interfree.it> wrote:
My dataset is made up of a certain number of firms, and contains variables over the time period from 1995 to 2000. The panel in uncomplete and, in order to mitigate survivorship bias, companies are included in the analysis even if data is not available for every year.
Afer having sorted my dataset ( - sort id year - , - tsset id year - ), the regression equation to estimate is:
y_i,t = f( X1_i,t-3 , X2_i,t-3, ...)
where: "i" refers to the individual firms, "t" to the time period of the variable (measured at the accounting year end), and "t-3" to the average for the previous three years.
*
*   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–2023 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index