I am trying to export fixed effects model estimated with fixest
using texreg
. It yields an error:
> library(fixest)
> library(texreg)
>
> race <- sample(c(0,1), replace=TRUE, size=100)
> sex <- sample(c(0,1), replace=TRUE, size=100)
> stranger <- sample(c(0,1), replace=TRUE, size=100)
> dat <- data.frame(cbind(race, sex,stranger))
>
> # Error happens when adding fixed effect
> model1 <- feols(stranger ~ race|sex, data=dat)
> texreg(model1)
Error in validityMethod(object) :
gof.names and gof must have the same length!
(reprex credit: Britte van Tiem)
GOF is goodness-of-fit. I lurked in the source code using View(texreg:::extract)
and it seems the problem is with the calculation of R^2 and Adjusted R^2:
> texreg:::extract(model1)
Error in validityMethod(object) :
gof.names and gof must have the same length!
> texreg::extract(model1,include.rsquared = F, include.adjrs = F)
coef. s.e. p
race 0.01061844 0.1296893 0.9479921
GOF dec. places
Num. obs. 100 FALSE
Num. groups: sex 2 FALS
I cannot understand how to get around it. Does anyone have a fix for this? A related problem is here but without the reprex. Removing GOF in texreg with fixest library's feols regression object in R