Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st:panel data manipulation

From   "Michael S. Hanson" <>
Subject   Re: st:panel data manipulation
Date   Sat, 14 Aug 2004 02:57:30 -0400

On Aug 14, 2004, at 2:20 AM, caglar wrote:

Thanks for your suggestion. Actually, I tried to create lags and leads for my explanatory variables before. When I include all the leads and lags in an equation like the one below, STATA does not even do the estimation as there is no observation.

Y_i(t)= X_i(t) +L.X_i(t)+L2.X_i(t)....+F.X_i(t)+F2.X_i(t)..F8.X_i(t)

Even if the above equation were estimated, this equation would not give me coefficients on the variables from the regression

Y_i(t) = X_i(t) + X_i1987 + X_i1988+....+X_i1997

i:1...N while t:1987..1997

I wonder if there is any command in STATA that will include all past and future values of the explanatory variables for every cross section over the 1987-1997 time series?
Not that I know of. And I'm not certain you can easily do what you want -- nor can I think of a statistically valid reason to do it. But since you asked, there is (conceptually, at least) a way to get Stata to do what you say you want.

You need to create 11 new variables: Xi_1987 - Xi_1997. The value of Xi_1987 for each year t in your sample should be set to the 1987 value of Xi. That is, you repeat the 1987 values for the 1988 observations on Xi_1987, and for the 1989 observations, and for the 1990 observations, and so on. Repeat similarly for Xi_1988 through Xi_1997. Then run your proposed regression.

If I'm not mistaken, as you have written your proposed regression X_i(t) will be perfectly collinear with the variables you just created. I think Stata will just drop a regressor in that case.

Again, I cannot conceive of a situation in which one might want to do this, but I presume you have. Almost certainly theory suggests using relative dates, as Clive suggested with the L. and B. operators, rather than the absolute dates you have requested. Best of luck.

-- Mike

* For searches and help try:

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