



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Sociology
multinomial logit
The data for this exercise comes for the 1991 General Social Survey. The categorical dependent variable occ is coded as follows:
occ=0 if a workers occupation is laborer, operative or craft; occ=1 if occupation is clerical, sales, or service; occ=2 if occupation is managerial, technical, or professional.
The independent variables are : educ is years of schooling; age is age in years; sexx is coded 1 male, 0 female; rural is coded 1 if grew up in rural area, 0 otherwise.
1. tab occ
occ | Freq. Percent Cum. ------------+----------------------------------- 0 | 172 27.17 27. 1 | 248 39.18 66. 2 | 213 33.65 100. ------------+----------------------------------- Total | 633 100.
Let’s begin with the null model with no regressors:
2. mlogit occ,base(0)
Iteration 0: log likelihood = -688.
Multinomial regression Number of obs = 633 LR chi2(0) = 0. Prob > chi2 =. Log likelihood = -688.49317 Pseudo R2 = 0.
occ | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- 1 | _cons | .3659343 .0992281 3.688 0.000 .1714508. ---------+-------------------------------------------------------------------- 2 | _cons | .2137977 .1025124 2.086 0.037 .0128771.
(Outcome occ==0 is the comparison group)
The coefficients above are on the logodds scale. In particular, they are the log odds of being in occupation 1 versus 0 and 2 versus 0. Hence, they should equal the following:
and the same for category 2: ln(231/172)=.2137977.
Now let’s add education to the model:
3. mlogit occ educ,base(0)
Iteration 0: log likelihood = -688. Iteration 1: log likelihood = -578. Iteration 2: log likelihood = -568. Iteration 3: log likelihood = -568. Iteration 4: log likelihood = -568.
Multinomial regression Number of obs = 633 LR chi2(2) = 240. Prob > chi2 = 0. Log likelihood = -568.4611 Pseudo R2 = 0.
occ | Coef. Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- 1 | educ | .2175129 .0495753 4.388 0.000 .120347. _cons | -2.341483 .6221847 -3.763 0.000 -3.560943 -1. ---------+-------------------------------------------------------------------- 2 | educ | .7404903 .0630034 11.753 0.000 .6170059. _cons | -9.937645 .8608307 -11.544 0.000 -11.62484 -8.
(Outcome occ==0 is the comparison group)
To get the coefficients on the odds ratio scale we just add the option ,rrr like so:
4. mlogit occ educ,base(0) rrr
Iteration 0: log likelihood = -688. Iteration 1: log likelihood = -578. Iteration 2: log likelihood = -568. Iteration 3: log likelihood = -568. Iteration 4: log likelihood = -568.
Multinomial regression Number of obs = 633 LR chi2(2) = 240. Prob > chi2 = 0. Log likelihood = -568.4611 Pseudo R2 = 0.
occ | RRR Std. Err. z P>|z| [95% Conf. Interval] ---------+-------------------------------------------------------------------- 1 | educ | 1.242981 .0616212 4.388 0.000 1.127888 1. ---------+-------------------------------------------------------------------- 2 | educ | 2.096963 .1321158 11.753 0.000 1.853371 2.
(Outcome occ==0 is the comparison group)
Note that the education coefficient for the comparison of occupation 0 to occupation 1 is identical in magnitude but opposite in sign to the education coefficient for the comparison of occ 1 to occ 0.
Now that you know how to recover coefficients and odds ratios by hand, here’s a command that does it automatically and covers all possibilities:
6. listcoef educ
mlogit (N=633): Factor Change in the Odds of occ
Variable: educ (sd= 2.71668)
Odds comparing | Group 1 - Group 2 | b z P>|z| e^b e^bStdX ------------------+--------------------------------------------- 1 -2 | -0.52298 -10.169 0.000 0.5928 0. 1 -0 | 0.21751 4.388 0.000 1.2430 1. 2 -1 | 0.52298 10.169 0.000 1.6870 4. 2 -0 | 0.74049 11.753 0.000 2.0970 7. 0 -1 | -0.21751 -4.388 0.000 0.8045 0. 0 -2 | -0.74049 -11.753 0.000 0.4769 0.
How about computing the probability of being in each occupation for a given value of schooling. To do this, ask stata to compute the probabilities with the following command:
7. predict p0 p1 p
Now to get these for each year of schooling value, I did the following (which by the way, destroys your original data file)
8. collapse (mean) p0 p1 p2,by(educ)
Then I summed the probabilities for each vlaue of educ:
9.gen summ_p=p0 + p1 +p
10. list educ p0 p1 p2 summ_p
educ p0 p1 p2 summ_p
Notice that for each value of education, the probabilities (as given by summ_p) sum to 1.
Here’s an example of computing the probabilities. I do this for case of educ=16 years.
As an exercise, you should try to compute some of the other probabilities at some other levels of education to make sure you know how.
Note that the effect of a one year change in schooling on the probability, of, say, being in occupation 2 depends on the value of schooling that you start from. This is just like the binary case and is due to the fact that the probabilities are a nonlinear function of schooling.