Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standard errors different for ivreghdfe and ivreg2 (even more so when using "small" option for ivreg2) #37

Closed
vendela-norman opened this issue Sep 22, 2021 · 3 comments

Comments

@vendela-norman
Copy link

Hi Sergio,

Would you be able to offer insight as to how the standard errors in ivreghdfe differ from those computed using ivreg2? My understanding from a previous thread (#21) was that "ivreghdfe" and "ivreg2, small" are supposed to yield the same standard errors. I can see that this is the case for the simple automobile example that you provided.

However, in a regression model that I'm running I find that adding the "small" option to ivreg2 makes the SEs diverge even more from ivreghdfe. Whereas "ivreg2" produces SEs that are far smaller than those produced by ivreghdfe, "ivreg2, small" yields much larger SEs (screenshot below):

Screen Shot 2021-09-22 at 5 13 38 PM

The dataset is not publicly accessible but the code looks something like:

ivreghdfe outcome (treatment =instrument) black white asian sat_score, robust a(i.pscore_group)
or
ivreg2 outcome (treatment =instrument) black white asian sat_score i.pscore_group, robust partial(i.pscore_group) small

where the pscore_group variable is a pretty finely-distributed variable (there are 9,619 observations and 4,375 distinct values of the pscore_group variable).

If I replace pscore_group with a set of indicators for a variable that is much less finely-distributed, the "ivreg2, small" standard error is indeed very close to that of "ivreghdfe" (.025526 vs .025523), and much closer than that of "ivreg2".

So why is it that when including a large number of fixed effects the standard errors of "ivreghdfe" and "ivreg2, small" differ so much? Does this come down to how the degrees of freedom are computed?

Thanks!

@sergiocorreia
Copy link
Owner

Since I can't see the dataset it's a bit hard to tell, but I have two guesses:

  1. ivreghdfe also drops singletons. To disable that, use the keepsingletons option and see how things change. I suspect this is the likely case b/c the more "finely-distributed" the FEs are, the more singletons there are.

  2. If that doesn't work, maybe check lines 237-239 here: https://github.com/sergiocorreia/ivreghdfe/blob/master/src/ivreghdfe.ado#L235

In summary, ivreghdfe doesn't just activate the small option, but also the noconstant, as well as disables the nopartialsmall option.

@vendela-norman
Copy link
Author

vendela-norman commented Sep 23, 2021

Hi Sergio,

Looks like keepsingletons did the trick. I mistakenly thought that ivreg2 accounted for singleton observations (at least the non-iterative ones) in its standard errors. Thanks so much!

Screen Shot 2021-09-23 at 2 43 47 PM

@sergiocorreia
Copy link
Owner

Great to hear that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants