rmarginal-effects

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.


Solution

  • 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.