Reputation: 11
I need to save the marginal effects of the below models in a table using estout or outreg. The commands i use below only save the coefficients in the table and not the marginal effect. I have been trying a lot and nothing is working
sysuse auto
reg price mpg rep78 foreign, robust
margins, dydx(*)
estimates store m1, title(Model 1)
tobit price mpg rep78 foreign, 11(0)
margins, dydx(*) predict (ystar(0,.) )
estimates store m2, title(Model 2)
probit price mpg rep78 foreign
margins, dydx(*)
estimates store m3, title(Model 3)
truncreg price mpg rep78 foreign
margins, dydx(*) predict(e(0,.))
estimates store m4, title(Model 4)
estout m1 m2 m3 m4 , cells(b(star fmt(3)) se(par fmt(2)))
Upvotes: 0
Views: 4661
Reputation: 11112
I give an example showing what you ask for. However, beware that
in the linear regression model, the marginal effect equals the relevant slope coefficient (https://www3.nd.edu/~rwilliam/stats/Margins01.pdf)
So you might be getting correct results. (I'm not able to run your code without bumping to an error not related to your original query.)
The example contains a linear and a non-linear model to emphasize the last point:
clear all
set more off
*----- example data -----
*from http://repec.org/bocode/e/estout/advanced.html
sysuse auto
generate reprec = (rep78 > 3) if rep78 < .
*----- what you want -----
eststo clear
regress foreign mpg reprec
margins, dydx(*) post
eststo modreg
logit foreign mpg reprec
margins, dydx(*) post
eststo modlog
esttab, se mtitles title(Marginal effects)
Upvotes: 3