I do not believe that stargazer supports this kind of model. However, it is supported out-of-the-box by the modelsummary package. This package allows you to add notes, and the tables it produces are extremely customizable, because modelsummary
supports several backend packages to create and customize tables: kableExtra
, gt
, flextable
, huxtable
. Tables can also be exported to many formats, including HTML, Markdown, LaTeX, JPG, data.frame, or PDF.
(Disclaimer: I am the author of modelsummary
.)
Here is an example with a simple linear regression model:
library(fixest)
library(modelsummary)
# create a toy dataset
base <- iris
names(base) <- c("y", "x1", "x_endo_1", "x_inst_1", "fe")
base$x_inst_2 <- 0.2 * base$y + 0.2 * base$x_endo_1 + rnorm(150, sd = 0.5)
base$x_endo_2 <- 0.2 * base$y - 0.2 * base$x_inst_1 + rnorm(150, sd = 0.5)
# estimate
mod <- feols(y ~ sw(x1, x_endo_1, x_inst_1) | fe, data = base)
# table
modelsummary(mod)
You can use the various formula functions that fixest
offers like step-wise inclusion of covariates:
mod <- feols(y ~ sw(x1, x_endo_1, x_inst_1) | fe, data = base)
modelsummary(mod)
And modelsummary
also supports instrumental variable estimation. This will show both stages side-by-side:
mod <- feols(y ~ x1 | fe | x_endo_1 + x_endo_2 ~ x_inst_1 + x_inst_2, data = base)
modelsummary(summary(mod, stage = 1:2))
stargazer
supports this kind of model. However, it is supported out-of-the-box by themodelsummary
package. This package allows you to add notes and tables are infinitely customizable. Of course, this is a different package, which is why I write this as a comment instead of an answer. (Disclaimer: I am the author) – Mosstrooperstargazer
package. FWIW, there's afixest
example on the website: vincentarelbundock.github.io/modelsummary/articles/… – Mosstrooper