Hi there,
First off, thank you for taking your time to read through my question.
I have a panel data, which id is facility and time is year. It is an unbalanced panel of 25 years.
I am running panel fixed effect regression with year and industry fixed effects controlled for.
I have coded district and state of the facility location. Since each district / state may influence facility performance, I am wanting to cluster by district or by state.
Facility does not move district or state.
I have a following questions:
1) When I ran xtreg y X_i, i.year i.industry, fe vce(cluster state_abbreviation), where state_abbreviation is a string variable with abbreviated state name, e.g. "NY", "CA." The code would run fine and I would get clustered standard error.
However, when I run the code xtreg y X_i i.year i.industry fe vce(cluster state_id), where state_id is a state code ranging from 1 to 56 e.g. Alabama = 1, Alaska =2, I get an error message panels are not nested within clusters.
If anything, I had expected string variable clustervar would give an error, but not the integer clustervar, but while I can run cluster standard error with state_abbreviation, I cannot with state_id.
Has anyone experienced this? What might be the cause of this?
2) Likewise, when I tried to cluster by district of the state by using "district_state" (3 or 4 digit integer) created by egen district_state = concat (district state_id), I also get panel not nested within clusters.
In sum, what would be the cause of such error? Is unbalanced panel be the cause? Or does it have to do with some state/ district over-represented?
3) Lastly, do I even need clustered standard error? Could I say that since I am using panel fixed effect and all my facilities do not move in location, fixed effect would control for heterogeneity from location (district | state). Hence, if I do fixed effect and clustering, there is a redundancy?
My conceptualization of clustering may be completely off. This concept never clicked to me..
Your thoughts and feedback would be greatly appreciated.
Thank you for your time.
Please let me know if anything is unclear and I would be happy to elaborate.
Best.
DH
0 Response to Panel Fixed Effect, Clustering Standard Error (Panels are not nested within clusters)
Post a Comment