Note: This chapter uses a suite of commands, called spost, written by J. Scott Long and Jeremy Freese. The commands must be downloaded prior to their use, and this can be done by typing search spost in the Stata command line (see How can I use the search command to search for programs and get additional help? for more information about using search).
Table 6.1, page 152.
use https://stats.idre.ucla.edu/stat/stata/examples/long/nomocc2, clear describe Contains data from https://stats.idre.ucla.edu/stat/stata/examples/long/nomocc2.dta obs: 337 1982 General Social Survey vars: 4 15 Jan 2001 15:24 size: 2,696 (99.7% of memory free) (_dta has notes) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- occ byte %10.0g occlbl Occupation white byte %10.0g Race: 1=white 0=nonwhite ed byte %10.0g Years of education exper byte %10.0g Years of work experience ------------------------------------------------------------------------------- Sorted by: occ sum Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- occ | 337 3.397626 1.367913 1 5 white | 337 .9169139 .2764227 0 1 ed | 337 13.09496 2.946427 3 20 exper | 337 20.50148 13.95936 2 66
Table 6.2, page 159.
* Stata 8 code. mlogit occ white ed exp, basecategory(1) * Stata 9 code and output. mlogit occ white ed exp, baseoutcome(1) Iteration 0: log likelihood = -509.84406 Iteration 1: log likelihood = -437.11493 Iteration 2: log likelihood = -427.50193 Iteration 3: log likelihood = -426.8061 Iteration 4: log likelihood = -426.80048 Iteration 5: log likelihood = -426.80048 Multinomial logistic 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.71 0.088 -.1833631 2.656371 ed | -.0994247 .1022812 -0.97 0.331 -.2998922 .1010428 exper | .0047212 .0173984 0.27 0.786 -.0293789 .0388214 _cons | .7412336 1.51954 0.49 0.626 -2.23701 3.719477 -------------+---------------------------------------------------------------- Craft | white | .4723436 .6043097 0.78 0.434 -.7120817 1.656769 ed | .0938154 .097555 0.96 0.336 -.0973888 .2850197 exper | .0276838 .0166737 1.66 0.097 -.004996 .0603636 _cons | -1.091353 1.450218 -0.75 0.452 -3.933728 1.751022 -------------+---------------------------------------------------------------- WhiteCol | white | 1.571385 .9027216 1.74 0.082 -.1979166 3.340687 ed | .3531577 .1172786 3.01 0.003 .1232959 .5830194 exper | .0345959 .0188294 1.84 0.066 -.002309 .0715007 _cons | -6.238608 1.899094 -3.29 0.001 -9.960764 -2.516453 -------------+---------------------------------------------------------------- Prof | white | 1.774306 .7550543 2.35 0.019 .2944273 3.254186 ed | .7788519 .1146293 6.79 0.000 .5541826 1.003521 exper | .0356509 .018037 1.98 0.048 .000299 .0710028 _cons | -11.51833 1.849356 -6.23 0.000 -15.143 -7.893659 ------------------------------------------------------------------------------ (Outcome occ==Menial is the comparison group)
Table 6.3, page 162.
* Stata 8 code. quietly mlogit occ white ed exp, basecategory(5) * Stata 9 code and output. quietly mlogit occ white ed exp, baseoutcome(5) mlogtest, lr **** Likelihood-ratio tests for independent variables Ho: All coefficients associated with given variable(s) are 0. occ | chi2 df P>chi2 -------------+------------------------- white | 8.095 4 0.088 ed | 156.937 4 0.000 exper | 8.561 4 0.073 --------------------------------------- mlogtest, wald **** Wald tests for independent variables Ho: All coefficients associated with given variable(s) are 0. occ | chi2 df P>chi2 -------------+------------------------- white | 8.149 4 0.086 ed | 84.968 4 0.000 exper | 7.995 4 0.092 ---------------------------------------
Page 163, Section 6.5.2.
Wald test.
* Stata 8 code. quietly mlogit occ white ed exp, basecategory(5) * Stata 9 code and output. quietly mlogit occ white ed exp, baseoutcome(5) test[4] ( 1) [WhiteCol]white = 0 ( 2) [WhiteCol]ed = 0 ( 3) [WhiteCol]exper = 0 chi2( 3) = 22.20 Prob > chi2 = 0.0001
NOTE: You can also use mlogtest, combine for combining all possible combinations of the dependent variable.
LR test.
quietly mlogit occ white ed exp est store a constraint define 999 [4] * Stata 8 code. quietly mlogit occ white ed exp, basecategory(5) constraint(999) * Stata 9 code and output. quietly mlogit occ white ed exp, baseoutcome(5) constraint(999) est store b lrtest a b, stats likelihood-ratio test LR chi2(3) = 26.74 (Assumption: b nested in a) Prob > chi2 = 0.0000 ------------------------------------------------------------------------------ Model | nobs ll(null) ll(model) df AIC BIC -------------+---------------------------------------------------------------- b | 337 -509.8441 -440.1682 13 906.3365 955.9976 a | 337 -509.8441 -426.8005 16 885.601 946.7223 ------------------------------------------------------------------------------
NOTE: You can also use mlogtest, lrcomb for combining all possible combinations of the dependent variable after running the full model. In the book, J. Scott Long uses the binary logistic regression for the LR test for combining outcomes. The results obtained from this approach are consistent with the book (the next command), but not with the lrtest and mlogtest, lrcomb in the previous commands.
use https://stats.idre.ucla.edu/stat/stata/examples/long/nomocc2 if (occ >= 4), clear (1982 General Social Survey) gen prof = (occ == 5) logit prof white ed exp Iteration 0: log likelihood = -88.928674 Iteration 1: log likelihood = -77.752675 Iteration 2: log likelihood = -77.231101 Iteration 3: log likelihood = -77.225873 Iteration 4: log likelihood = -77.225872 Logit estimates Number of obs = 153 LR chi2(3) = 23.41 Prob > chi2 = 0.0000 Log likelihood = -77.225872 Pseudo R2 = 0.1316 ------------------------------------------------------------------------------ prof | Coef. Std. Err. z P>|z| [95% Conf. Interval] -------------+---------------------------------------------------------------- white | -.1886257 .8999111 -0.21 0.834 -1.952419 1.575168 ed | .3756717 .0894349 4.20 0.000 .2003824 .5509609 exper | .0014674 .0145408 0.10 0.920 -.0270321 .0299669 _cons | -4.214093 1.619653 -2.60 0.009 -7.388554 -1.039633 ------------------------------------------------------------------------------
Table 6.4, page 167.
use https://stats.idre.ucla.edu/stat/stata/examples/long/nomocc2.dta, clear (1982 General Social Survey) quietly mlogit occ white ed exp, basecategory(5) prchange mlogit: Changes in Predicted Probabilities for occ white Avg|Chg| Menial BlueCol Craft WhiteCol Prof 0->1 .11623582 -.13085523 .04981799 -.15973434 .07971004 .1610615 ed Avg|Chg| Menial BlueCol Craft WhiteCol Prof Min->Max .39242268 -.13017954 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.02559762 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.07129153 -.19310513 -.14576758 .03064777 .37951647 MargEfct .05894859 -.02579097 -.06870635 -.05287415 .01282041 .13455107 exper Avg|Chg| Menial BlueCol Craft WhiteCol Prof Min->Max .12193559 -.11536534 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00226997 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.03167491 -.04966453 .01479983 .02360725 .04293236 MargEfct .00233427 -.00226997 -.00356571 .00105992 .00169442 .00308134 Menial BlueCol Craft WhiteCol Prof Pr(y|x) .09426806 .18419114 .29411051 .16112968 .26630062 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594
Figure 6.1, page 168.
* Stata 8 code. quietly mlogit occ white ed exp, basecategory(5) * Stata 9 code and output. quietly mlogit occ white ed exp, baseoutcome(5) prchange mlogit: Changes in Predicted Probabilities for occ white Avg|Chg| Menial BlueCol Craft WhiteCol Prof 0->1 .11623582 -.13085523 .04981799 -.15973434 .07971004 .1610615 ed Avg|Chg| Menial BlueCol Craft WhiteCol Prof Min->Max .39242268 -.13017954 -.70077323 -.15010394 .02425591 .95680079 -+1/2 .05855425 -.02559762 -.06831616 -.05247185 .01250795 .13387768 -+sd/2 .1640657 -.07129153 -.19310513 -.14576758 .03064777 .37951647 MargEfct .05894859 -.02579097 -.06870635 -.05287415 .01282041 .13455107 exper Avg|Chg| Menial BlueCol Craft WhiteCol Prof Min->Max .12193559 -.11536534 -.18947365 .03115708 .09478889 .17889298 -+1/2 .00233425 -.00226997 -.00356567 .00105992 .0016944 .00308132 -+sd/2 .03253578 -.03167491 -.04966453 .01479983 .02360725 .04293236 MargEfct .00233427 -.00226997 -.00356571 .00105992 .00169442 .00308134 Menial BlueCol Craft WhiteCol Prof Pr(y|x) .09426806 .18419114 .29411051 .16112968 .26630062 white ed exper x= .916914 13.095 20.5015 sd(x)= .276423 2.94643 13.9594
NOTE: You can either type mlogview for a window for the multinomial logit plots or use the mlogplot command.
mlogplot white ed exper, std(0ss) p(.1) min(-.25) max(.5) dc ntics(4)
Table 6.5, page 170.
* Stata 8 code. quietly mlogit occ white ed exp, basecategory(5) * Stata 9 code and output. quietly mlogit occ white ed exp, baseoutcome(5) listcoef white mlogit (N=337): Factor Change in the Odds of occ Variable: white (sd=.27642268) Odds comparing| Group 1 vs Group 2| b z P>|z| e^b e^bStdX ------------------+--------------------------------------------- Menial -BlueCol | -1.23650 -1.707 0.088 0.2904 0.7105 Menial -Craft | -0.47234 -0.782 0.434 0.6235 0.8776 Menial -WhiteCol | -1.57139 -1.741 0.082 0.2078 0.6477 Menial -Prof | -1.77431 -2.350 0.019 0.1696 0.6123 BlueCol -Menial | 1.23650 1.707 0.088 3.4436 1.4075 BlueCol -Craft | 0.76416 1.208 0.227 2.1472 1.2352 BlueCol -WhiteCol | -0.33488 -0.359 0.720 0.7154 0.9116 BlueCol -Prof | -0.53780 -0.673 0.501 0.5840 0.8619 Craft -Menial | 0.47234 0.782 0.434 1.6037 1.1395 Craft -BlueCol | -0.76416 -1.208 0.227 0.4657 0.8096 Craft -WhiteCol | -1.09904 -1.343 0.179 0.3332 0.7380 Craft -Prof | -1.30196 -2.011 0.044 0.2720 0.6978 WhiteCol-Menial | 1.57139 1.741 0.082 4.8133 1.5440 WhiteCol-BlueCol | 0.33488 0.359 0.720 1.3978 1.0970 WhiteCol-Craft | 1.09904 1.343 0.179 3.0013 1.3550 WhiteCol-Prof | -0.20292 -0.233 0.815 0.8163 0.9455 Prof -Menial | 1.77431 2.350 0.019 5.8962 1.6331 Prof -BlueCol | 0.53780 0.673 0.501 1.7122 1.1603 Prof -Craft | 1.30196 2.011 0.044 3.6765 1.4332 Prof -WhiteCol | 0.20292 0.233 0.815 1.2250 1.0577 ----------------------------------------------------------------
Tables 6.6 and 6.7 and Figures 6.2-6.6 where constructed using hypothetical data and therefore are not reproduced. The graphs can be generated by typing mlogview after the mlogit model and prchange commands or with the mlogplot command.