Dear Statalister,
I have a panel data set (xtset msa year) for 291 MSAs over eight years. I have run a regression with leads and lags of the treatment, MSA time trends, and two-way fixed effects. I have created leads and lags for six time periods in total. Primarily, I would like to know if I have used the right commands to create various dummies. I have a feeling it is not correct as I face the issue of collinearity among the time trend variables. The code follows for your reference.
* code to create the leads and lags
[gen treatf1 = f1.treat][/CODE]
[replace treatf1 = treatf1[_n-1] if treatf1 == .][/CODE]
[gen treatf2 = f2.treat][/CODE]
[replace treatf2 = treatf2[_n-1] if treatf2 == .][/CODE]
[gen treatf3 = f3.treat][/CODE]
[replace treatf3 = treatf3[_n-1] if treatf3 == .] [/CODE]
[gen treatl1 = l1.treat][/CODE]
[replace treatl1 = treat[_n+1] if treatl1 == .][/CODE]
[gen treatl2 = l2.treat][/CODE]
[replace treatl2 = treatl2[_n+1] if treatl2 == .][/CODE]
[replace treatl2 = treatl2[_n+1] if treatl2 == .][/CODE]
[gen treatl3 = l3.treat][/CODE]
[replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]
[replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]
[replace treatl3 = treatl3[_n+1] if treatl3 == .][/CODE]
* creating a time trend for each variable
[bys msa: gen time = _n][/CODE]
* Creating the interaction term between time and msa to generate msa time trends
[xi i.msa i.year i.msa*time][/CODE]
[xtreg `x' treatf2 treatf1 treat treatl1 treatl2 treatl3 prop_pop_age_20_60 pct_atleast_bach prop_labour_force prop_unemployed_pop prop_unemployed_women median_earnings i.year, fe vce(cl msa)][/CODE]
I run the above regression in a loop as I have more than one dependent variable.
This regression runs without any collinearity issue for all the dependent variables.
I now add MSA time-trends to the above regression.
[xtreg `x' _ImsaX* treatf2 treatf1 treat treatl1 treatl2 treatl3 prop_pop_age_20_60 pct_atleast_bach prop_labour_force prop_unemployed_pop prop_unemployed_women median_earnings i.year, fe vce(cl msa)][/CODE]
Here I face the issue of collinearity for one of the dependent variables and not for the other. This is quite odd to me as I believe collinearity is independent of the dependent variable.
From previous posts on this forum, I gather this could be an issue of too many variables with too little observations in comparison. OR. It could be that the time dummies are taking up all the variation across time, but I am referring to Autor(2003) who runs the same regression.
However, I am not sure. I request your help for the same.
Thank you!
Related Posts with Help with Time trends and collinearity in a panel data set
Comparing GMM estimatesI am trying to write my own GMM program in a different language and want to compare results with Sta…
Problem with -replace- var ... if ... I was suprised to see that the last two commands ("replace new_var = 0 [...] and replace new_var = …
spmatrix fromdataHi all, I have a question. Recently, I wanted to run the spxtregress command and I checked the Stat…
Difference in difference with multiple treatmentsDear Stata community I am experiencing a problem regarding my difference in difference analysis. I…
Work without shapefileHi to everyone. I state that I am new to Spatial Econometrics. My data set is composed of 32 gasolin…
Subscribe to:
Post Comments (Atom)
0 Response to Help with Time trends and collinearity in a panel data set
Post a Comment