lrberge / fixest

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

R Session Aborted with IV when all variables are collinear with the fixed effects #371

Closed Oravishayrizi closed 7 months ago

Oravishayrizi commented 1 year ago

Hi Laurent, Thank you again for your efforts in developing and maintaining this useful package!

I encountered what seems to be a bug in the latest version of fixest (10.0.4). I find out that when I estimate regression using with IV, and all the variables are collinear with the fixed effects the session crashes (instead of raising an error message). Below you can find a minimal reproducible example of the potential bug.

library(fixest)
packageVersion('fixest') # 0.10.4

df<-data.frame(x=rnorm(8),
               y=rnorm(8),
               z=rnorm(8),
               V1=rep(0:1,each=4))

# Raise an error that can be handled
OLS<-feols(y~V1|V1,df) 

# crashes the session
TSLS<-feols(y~V1|V1|x~z,df)  
lrberge commented 7 months ago

Hi Or, thanks for the report and the reproducible example! Now fixed.