0

In displaying fixed effects regressions from fixest with modelsummary, I want to remove the default stats of AIC and BIC, and keep only the FE variable and the sample size, in that order.

I don't know how to refer to the "FE:[Variable] X" stat in modelsummary. Is that a gof statistic? It doesn't show up in modelsummary::gof_map. I'd rather not use regex as in gof_omit since it is harder to teach.

Here I attempted gof_map = c("nobs", "FE") but that didn't work.

library(modelsummary)
library(fixest)
library(readr)

url <- 'https://vincentarelbundock.github.io/Rdatasets/csv/HistData/Guerry.csv'
dat <- read_csv(url)


# want to only keep FE and N, in that order
modelsummary(feols(Literacy ~ Wealth | Region, dat), 
             gof_map = c("FE", "nobs"), 
             output = "markdown")

#> NOTE: 1 observation removed because of NA values (Fixed-effects: 1).
Model 1
Wealth -0.113
(0.071)
Num.Obs. 85
# FE does not show up

Created on 2022-10-06 by the reprex package (v2.0.1)

shiro
  • 578
  • 3
  • 9
  • I recommend you use the `gof_omit` argument. Refer to the main documentation: https://vincentarelbundock.github.io/modelsummary/reference/modelsummary.html – Vincent Oct 07 '22 at 02:06
  • 1
    You can also call `get_gof(model)` to extract a data frame with the "raw" names of each statistic, in the format they should appear if you want to use `gof_map`. – Vincent Oct 07 '22 at 02:07
  • ok the second comment is what I was looking for. I understand how to use `gof_omit`, but a `gof_include` will be easier to teach to my students. – shiro Oct 07 '22 at 22:17
  • The `gof_map` argument can be used as a `gof_include`, by supplying a character vector. Please see the latest documentation. – Vincent Oct 08 '22 at 10:09
  • @Vincent I meant that `gof_omit` accepts regex but `gof_map` does not? e.g. `gof_map = "FE"` will not retain all gofs that include the character "FE". I can open a issue. – shiro Oct 11 '22 at 21:07
  • By all means. But `gof_omit` accepts negative lookaheads, to *keep* statistics instead of omitting them. See the docs for `coef_omit`: https://vincentarelbundock.github.io/modelsummary/reference/modelsummary.html – Vincent Oct 12 '22 at 00:49

0 Answers0