I am trying to plot the marginal effects from a multinomial logit model. For this purpose, I am following the nice guidance provided by Benn Jann in the following resource, available on-line:
https://www.stata.com/meeting/german.../de13_jann.pdf
As prescribed in slides 60/62, I am running a very simple multinomial logit model. The dependent variable is educational attainment (educa_3bis) and has three categories. There is a single independent variable (father's education) and it has three categories as well. The name of the variable is educafth. My ultimate goal is to plot the marginal effect of each category of the independent variable for the three possible outcomes.
HTML Code:
. mlogit educa_3bis i.edufath if cntryid!=826 Iteration 0: log likelihood = -98507.417 Iteration 1: log likelihood = -94413.377 Iteration 2: log likelihood = -94177.934 Iteration 3: log likelihood = -94177.302 Iteration 4: log likelihood = -94177.302 Multinomial logistic regression Number of obs = 140,495 LR chi2(4) = 8660.23 Prob > chi2 = 0.0000 Log likelihood = -94177.302 Pseudo R2 = 0.0440 ----------------------------------------------------------------------------------------------------- educa_3bis | Coef. Std. Err. z P>|z| [95% Conf. Interval] ------------------------------------+---------------------------------------------------------------- Less_than_university | (base outcome) ------------------------------------+---------------------------------------------------------------- Tertiary_BA | edufather | ISCED 3 (excluding 3C short) and 4 | .4809713 .0199718 24.08 0.000 .4418274 .5201153 ISCED 5 and 6 | 1.31509 .0213543 61.58 0.000 1.273236 1.356943 | _cons | -2.326141 .0148464 -156.68 0.000 -2.355239 -2.297042 ------------------------------------+---------------------------------------------------------------- Tertiary_MA | edufather | ISCED 3 (excluding 3C short) and 4 | .8095096 .022792 35.52 0.000 .7648382 .854181 ISCED 5 and 6 | 1.788769 .0235119 76.08 0.000 1.742686 1.834852 | _cons | -2.748311 .0180525 -152.24 0.000 -2.783693 -2.712929 -----------------------------------------------------------------------------------------------------
PHP Code:
estimates store educa
quietly margins, dydx(edufath) predict(outcome(1)) post
estimates store basic
estimates restore educa
quietly margins, dydx(edufath) predict(outcome(2)) post
estimates store middle
estimates restore educa
quietly margins, dydx(edufath) predict(outcome(3)) post
estimates store high
My next step would be to use the command regplot. I try to use reproducing Benn Jann's example in slide 62 of the PDF (presentation) posted above:
PHP Code:
regplot basic middle low, legend(row(1)) xline(0) title(AMEs with 95% CIs)
HTML Code:
. regplot basic middle low, legend(row(1)) xline(0) title(AMEs with 95% CIs) variable basic not found
My ultimate goal would be actually to get the contrast of the average marginal effect of subsequent categories of the independent variable for the different outcomes in the dependent variable. For instance, to assess if the contrast between the average marginal effect of father's higher education and father's middle education is higher for one given outcome (Tertiary MA) than for another one (Tertiary BA). I would like to get these estimates (contrasts of AMEs) and to plot them. I know the command contrast is very useful in this regard, but I do not know how to get this sort of "contrast of contrasts".
But I guess this is a matter of another post.
At any rate, thanks a lot for your attention
Kind regards
Luis Ortiz
0 Response to Plotting marginal effects from a multinomial logit model
Post a Comment