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
Running a loop n times with different outcome variable and storing the p values in an output matrixI am trying to run loop within loop and get the p values in the matrix. I want to assign random trea…
Can you define outreg2 options as a macro?I want to print estimation output with outreg2 as a tex file. I combine several results for which on…
How to use Loocv?I am studying econometrics for a PhD and am more familiar with STATA, so I am currently using that f…
Scatter plot with linear fit of two-period independent variable and one dependent variable. Dear All, I've data on y for period 1 and data on x for periods 4 and 5. I want to graphically dep…
Fama MacBeth Regression with missing explanatory variablesI am trying to run a Fama-MacBeth regression with multiple independent variables. The dependent vari…
Subscribe to:
Post Comments (Atom)
0 Response to Help with Time trends and collinearity in a panel data set
Post a Comment