Dearest, I have read a lot of the threads before posting this question, however, did not seem to get an answer for it. I have panel data (firms and years). The firms are from different countries and I want to run a regression with Firm fixed effects, however, I want to have robust and clustered standard errors at the country-year level. I tried using : xtreg, cluster at country-year level, however, it provides error "panels are not nested within clusters". And as I understand, it is because I have repeated countries values within the same panel. I have already created a new panelid that mirrors each firm/country combination and then clustered on it, however I still get the same error.. What would be an approach to do this? Please bear with me, I am a new Stata user.
Any insight would be greatly appreciated!!
Code:
xtreg y x1 x2 x3 x4 x5 i.year, fe cluster(country year)
and:
Code:
egen X=group(id country)
Code:
xtreg y x1 x2 x3 x4 x5 i.year, fe vce (cluster X year)
Comment