Using Stata V13 I am trying to 1) estimate an ologit model, 2) estimate marginal effects, and 3) plot the marginal effects. I include a factor variable for cohort or generation and a covariate measuring the year of the survey. When I use the margins command specifying both the factor variable and covariate, the margins look fine. But, when I plot the margins, one of the groups in the factor variable is not shown on the graph.
Here is the code from the ologit estimation:
And, here is an edited (shortened) listing of the margins:
Note how there are margins estimate for all of the generation groups (Silent, Boomers, Gen X, and Millennials). So, I expect marginsplot to reflect all of these groups.
Here is the Stata code for the plot:
I have attached a png graphic file showing how the Boomer generation is missing.
Any ideas on why this group would not be graphed?
Best,
Alan
Here is the code from the ologit estimation:
Code:
. ologit conpressrev i.cohort1 c.year i.race Iteration 0: log likelihood = -27524.804 Iteration 1: log likelihood = -26544.676 Iteration 2: log likelihood = -26536.271 Iteration 3: log likelihood = -26536.264 Iteration 4: log likelihood = -26536.264 Ordered logistic regression Number of obs = 27845 LR chi2(5) = 1977.08 Prob > chi2 = 0.0000 Log likelihood = -26536.264 Pseudo R2 = 0.0359 ------------------------------------------------------------------------------ conpressrev | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- cohort1 | Boomers | .0969397 .0267096 3.63 0.000 .0445898 .1492896 Gen X | .0987783 .0389694 2.53 0.011 .0223997 .1751569 Millennials | .3674232 .0737857 4.98 0.000 .2228059 .5120404 | year | -.047217 .001171 -40.32 0.000 -.0495121 -.0449219 | race | black | .1088965 .0324684 3.35 0.001 .0452596 .1725333 -------------+---------------------------------------------------------------- /cut1 | -94.73947 2.328825 -99.30388 -90.17506 /cut2 | -92.12877 2.324229 -96.68418 -87.57337 ------------------------------------------------------------------------------
Code:
. margins cohort1, at(year=(1973(1)2010)) predict(outcome(1)) --------------------------------------------------------------------------------- | Delta-method | Margin Std. Err. z P>|z| [95% Conf. Interval] ----------------+---------------------------------------------------------------- _at#cohort1 | 1#Silent | .1684745 .0039917 42.21 0.000 .1606509 .1762982 1#Boomers | .1553295 .0037288 41.66 0.000 .1480211 .1626379 1#Gen X | .1550885 .0058258 26.62 0.000 .1436702 .1665068 1#Millennials | .1230527 .0085103 14.46 0.000 .1063727 .1397326 2#Silent | .1751917 .0040106 43.68 0.000 .1673311 .1830523 2#Boomers | .1616245 .0037285 43.35 0.000 .1543167 .1689323 2#Gen X | .1613756 .0058994 27.35 0.000 .149813 .1729382 2#Millennials | .1282384 .0087473 14.66 0.000 .111094 .1453828 3#Silent | .182118 .0040287 45.21 0.000 .1742219 .1900141 3#Boomers | .1681239 .0037248 45.14 0.000 .1608233 .1754244 3#Gen X | .1678669 .0059701 28.12 0.000 .1561657 .1795682 . . . 38#Silent | .5374293 .008247 65.17 0.000 .5212655 .5535931 38#Boomers | .5132707 .0068983 74.41 0.000 .4997503 .526791 38#Gen X | .5128115 .0078102 65.66 0.000 .4975038 .5281193 38#Millennials | .4458914 .0164728 27.07 0.000 .4136053 .4781775 ---------------------------------------------------------------------------------
Here is the Stata code for the plot:
Code:
#d ; marginsplot, recast(line) noci plotopts(lw(thick)) title("Hardly any confidence") xtitle("") ytitle("") ylabel(, format(%3.1f) angle(0)) legend(row(1) region(color(none))) graphregion(color(white)) name(conpressrev1, replace); #d cr
Any ideas on why this group would not be graphed?
Best,
Alan