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

boottest() throws error when lm, feols, felm drop coefficients due to multicollinearity #43

Closed
s3alfisc opened this issue May 8, 2022 · 1 comment
Labels
bug Something isn't working

Comments

@s3alfisc
Copy link
Owner

s3alfisc commented May 8, 2022

When lm(), feols() or felm() drop variables due to multicollinearity, boottest() currently throws an error. This can be handled by dropping multicollinear variables in the pre-processing step via e.g. - this is how the sandwich package handles multicollinear covariates.

model_matrix2.lm <- function(object, collin.rm = TRUE, ...){
  
  if(inherits(object, "lm")){
    X <- model.matrix(object)
    if(collin.rm == TRUE){
      bn <- names(na.omit(coef(object)))
      X[,colnames(X) %in% bn]
    }
  }
  
  X
  
}

@s3alfisc s3alfisc added the bug Something isn't working label May 8, 2022
@s3alfisc
Copy link
Owner Author

s3alfisc commented Jun 1, 2022

close with ace208e

@s3alfisc s3alfisc closed this as completed Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant