. version 6 . * mlogplot 1.6.1 - test programs - 11/20/00 . which mlogplot c:\stata6\ado\stbplus\m\mlogplot.ado *! version 1.6.4 add saving . * RM4CLDVs Page 168: Figure 6.1 - Discrete Change Plot . use nomocc2,clear (1982 General Social Survey) . mlogit occ white ed exper, basecategory(1) nolog Multinomial regression Number of obs = 337 LR chi2(12) = 166.09 Prob > chi2 = 0.0000 Log likelihood = -426.80048 Pseudo R2 = 0.1629 ------------------------------------------------------------------------------ occ | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- BlueCol | white | 1.236504 .7244352 1.707 0.088 -.1833631 2.656371 ed | -.0994247 .1022812 -0.972 0.331 -.2998922 .1010428 exper | .0047212 .0173984 0.271 0.786 -.0293789 .0388214 _cons | .7412336 1.51954 0.488 0.626 -2.23701 3.719477 ---------+-------------------------------------------------------------------- Craft | white | .4723436 .6043097 0.782 0.434 -.7120817 1.656769 ed | .0938154 .097555 0.962 0.336 -.0973888 .2850197 exper | .0276838 .0166737 1.660 0.097 -.004996 .0603636 _cons | -1.091353 1.450218 -0.753 0.452 -3.933728 1.751022 ---------+-------------------------------------------------------------------- WhiteCol | white | 1.571385 .9027216 1.741 0.082 -.1979166 3.340687 ed | .3531577 .1172786 3.011 0.003 .1232959 .5830194 exper | .0345959 .0188294 1.837 0.066 -.002309 .0715007 _cons | -6.238608 1.899094 -3.285 0.001 -9.960764 -2.516453 ---------+-------------------------------------------------------------------- Prof | white | 1.774306 .7550543 2.350 0.019 .2944273 3.254186 ed | .7788519 .1146293 6.795 0.000 .5541826 1.003521 exper | .0356509 .018037 1.977 0.048 .000299 .0710028 _cons | -11.51833 1.849356 -6.228 0.000 -15.143 -7.893659 ------------------------------------------------------------------------------ (Outcome occ==Menial is the comparison group) . prchange mlogit: Changes in Predicted Probabilities for occ white Avg|Chg| BlueCol Craft WhiteCol Prof 0->1 .11623582 .04981799 -.15973434 .07971004 .1610615 Menial 0->1 -.13085523 ed Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .39242268 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.19310513 -.14576758 .03064777 .37951647 MargEfct .29474295 -.06870635 -.05287415 .01282041 .13455107 Menial Min->Max -.13017954 -+1/2 -.02559762 -+sd/2 -.07129153 MargEfct -.02579097 exper Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .12193559 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.04966453 .01479983 .02360725 .04293236 MargEfct .01167136 -.00356571 .00105992 .00169442 .00308134 Menial Min->Max -.11536534 -+1/2 -.00226997 -+sd/2 -.03167491 MargEfct -.00226997 BlueCol Craft WhiteCol Prof Menial Pr(y|x) .18419114 .29411051 .16112968 .26630062 .09426806 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594 . mlogplot white ed exper, dc std(0ss) p(.1) min(-.25) max(.50) ntics(7) . gphprint, nologo saving(mlogplotfig1.wmf,replace) . * RM4CLDVs Page 175: Figure 6.4 - Odds Ratio Plot . mlogplot white ed exper, or std(0ss) p(.1) min(-2.75) max(.55) ntics(7) . gphprint, nologo saving(mlogplotfig2.wmf,replace) . * RM4CLDVs Page 176: Figure 6.5 - Odds Ratio Plot with Discrete Change . mlogplot white ed exper, or dc std(0ss) p(.1) min(-2.75) max(.55) ntics(7) . gphprint, nologo saving(mlogplotfig3.wmf,replace) . * RM4CLDVs Page 178: Figure 6.6 - Odds Ratio Plot with Discrete Change . use ordwarm2, clear (77 & 89 General Social Survey) . label def lw 1 1SD 2 2D 3 3A 4 4SA . label val warm lw . mlogit warm-prst, nolog Multinomial regression Number of obs = 2293 LR chi2(18) = 349.54 Prob > chi2 = 0.0000 Log likelihood = -2820.9982 Pseudo R2 = 0.0583 ------------------------------------------------------------------------------ warm | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- 1SD | yr89 | -1.097643 .1637 -6.705 0.000 -1.418489 -.7767971 male | .3597704 .1411255 2.549 0.011 .0831696 .6363713 white | .5339852 .2463276 2.168 0.030 .0511919 1.016778 age | .0250045 .0044826 5.578 0.000 .0162188 .0337901 ed | -.1105661 .0280302 -3.945 0.000 -.1655043 -.0556279 prst | -.0024333 .0061387 -0.396 0.692 -.0144649 .0095983 _cons | -1.115396 .4303341 -2.592 0.010 -1.958835 -.2719563 ---------+-------------------------------------------------------------------- 2D | yr89 | -.3630178 .1069194 -3.395 0.001 -.572576 -.1534596 male | .4600329 .1044742 4.403 0.000 .2552672 .6647985 white | .1123935 .1622593 0.693 0.489 -.2056289 .430416 age | .0225556 .0033222 6.789 0.000 .0160441 .0290671 ed | -.0183148 .021324 -0.859 0.390 -.060109 .0234794 prst | -.0112995 .0044187 -2.557 0.011 -.01996 -.0026389 _cons | -.7020634 .3124924 -2.247 0.025 -1.314537 -.0895896 ---------+-------------------------------------------------------------------- 4SA | yr89 | .0625534 .1228908 0.509 0.611 -.1783082 .3034149 male | -.8666833 .1310965 -6.611 0.000 -1.123628 -.6097389 white | -.3002409 .1710551 -1.755 0.079 -.6355028 .0350211 age | -.0066719 .0041053 -1.625 0.104 -.0147181 .0013744 ed | .0330137 .0274376 1.203 0.229 -.020763 .0867904 prst | .0017323 .0052199 0.332 0.740 -.0084985 .0119631 _cons | -.3932277 .3740361 -1.051 0.293 -1.126325 .3398697 ------------------------------------------------------------------------------ (Outcome warm==3A is the comparison group) . prchange mlogit: Changes in Predicted Probabilities for warm yr89 Avg|Chg| 1SD 2D 4SA 3A 0->1 .0685527 -.09277321 -.04433218 .0483558 .08874959 male Avg|Chg| 1SD 2D 4SA 3A 0->1 .08402095 .03498483 .13305706 -.14905089 -.01899102 white Avg|Chg| 1SD 2D 4SA 3A 0->1 .03699843 .0479169 .02607995 -.06226252 -.01173434 age Avg|Chg| 1SD 2D 4SA 3A Min->Max .20911962 .12694021 .29129903 -.16909096 -.24914826 -+1/2 .00310007 .00181469 .00438544 -.00262144 -.00357869 -+sd/2 .05183155 .03035958 .07330352 -.04387383 -.05978927 MargEfct .01240041 .0018147 .0043855 -.00262146 -.00357874 ed Avg|Chg| 1SD 2D 4SA 3A Min->Max .13736561 -.27402139 -.00070983 .1467628 .12796843 -+1/2 .00640956 -.01111165 -.00170746 .00766897 .00515014 -+sd/2 .02026453 -.03517523 -.00535381 .02423576 .01629332 MargEfct .0256375 -.01110977 -.00170898 .00766912 .00514963 prst Avg|Chg| 1SD 2D 4SA 3A Min->Max .08374692 .00821991 -.16749384 .06232981 .09694412 -+1/2 .00124198 .00014042 -.00248396 .00089847 .00144508 -+sd/2 .01799244 .00203484 -.03598487 .0130161 .02093393 MargEfct .00496793 .00014042 -.00248396 .00089846 .00144509 1SD 2D 4SA 3A Pr(y|x) .11394239 .32539049 .16644368 .39422345 yr89 male white age ed prst x= .398604 .464893 .876581 44.9355 12.2181 39.5853 sd(x)= .489718 .498875 .328989 16.779 3.16083 14.4923 . mlogplot yr89 male age ed, or dc std(00ss) b(1) p(.1) /* > */ min(-1.5) max(1.5) ntics(7) . gphprint, nologo saving(mlogplotfig4.wmf,replace) . * mlogplot using matrix input . matrix mnlbeta = (-.693, .693, .347 \ .347, -.347, .693 ) . matrix mnlsd = (1, 2, 4) . global mnlname = "x1 x2 x3" . global mnlrefn = 3 . global mnlcatnm = "B C A" . mlogplot, matrix std(uuu) vars(x1 x2 x3) . mlogplot, matrix std(uuu) vars(x1 x2 x3) packed . gphprint, nologo saving(mlogplotfig4.wmf,replace) . * mlogplot using two sets of results computed from: . *> use nomocc2, clear . *> sum ed exper . *> mlogit occ ed exper if white==1,basecategory(5) nolog . *> mlogit occ ed exper if white==0,basecategory(5) nolog . matrix mnlsd = (2.946427, 13.95936, 2.946427, 13.95936) . global mnlname = "W_Educ W_Exper NW_Educ NW_Exper" . global mnlrefn = 5 . global mnlcatnm = "Menial BlueC Craft WhiteC Prof" . matrix mnlbeta = (-.83075, -.92255, -.68761, -.41964 \ /* > */ -.03380, -.03145, -.00026, .00085 \ /* > */ -.70126, -.56070, -.88250, -.53115 \ /* > */ -.11084, -.02611, -.15979, -.05209 ) . matrix mnlbeta = mnlbeta' . mlogplot, vars(W_Educ NW_Educ W_Exper NW_Exper) matrix /* > */ std(ssss) note("Effects of Education") . gphprint, nologo saving(mlogplotfig5.wmf,replace) . * Test of categories that have gaps . use nomocc2,clear (1982 General Social Survey) . mlogit occ white ed exper, basecategory(1) nolog Multinomial regression Number of obs = 337 LR chi2(12) = 166.09 Prob > chi2 = 0.0000 Log likelihood = -426.80048 Pseudo R2 = 0.1629 ------------------------------------------------------------------------------ occ | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- BlueCol | white | 1.236504 .7244352 1.707 0.088 -.1833631 2.656371 ed | -.0994247 .1022812 -0.972 0.331 -.2998922 .1010428 exper | .0047212 .0173984 0.271 0.786 -.0293789 .0388214 _cons | .7412336 1.51954 0.488 0.626 -2.23701 3.719477 ---------+-------------------------------------------------------------------- Craft | white | .4723436 .6043097 0.782 0.434 -.7120817 1.656769 ed | .0938154 .097555 0.962 0.336 -.0973888 .2850197 exper | .0276838 .0166737 1.660 0.097 -.004996 .0603636 _cons | -1.091353 1.450218 -0.753 0.452 -3.933728 1.751022 ---------+-------------------------------------------------------------------- WhiteCol | white | 1.571385 .9027216 1.741 0.082 -.1979166 3.340687 ed | .3531577 .1172786 3.011 0.003 .1232959 .5830194 exper | .0345959 .0188294 1.837 0.066 -.002309 .0715007 _cons | -6.238608 1.899094 -3.285 0.001 -9.960764 -2.516453 ---------+-------------------------------------------------------------------- Prof | white | 1.774306 .7550543 2.350 0.019 .2944273 3.254186 ed | .7788519 .1146293 6.795 0.000 .5541826 1.003521 exper | .0356509 .018037 1.977 0.048 .000299 .0710028 _cons | -11.51833 1.849356 -6.228 0.000 -15.143 -7.893659 ------------------------------------------------------------------------------ (Outcome occ==Menial is the comparison group) . prchange mlogit: Changes in Predicted Probabilities for occ white Avg|Chg| BlueCol Craft WhiteCol Prof 0->1 .11623582 .04981799 -.15973434 .07971004 .1610615 Menial 0->1 -.13085523 ed Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .39242268 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.19310513 -.14576758 .03064777 .37951647 MargEfct .29474295 -.06870635 -.05287415 .01282041 .13455107 Menial Min->Max -.13017954 -+1/2 -.02559762 -+sd/2 -.07129153 MargEfct -.02579097 exper Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .12193559 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.04966453 .01479983 .02360725 .04293236 MargEfct .01167136 -.00356571 .00105992 .00169442 .00308134 Menial Min->Max -.11536534 -+1/2 -.00226997 -+sd/2 -.03167491 MargEfct -.00226997 BlueCol Craft WhiteCol Prof Menial Pr(y|x) .18419114 .29411051 .16112968 .26630062 .09426806 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594 . mlogplot white ed exper, dc std(0ss) p(.1) min(-.25) max(.50) ntics(7) . gen o1 = occ . recode o1 5=9 4=7 3=5 2=3 1=2 (337 changes made) . mlogit o1 white ed exper, basecategory(2) nolog Multinomial regression Number of obs = 337 LR chi2(12) = 166.09 Prob > chi2 = 0.0000 Log likelihood = -426.80048 Pseudo R2 = 0.1629 ------------------------------------------------------------------------------ o1 | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- 3 | white | 1.236504 .7244352 1.707 0.088 -.1833631 2.656371 ed | -.0994247 .1022812 -0.972 0.331 -.2998922 .1010428 exper | .0047212 .0173984 0.271 0.786 -.0293789 .0388214 _cons | .7412336 1.51954 0.488 0.626 -2.23701 3.719477 ---------+-------------------------------------------------------------------- 5 | white | .4723436 .6043097 0.782 0.434 -.7120817 1.656769 ed | .0938154 .097555 0.962 0.336 -.0973888 .2850197 exper | .0276838 .0166737 1.660 0.097 -.004996 .0603636 _cons | -1.091353 1.450218 -0.753 0.452 -3.933728 1.751022 ---------+-------------------------------------------------------------------- 7 | white | 1.571385 .9027216 1.741 0.082 -.1979166 3.340687 ed | .3531577 .1172786 3.011 0.003 .1232959 .5830194 exper | .0345959 .0188294 1.837 0.066 -.002309 .0715007 _cons | -6.238608 1.899094 -3.285 0.001 -9.960764 -2.516453 ---------+-------------------------------------------------------------------- 9 | white | 1.774306 .7550543 2.350 0.019 .2944273 3.254186 ed | .7788519 .1146293 6.795 0.000 .5541826 1.003521 exper | .0356509 .018037 1.977 0.048 .000299 .0710028 _cons | -11.51833 1.849356 -6.228 0.000 -15.143 -7.893659 ------------------------------------------------------------------------------ (Outcome o1==2 is the comparison group) . prchange mlogit: Changes in Predicted Probabilities for o1 white Avg|Chg| 3 5 7 9 0->1 .11623582 .04981799 -.15973434 .07971004 .1610615 2 0->1 -.13085523 ed Avg|Chg| 3 5 7 9 Min->Max .39242268 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.19310513 -.14576758 .03064777 .37951647 MargEfct .29474295 -.06870635 -.05287415 .01282041 .13455107 2 Min->Max -.13017954 -+1/2 -.02559762 -+sd/2 -.07129153 MargEfct -.02579097 exper Avg|Chg| 3 5 7 9 Min->Max .12193559 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.04966453 .01479983 .02360725 .04293236 MargEfct .01167136 -.00356571 .00105992 .00169442 .00308134 2 Min->Max -.11536534 -+1/2 -.00226997 -+sd/2 -.03167491 MargEfct -.00226997 3 5 7 9 2 Pr(y|x) .18419114 .29411051 .16112968 .26630062 .09426806 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594 . mlogplot white ed exper, dc std(0ss) p(.1) min(-.25) max(.50) ntics(7) . mlogplot white ed exper, or dc std(0ss) p(.1) /* > */ base(-1) min(-.25) max(.50) ntics(7) . * illustration of dcadd() option . use nomocc2,clear (1982 General Social Survey) . mlogit occ white ed exper, basecategory(1) nolog Multinomial regression Number of obs = 337 LR chi2(12) = 166.09 Prob > chi2 = 0.0000 Log likelihood = -426.80048 Pseudo R2 = 0.1629 ------------------------------------------------------------------------------ occ | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- BlueCol | white | 1.236504 .7244352 1.707 0.088 -.1833631 2.656371 ed | -.0994247 .1022812 -0.972 0.331 -.2998922 .1010428 exper | .0047212 .0173984 0.271 0.786 -.0293789 .0388214 _cons | .7412336 1.51954 0.488 0.626 -2.23701 3.719477 ---------+-------------------------------------------------------------------- Craft | white | .4723436 .6043097 0.782 0.434 -.7120817 1.656769 ed | .0938154 .097555 0.962 0.336 -.0973888 .2850197 exper | .0276838 .0166737 1.660 0.097 -.004996 .0603636 _cons | -1.091353 1.450218 -0.753 0.452 -3.933728 1.751022 ---------+-------------------------------------------------------------------- WhiteCol | white | 1.571385 .9027216 1.741 0.082 -.1979166 3.340687 ed | .3531577 .1172786 3.011 0.003 .1232959 .5830194 exper | .0345959 .0188294 1.837 0.066 -.002309 .0715007 _cons | -6.238608 1.899094 -3.285 0.001 -9.960764 -2.516453 ---------+-------------------------------------------------------------------- Prof | white | 1.774306 .7550543 2.350 0.019 .2944273 3.254186 ed | .7788519 .1146293 6.795 0.000 .5541826 1.003521 exper | .0356509 .018037 1.977 0.048 .000299 .0710028 _cons | -11.51833 1.849356 -6.228 0.000 -15.143 -7.893659 ------------------------------------------------------------------------------ (Outcome occ==Menial is the comparison group) . prchange mlogit: Changes in Predicted Probabilities for occ white Avg|Chg| BlueCol Craft WhiteCol Prof 0->1 .11623582 .04981799 -.15973434 .07971004 .1610615 Menial 0->1 -.13085523 ed Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .39242268 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.19310513 -.14576758 .03064777 .37951647 MargEfct .29474295 -.06870635 -.05287415 .01282041 .13455107 Menial Min->Max -.13017954 -+1/2 -.02559762 -+sd/2 -.07129153 MargEfct -.02579097 exper Avg|Chg| BlueCol Craft WhiteCol Prof Min->Max .12193559 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.04966453 .01479983 .02360725 .04293236 MargEfct .01167136 -.00356571 .00105992 .00169442 .00308134 Menial Min->Max -.11536534 -+1/2 -.00226997 -+sd/2 -.03167491 MargEfct -.00226997 BlueCol Craft WhiteCol Prof Menial Pr(y|x) .18419114 .29411051 .16112968 .26630062 .09426806 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594 . mlogplot white ed exper, or dc std(0ss) p(.1) /* > */ min(-2.75) max(.55) ntics(7) dcadd(.05) . gphprint, nologo saving(mlogplotfig10.wmf,replace) . . log close