Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65136

Recovering one fixed effect with several fixed effects

$
0
0
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
  1. Code:
    xtreg y i.cityXday, fe i(individual)
    and use the coefficients of i.cityXday or alternatively
  2. Code:
    xtreg y i.individual, fe i(cityXday)
    and get the FE through
    Code:
    predict, u
    and adding
    Code:
    _b[constant]
    or even
  3. Code:
    reg y i.individual i.cityXday
    and use the coefficients of i.cityXday
I'm having two doubts. First, I am working with very large data. That means in practice 50 cities, 365 days, 4000 individuals per city. This implies
Code:
i.cityday
are 18250 dummies and
Code:
i.individual
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:
Code:
reg y_demeaned i.cityXday i.city
as this is the same as
Code:
reg y_demeaned i.cityXday
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

Viewing all articles
Browse latest Browse all 65136

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>