0

I am trying to produce a nice regression table for marginal effects & p-values from the probitmfx function, where p-values are reported under the marginal effect per covariate. An picture example of what I'd like it to look like is here Similar Output from Stata. I tried the stargazer function, as suggested here but this does not seem to work if I don't have an OLS / probit.

data_T1 <- read_dta("xxx")
#specification (1)
T1_1 <- probitmfx(y ~ x1 + x2 + x3, data=data_T1)
#specification (1)
T1_2 <- probitmfx(y ~ x1 + x2 + x3 + x4 + x5, data=data_T1)
#this is what I tried but does not work
table1 <- stargazer(coef=list(T1_1$mfxest[,1], T1_2$mfxest[,1]),
p=list(T1_2$mfxest[,4],T1_2$mfxest[,4]), type="text")

Any suggestions how I can design such a table in R?

wien25
  • 1

1 Answers1

0

You can probably use parameters package to produce a beautiful table:

Code:

library(mfx)
library(parameters)

# simulate some data
set.seed(12345)
n <- 1000
x <- rnorm(n)

# binary outcome
y <- ifelse(pnorm(1 + 0.5 * x + rnorm(n)) > 0.5, 1, 0)

data <- data.frame(y, x)
mod <- probitmfx(formula = y ~ x, data = data)

print_html(model_parameters(mod))

HTML table to be used in Rmarkdown:

enter image description here

Indrajeet Patil
  • 4,673
  • 2
  • 20
  • 51