How can I output to Latex (e.g. with esttab), after a logit model with interaction term (!), the respective incremental marginal effects of each variable (especially the interaction) instead of the logit coefficients (such that the interpretation of the incremental marginal effects is analogous to the interpretation of coefficients from a linear OLS regression)?
I want to output the incremental marginal probabilities of the logit model in a table with esttabalongside other tobit, OLS models.
Consider the following example.
Code:
sysuse auto, clear
gen binaryoutcome = weight>2000
//use reg instead of logit to see that margins below are calculated properly:
eststo mainmodel: logit binaryoutcome i.foreign##c.trunk
margins, dydx(i.foreign) at(c.trunk==0)
margins, dydx(c.trunk) at(foreign==0)
//effect of 1 'trunk' unit when foreign==1 in addition (!) to the effect of 1 'trunk' unit when foreign==0 and in addition (!) to
//the differential offect of moving from foreign==0 to foreign==1
margins, dydx(c.trunk) over(foreign) pwcompare(effects)
esttab mainmodel, nobaselevels nonotes noobs nomtitle nonumber noline
I want to produce this table (here produced by hand); the coefficient values and z-stats are from the three margins commands from above:
Code:
binaryoutcome 1.foreign 0.4430546 (0.69) trunk 0.0138894 (1.08) 1.foreign#trunk -.0109257 (-0.36)
I have tried everything that I considered remotely possible:
- saving the margins as a model and tabulating -- cannot assign the third value to the interaction "variable"; can only save a single margin
- erepost -- can replace coefficients in mainmodel in e(b)[i,j], but don't know how to replace z and p values
- estadd margins -- can only add a single margin ("e(margins_level) already defined" on second estadd margin); esttab shows non-incremental effects for i.foreign==0, i.foreign==1 when tabulating
- estpost margins -- can only add a single margin ("option dydx() not allowed"); if using estimates restore mainmodel previous margins are gone; margins not showing after esttab
- extract values and 'manually' replace in r(coefs), but don't know how to get original labels, titles, formats, z-stat below coef when tabulating matrix with estout
Code:
eststo marginsmodel: margins, dydx(*) atmeans post
esttab marginsmodel
Please help me:
- Is my understanding of the marginal effects as calculated correct and my desired presentatin appropriate for a logit model with interaction?
- How do I get the incremental marginal effects from Stata into Latex, alongside other models?
0 Response to How?: Table with incremental marginal effects after logit model with interaction
Post a Comment