lrberge / fixest

Fixed-effects estimations
https://lrberge.github.io/fixest/
361 stars 59 forks source link

feols computes infeasibly small standard errors #438

Closed NickG-e61 closed 10 months ago

NickG-e61 commented 10 months ago

exampledata.csv

As an example, running the following line on the linked dataset (where DV and EV are randomly generated) reports a p-value of 1.8e-15. There should be plenty of degrees of freedom.

feols(DV ~ EV | state + as.factor(month), data=exampledata)

I'm also getting funny looking standard errors in other cases, e,g, converting a factor to a set of dummies and then getting the same standard error on every dummy coefficient. Can give more details if you'd like.

lrberge commented 10 months ago

Hi, and thanks for making the data available, but could you report the output you are referring to with ready to go code?

Did you compare with other software (lm/lfe/Stata/Julia)?

NickG-e61 commented 10 months ago

Sure, the output is attached, for fixest and for lfe.

image

lrberge commented 10 months ago

Thanks, now it is clear:

By default, if the argument vcov is not provided, fixest clusters the SEs wrt the first fixed-effect, here this is state. The current lfe SEs are "iid" so the comparison doesn't hold.

You need to know what kind of standard-errors you want ("iid", "heteroskedasticity-robut", "clustered"?) and then pass it into the vcov argument. The problematic SEs come from clustering with such a few number of clusters (it shouldn't be done).

NickG-e61 commented 10 months ago

OK, thanks for clarifying. Since there is no default argument for vcov, my assumption was that it assumes iid errors. Others might assume this too.

lrberge commented 10 months ago

Sure. The use case is individual panel data.

The type of SE is clearly stated though: image

Closing then. Thanks for reporting the outputs.