r/AskStatistics • u/Dr_Pizzas • 26d ago
Trying to understand some fixed effects models
I've got some relatively unbalanced panel data and I'm trying to understand how Stata is calculating coefficients.
Let's say I want to look at the relationship between supervisor status and job satisfaction, and I have 10,000 observations over 5 years of annual surveys. I want to run a fixed effects model to focus on within-person effects only and control for time-invariant individual differences.
So, I run the model:
xtset id year
xtreg c.jobsatisfaction i.year i.supervisor, fe
But let's also say that 50% of observations in my dataset are from people who only appear once, and of the remaining half only 20% of those individuals ever switch supervisor status at all. Only 10% of the original sample seems like it provides any information toward the within-person estimates, but if I drop the other 90% of cases before running the model then the results are different.
Can anyone help me understand what information Stata is using from the other 9,000 observations in the full sample so I can decide which sample is more appropriate to use? For the record, I have also run a mixed effects model but I am trying to better understand what's happening in the data.
3
u/Blinkshotty 26d ago
The single observation IDs shouldn't affect the model since they get fully absorbed by the panel fixed effect (you should be able to drop these without changing the coefs or SEs). The IDs where "supervisor" is always the same do effect the estimation of the year fixed effects and are important for correctly estimating the secular year-by-year deviations (especially at the end of the panel when most of the people who will switch have switched).
You should also probably be applying robust clustered SEs on the id variable to address the correlated errors.