Part 7 Multinomial logit (mlogit)
7.1 Goal of mlogit
Multinomial logit is used when the \(y\) variable is categorical. For example, the variable ccfm_alike2
, which asks “how are ruler and watch alike?”, is coded as the following:
1 = measuring instruments
2 = used to measure
3 = they have numbers
4 = other (specify)
.a = refused
.b = don't know
Note that there is no clear order for values 1 through 4. Therefore, the numeric values are arbitrary. Unlike ologit
where it looks at ordinal categorical variable, mlogit
looks at non-ordered categorical variable.
7.2 Word of caution
Multinomial logit has strict limitations, which basically makes it unusable except as a preliminary analysis. Instead of a basic picture with mlogit
, there are community-made gllamm
and mixlogit
which are not compatible with svy:
prefix command. There are official commands asmixlogit
and meqrlogit
, but asmixlogit
does not work with panel data like NSHAP and meqrlogit
also does not work with svy:
prefix. However, these techniques add couple layers of complexity which takes extra care. Similar stories apply to lclogit
, gmnl
, bayesmlogit
, and lslogit
. One upside is that mlogit
has relative risk option, which is easier to interpret than odds ratio.
7.3 Stata
Interpreting the output is not too different from ologit, but has an added layer of complexity. Note that svy:
indicates to Stata that the data being used has weights, clusters, and strata. You can check the survey status by running the command svyset
. Here is a truncated output:
. svy: mlogit ccfm_alike2 age i.ethgrp i.maritlst, rr
----------------------------------------------------------------------------------------
| Linearized
ccfm_alike2 | RRR Std. Err. t P>|t| [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
measuring_instruments |
age | .9909403 .0073199 -1.23 0.224 .9763464 1.005752
|
ethgrp |
black | .8741774 .2037065 -0.58 0.566 .5474307 1.39595
hispanic, non-black | .8367576 .2179274 -0.68 0.497 .4959226 1.41184
other | 1.97543 .7678845 1.75 0.086 .9048591 4.312632
|
maritlst |
living with a partner | .3902016 .1014259 -3.62 0.001 .2314987 .6577024
separated | .8211493 .6061661 -0.27 0.791 .1864199 3.617028
...
_cons | 1.23889 .6681023 0.40 0.693 .4193918 3.659701
-----------------------+----------------------------------------------------------------
used_to_measure | (base outcome)
-----------------------+----------------------------------------------------------------
they_have_numbers |
age | .9948541 .0068878 -0.75 0.460 .9811152 1.008785
|
ethgrp |
black | 1.431987 .3197261 1.61 0.114 .9144826 2.242347
hispanic, non-black | 3.358444 .9401894 4.33 0.000 1.913982 5.893026
other | 2.215491 .9091979 1.94 0.058 .9716083 5.051831
|
maritlst |
living with a partner | .9728124 .3267704 -0.08 0.935 .4954719 1.910026
...
_cons | .9533521 .4811102 -0.09 0.925 .3459737 2.627021
...
To start with the specification, ccfm_alike2
is the \(y\) variable, while age
, ethgrp
(race/ethnicity group), and maritlst
(marital status) are the \(x\) variables. Possible answers choices for the respondents for the \(y\) variable are “measuring_instruments,” “used_to_measure,” “they_have_numbers,” and so on.
Notice that “used_to_measure” for the variable ccfm_alike2
is the base outcome. This means that all the other outcomes (such as “measuring_instruments”) are going to be compared to “used_to_measure” value. Also notice that some x
values such as “white” or “married” are missing. This means that within the x
variables, other ethgrp
values are going to be compared to “white” and other maritlst
values are going to be compared to “married” values.
The “RRR” column means “relative risk ratio” as given by the option in the command “rr” above. This means that RR of 1.4 means “40% more likely” or 0.5 means “50% less likely” from the output. Let’s go through a couple examples.
For the \(y\) outcome “they_have_numbers” for the variable ccfm_alike2
, one unit (year) increase in age
decreases their likelihood to fall in the “they_have_numbers” category comapred to the base category “used_to_measure” by a factor of 0.994851. Simply put, since the relative risk is lower than 1, the older they are, the less likely (by ~0,0051459 or ~0.5%) they are to be in the “they_have_numbers” category (therefore more likely to answer “used_to_measure”).
For the “black” value under ethgrp
right below, the RR is 1.431987. This means that “black” respondents are 43.1987% more likely than “white” respondents to answer “they_have_numbers” instead of choosing the “used_to_measure” answer.
However, notice that most of the \(x\) responses are not statistically significant at the 5% significance level. This can be determined by looking at P>|t|
and the 95% confidence interval. They would be statistically significant if P>|t|
is smaller than 0.05, or if the 95% confidence interval does not include 1.
Though _cons
or “constant” values are not commonly discussed, for sake of interpretation, it shows the base value for the corresponding \(y\) value. For example, 1.23889 means that given that all \(x\) variables are their base values (ie age
is 0, ethgrp
is “white”, etc.), respondents are 23.889% more likely to be in the “measuring_instruments” category than “used_to_measure” category. This means for all other \(x\) values, you build on top of the _cons
value.
7.4 Graphing
. predict y_hat*
. graph hbox y_hat3, over(social)
This command creates four y_hat
variables. Horizontal box plots (hbox) will show the labels horizontally on the y-axis. Since it is difficult to fit all the labels on the x-axis, this solution is probably the best way to start off. y_hat3
will show results for “they_have_numbers” answer choice on the graph.