Dear Statalisters,
I have an outcome Y_ijt for individual i who lives in city j for day t. I would like to recover a version of Y which removes individual unobserved heterogeneity in the level of Y_ijt. In theory, I would like to estimate to achive that the following:
Y_ijt=alpha_i+lambda_jt+error
What I am interested in are the values of the cityXday FE lambda_jt. These will serve as dependent variable in a second stage.
In Stata-lingo I would run
are 18250 dummies and
200000 dummies. This will for sure lead to error "Too many variables specified". Therefore I would prefer option 1). Computationally I assume that I could do much better demeaning Y_ijt by individual level means. But then econometrically I would estimate Y_ijt-Y_ij=lambda_jt-lambda_j+error. But of course I cannot just run:
as this is the same as
I have no intuition if this will yield correct estimates at all.
Second, I need the regressions to really report all cityXyear FE and not omit any level. I also need to know if the constant estimated should be added or is part of the other FE dimension. It would be great if you could mention this in an potential answer.
Thank you for your hints! They are appreciated a lot.
Best
Felix
I have an outcome Y_ijt for individual i who lives in city j for day t. I would like to recover a version of Y which removes individual unobserved heterogeneity in the level of Y_ijt. In theory, I would like to estimate to achive that the following:
Y_ijt=alpha_i+lambda_jt+error
What I am interested in are the values of the cityXday FE lambda_jt. These will serve as dependent variable in a second stage.
In Stata-lingo I would run
-
Code:
xtreg y i.cityXday, fe i(individual)
-
Code:
xtreg y i.individual, fe i(cityXday)
Code:predict, u
Code:_b[constant]
-
Code:
reg y i.individual i.cityXday
Code:
i.cityday
Code:
i.individual
Code:
reg y_demeaned i.cityXday i.city
Code:
reg y_demeaned i.cityXday
Second, I need the regressions to really report all cityXyear FE and not omit any level. I also need to know if the constant estimated should be added or is part of the other FE dimension. It would be great if you could mention this in an potential answer.
Thank you for your hints! They are appreciated a lot.
Best
Felix