I am working with unbalanced panel data for several hundred companies
over a
period of years. I am inclined to use the time series operators
L.varname,
L2.varname,..., L9.varname, but am not sure how to make them work
within the
construct of my problem. I have used tsset to tell Stata I am
working with
panel data. What I need is for L.varname to refer to varname_t-1
(which it
does), but I want to be able to change the value of 't' for each
company.
For example, say I have a company with 14 years of data. I am running a
nonlinear regression and the equation specifies a 10 period model --
in my
example I want the equation to incorporate data for the company in years
5-14, 4-13, 3-12, 2-11, and 1-10 so that all possible 10-year periods
for
that company are included in the regression. Is there a way to program
Stata for changing the value of t (in this case t=14, 13, 12, 11, 10) so
that I can utilize the time series operators?
No. With or without the TS operators, this will not work. If you
want to run a regression that includes all possible ten-year time
spans as separate panels, you will have to create them as separate
panels and pretend that this firm actually appears five times with
different data. When you do that, though, you really should use
cluster standard errors to account for the fact that it is the same
firm (and overlapping observations).
something like
webuse grunfeld, clear
drop if company>3
drop if time>10
* say we want to run all possible 7-period time spans
* for each firm: 1-7, 2-8, 3-9, 4-10
expand 2 if time==2 | time==9
expand 3 if time==3 | time==8
expand 4 if time>=4 & time<=7
reg invest mvalue, cluster(company)
* the lack of indep obs will make a big difference
* in the std errs of such a regression