fwildclusterboot icon indicating copy to clipboard operation
fwildclusterboot copied to clipboard

Problems with fixest::feols and endogenous covariates (wild cluster bootstrap for IV estimation)

Open LuisNavarro07 opened this issue 1 year ago • 1 comments

Hello, I am trying to use the wild cluster bootstrap for a two stage least squares estimation absorbing for fixed effects.

I believe the problem is at line 86 of the boottest function when the function preprocess2.fixest gets the content from the fixest object with the estimation results. It works for standard feols estimation but not for the one two stage least squares.

This is snippet of the code I am running

Code

  • Dep var: log_income
  • Endog Indep var: treatment
  • Instrument: proposition_vote
  • Fixed effects: group_id1
  • Cluster: group_id1

data(voters)

  • Model m1 <- feols(log_income ~ 1 | group_id1 | treatment ~ proposition_vote, data = voters)
  • Bootstrap boottest(m1, clustid = "group_id1", param = "fit_treatment", B = 10000)

Error

Error in preprocess2.fixest(object = object, clustid = clustid, R = R_long, : object 'X' not found

I think the error is probably caused by the differences on the objects created by feols for the classic fixed effects implementation vs the two stages least squares estimation.

LuisNavarro07 avatar Oct 11 '24 13:10 LuisNavarro07

Wow, hi @LuisNavarro07 , i completely missed this one. Sorry! The issue is that the IV estimator only works with the ivreg function from the ivreg package but not via fixest.

s3alfisc avatar Mar 10 '25 22:03 s3alfisc