sergiocorreia / ivreghdfe

Run IV/2SLS with many levels of fixed effects (i.e. ivreg2+reghdfe)
MIT License
77 stars 27 forks source link

F-statistics and Clustering #32

Closed wesaustin closed 3 years ago

wesaustin commented 3 years ago

Hi Sergio,

Thanks for your reghdfe and ivreghdfe packages. I've found them immensely useful over the past few years.

I'm running an IV regression with a large number of instruments (300-400). I'm also using a large number of fixed effects representing counties and state-by-week (>1000 FEs). In some specifications, the instruments are colinear with the FEs. This creates the problem that F statistics don't calculate. The specific error message is:

"warning: -ranktest- error in calculating weak identification test statistics; may be caused by collinearities"

I solved this by manually generating the FEs, checking which are colinear, and dropping them from the regression. However, when I then clustered by county and state, I ran into a new problem that prevents the F statistics from computing. I'm unsure of the nature of this issue, although it appears similar to one previously raised by Tatyana Deryugina in 2018. The new error message reads:

"Warning: estimated covariance matrix of moment conditions not of full rank. overidentification statistic not reported, and standard errors and model tests should be interpreted with caution. Possible causes: number of clusters insufficient to calculate robust covariance matrix singleton dummy variable (dummy with one 1 and N-1 0s or vice versa) partial option may address problem."

From the code for her associated paper, it seems like Deryugina dealt with this issue by simply running reghdfe with the old option. The old option, however, no longer appears to work with reghdfe. Is there something else I can try to include clusters? If you have any work-arounds for the colinear instruments, that would also help immensely.

Thanks again.