问题
I want to report the results of both stages of my Two-Stage Least Square Regression but stargazer output only gives me the second stage.
I have calculated a Two-Stage Least Square Regression with the ivreg command in R. This is what my code looks like:
ivmodel1 <- ivreg(Y ~ X + W1 + W2 + W3 + W4 | W1 + W2 + W3 + W4 + Z, data = df)
where
Y = dependent variable (cont.);
X = endogenous independent variable (dummy);
W1-W4 = control variables;
Z = exogenous instrument (dummy)
Now I am having difficulties to report the first stage of the 2SLS regression. When I use the usual stargazer command:
stargazer(ivmodel1)
I only receive the resuts of the second stage but I also need the first stage estimates. Does someone know what commmand to use in R in order to receive the results of both stages?
回答1:
When you model each stage separately, you can hand both to stargazer
:
library(AER)
library(stargazer)
y <- rnorm(100, 5, 10)
x <- rnorm(100, 3, 15)
z <- rnorm(100, 3, 7)
a <- rnorm(100, 1, 7)
b <- rnorm(100, 3, 5)
# Fitting IV models
fit1 <- ivreg(y ~ x + a |
a + z,
model = TRUE)
fit2 <- ivreg(y ~ x + a |
a + b + z,
model = TRUE)
# Create latex table
stargazer(fit1, fit2, type = "text")
This comes from: R: Robust SE's and model diagnostics in stargazer table
来源:https://stackoverflow.com/questions/58542739/first-stage-iv-regression-output-in-r