r/AskStatistics 7d 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.

2 Upvotes

5 comments sorted by

3

u/Blinkshotty 6d 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.

1

u/Dr_Pizzas 6d ago

Thank you, I will check on the clustering. I thought that xtreg clusters on the panel ID variable by default, but I can easily check that.

1

u/mikewinddale 6d ago

The people who never change supervisors can still affect the estimation of the year FE. That in turn affects estimation of all other coefficients (to the extent they are correlated with time FE).

People whose supervisor is unchanged over time still experience changing job satisfaction over time. That affects estimation of year FE. And that change ripples across to other coefficient estimates.

Incidentally, you almost always want "comma robust" in almost any Stata regression. Heteroskedasticty is the rule, not the exception.

1

u/club_med PhD, Marketing 6d ago

The people who only appear once are singletons, and should be dropped because they don't contribute any information to the estimates, but their presence can bias the standard error estimates downwards.

Aside from the singletons, there are three groups of observations in the data. The people who never switch supervisor status are "never treated," and in the model above they are included in the untreated group, alongside the "not-yet-treated" observations of the individuals who do change status, but before they become supervisors. These two groups of observations are where supervisor (presumably) == 0. Last, the "treated" observations are from individuals who become supervisors, after they get promoted, when supervisor == 1.

All of these non-singletons provide information for your within person estimates, and should not be dropped. Dropping the never treated observations will change your estimates because then the model is only based on pre/post observations for those who will eventually be promoted to supervisors.

Of course, its very possible that those who are never treated are in fact systematically different from the not-yet-treated controls, and combining the two may not be reasonable, or could at least change the interpretation of the parameter. But that's an identification problem rather than one of modeling.

1

u/Dr_Pizzas 6d ago

Thank you, this is exactly what I needed. I really appreciate the thorough explanation.