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
data with both ICD9 and ICD10 - please helpHi, I have a PHC4 dataset that has both ICD9 and 10 codes merged in the same variables (for example…
Arellano-Bond test AR(2)Dear Statalisters, I have one doubt about the result of my Arellano-Bond test for autocorrelation i…
local interpolationDear Statalisters I was wondering if anyone has written or knows of a function that obtains the best…
Cumulative sum by order and idHi all, I am working on this dataset, in which I would like to test whether the cumulative sum of t…
Interactions with time in linear mixed models (repeated data)Hi all, I'm working on the impact of blood pressure variability on cognitive function over time. I …
Subscribe to:
Post Comments (Atom)
0 Response to Help with Time trends and collinearity in a panel data set
Post a Comment