Researcher
Researcher

Reputation: 161

Probit Marginal Effects output for Latex

I am computing probit marginal effects from R mfx package. I want to generate Latex code for the marginal effects output. I tried stargazer package for OLS and probit coefficients, it works fine for both, however for probit marginal effects (by using probitmfx command) it doesn't work.

Please help me in this regard, thanks.

Upvotes: 4

Views: 2256

Answers (3)

Saurabh Khanna
Saurabh Khanna

Reputation: 571

You can use texreg (documentation):

model <- probitmfx(formula = y ~ x, data = your_data)
texreg(model)

Upvotes: 0

Pietro Battiston
Pietro Battiston

Reputation: 8380

Analogous to bixiou's answer, maybe slightly more elegant (at least we don't fit twice):

ols <- lm(your_formula, data=your_data, family="binomial")
probit_margins <- probitmfx(your_formula, your_data, atmean=FALSE)

your_table <- stargazer(ols, probit_margins$fit,
coef = list(NULL, probit_margins$mfxest[,1]),
se = list(NULL, probit_margins$mfxest[,2]))

This exploits the fact that a probitmfx object's fit attribute is the original model.

Upvotes: 2

bixiou
bixiou

Reputation: 149

I haven't found an easy solution, but here is the hack that I use:

ols <- lm(your_formula, data=your_data, family="binomial")
probit <- glm(your_formula, data=your_data, family="binomial")
probit_margins <- probitmfx(your_formula, your_data, atmean=FALSE)$mfxest
your_table <- stargazer(ols, probit, coef = list(NULL, probit_margins[,1]), 
                                     se = list(NULL, probit_margins[,2]))

It works the same with logit, and you don't necessarily want the atmean=FALSE option. I included an OLS in the example to show you how to include other specifications that stargazer can handle, without the need to specify it the coefficients and standard errors.

Upvotes: 2

Related Questions