Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "No tidy method for objects of class felm" when using the lfe and broom package

I'm trying to tidy the results of my fixed effects linear regression model. Here's the FELM:

    model_fit <- 
  felm(
    dependent_variable ~
      independent_variable1 +
      independent_variable2 +
      independent_variable3 +
      independent_variable4 + 
    |as.factor(year)+
      as.factor(month),
    data = df
  )

Here's the code that I'm using to tidy those results and the error message:

model_results <- tidy(model_fit, conf.int = TRUE, conf.level = 0.95, fe=TRUE)
Error: No tidy method for objects of class felm

I've already updated RStudio, as well as the lfe, broom, and tidytext packages. It is my understanding that the tidy function should tidy felm objects, and the tidy.felm function no longer exists.

How can I use the tidy function for felm objects? And, if I am unable to use that function, what other function can I use to tidy my FELM?

like image 852
CFrancis99 Avatar asked Sep 16 '25 12:09

CFrancis99


1 Answers

To fix the issue:

  1. Restart R
  2. Call the broom library when using the tidy() function

So, for example:

library(lfe)

mod <- felm(y ~ x1 +x2 | factor(id) | 0 | id, data)
broom::tidy(mod)
like image 181
knrob Avatar answered Sep 19 '25 02:09

knrob