I'd like to report the first and the second stage results from feols()
IV regression using modelsummary()
. I couldn't find a way (except running the first stage as a separate model).
I can display first and second stage results using etable()
like this:
library(fixest)
library(tidyverse)
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 an instrumental variable model
mod <- feols(y ~ x1 | fe | x_endo_1 x_endo_2 ~ x_inst_1 x_inst_2, base)
# First and second stage results
etable(mod, stage = 1:2)
I'd appreciate any pointers.
Thanks, Umut
CodePudding user response:
The first-stage IV regression model summary can be generated with:
modelsummary::modelsummary(mod$iv_first_stage)