Method · Statistics Library

Multinomial logistic regression

Multinomial logistic regression predicts an unordered categorical outcome with three or more levels by fitting one log-odds equation per non-reference category against a chosen reference, reporting each predictor's effect as a relative risk ratio.

Topic indexA reference reading outside the guided chapter sequence

Understand the idea

Ordinary logistic regression handles a yes/no outcome. Multinomial logistic regression generalizes this to an outcome with three or more categories that have no natural order: species, brand choice, transport mode. It works by picking one category as the REFERENCE and fitting a separate equation comparing every other category against that reference, all estimated together as one connected system.

This creates the single most common source of confusion with this method: every coefficient is a comparison to the REFERENCE category specifically, never to 'the average' and never to the other non-reference categories combined. If the reference is species A, a coefficient in species B's equation tells you about B versus A; it says nothing directly about B versus C. Changing which category is the reference changes every coefficient's number, but it does NOT change the model's actual fitted probabilities or predictions: it is the same underlying model, just described from a different comparison point.

This model rests on an assumption worth knowing by name: independence of irrelevant alternatives (IIA). Your relative preference between any two categories should not change just because a third, similar category gets added or removed. The classic illustration is choosing between a red bus and a car: adding a nearly identical blue bus should not affect your car-versus-bus preference, but in reality it often does, by splitting the 'bus' vote. For clearly distinct categories (like different species) this assumption is usually reasonable; for categories that could act as close substitutes for each other, it deserves real skepticism.

Multinomial logistic regression is also called softmax regression. Multinomial logistic coefficients raised as powers of e are called relative risk ratios (RRR): how the odds of one category against the reference category change per unit of a predictor.

Practitioner explanation

KernelStats fits log(P(Y=j)/P(Y=ref)) = beta_0j + beta_1j*X_1 + ... for each of J-1 non-reference categories simultaneously, with relative risk ratios RRR_jk = exp(beta_jk) as the reported effect size. RRR is used deliberately rather than 'odds ratio' in the 3+ category case specifically to keep the reference comparison explicit in the name; in the two-category case RRR literally IS the familiar odds ratio, and the product states this equivalence directly.

Linearity of each logit IS TESTED, not assumed: the square of each continuous predictor is added to every one of the J-1 equations and a likelihood-ratio test compares the augmented model to the fitted one, on (number of squared terms) x (J-1) degrees of freedom, with the honest caveat stated plainly that a non-significant result is NOT proof of a straight-line relationship, because with limited data the test simply has limited power to detect a real curve. Perfect (or near-perfect) separation is detected (the separation flag on the card) when a predictor or combination perfectly identifies a category, since the MLE would otherwise run to infinity in that comparison.

IIA is explicitly NOT tested by this function, and this is a deliberate, documented choice: the classical data-based tests for IIA (Hausman-McFadden, Small-Hsiao) are cited by name as having poor size properties and frequently disagreeing with each other in realistic samples (Cheng & Long, 2007), so KernelStats marks IIA as a DESIGN JUDGMENT the analyst makes based on whether the categories are genuinely distinct or could act as close substitutes, rather than presenting a formal test result that would carry false authority. The classification table's accuracy is explicitly benchmarked against the no-information rate (the accuracy from always guessing the single most common category) rather than left to be judged in isolation, since a headline accuracy can look impressive purely by matching a heavily imbalanced baseline.

When to use it

Consider it when

The outcome has three or more UNORDERED categories (species, brand choice, diagnosis category), and you want to quantify each predictor's effect on the relative risk of each category versus a chosen reference.

Use caution when

The outcome has exactly two levels (use ordinary logistic regression), the outcome categories have a natural order (use ordinal regression instead, which uses the ordering and needs fewer parameters), or the categories plausibly act as close substitutes for each other in a way that would violate independence of irrelevant alternatives.

Formulas and symbols

Multinomial (softmax) log-odds equation

log⁡ ⁣(P(Y=j)P(Y=ref))=β0j+β1jX1+…\log\!\left(\dfrac{P(Y=j)}{P(Y=\text{ref})}\right) = \beta_{0j} + \beta_{1j}X_1 + \dots

One equation per non-reference category j, all J-1 equations fit jointly against the chosen reference category.

Relative risk ratio

RRRjk=eβjkRRR_{jk} = e^{\beta_{jk}}

A one-unit increase in X_k multiplies the relative risk of category j versus the reference by RRR_jk, holding other predictors fixed. Equals the ordinary odds ratio in the two-category case.

McFadden's pseudo-R-squared

RMcF2=1−ln⁡Lfullln⁡LnullR^2_{\text{McF}} = 1 - \dfrac{\ln L_{\text{full}}}{\ln L_{\text{null}}}

0.2-0.4 already indicates an excellent fit for this measure, much lower than the OLS R-squared scale.

Assumptions and checks

  • Perfect or quasi-perfect separation (a predictor combination perfectly predicts an outcome category for some rows) sends coefficient estimates and standard errors toward infinity, making the reported relative risk ratios and p-values untrustworthy even though the optimizer may still return a number.

    In KernelStats: Checked directly: the card detects possible perfect/quasi separation from very large slope coefficients or standard errors and flags it as a failed check.

  • With fewer than about 10 rows per outcome level, the multinomial fit is data-starved and its coefficients and standard errors become unstable.

    In KernelStats: Checked directly: the card flags n below 10 times the number of outcome levels as an 'Adequate sample size' warning.

  • Multinomial logit assumes Independence of Irrelevant Alternatives (IIA): adding or removing one outcome category should not change the relative odds between the others. When IIA fails (e.g. the categories are close substitutes for each other), the relative risk ratios can be badly misleading.

    In KernelStats: Not checked by KernelStats: flagged explicitly as an untested design judgment rather than a passed test, because no reliable data-based IIA test exists (the Hausman-McFadden and Small-Hsiao tests often disagree and have poor size in realistic samples).

  • Linearity. Multinomial logistic regression assumes each predictor's effect is linear on the log-odds scale for every category comparison; a curving true relationship makes the reported relative risk ratio a compromise that misrepresents the effect at the ends of the predictor's range.

    In KernelStats: A likelihood-ratio test comparing the fit with and without a squared term for each continuous predictor, reported directly on the card; not applicable when every predictor is categorical or when a numeric predictor takes only two distinct values, and reported as not testable when the augmented model fails to converge.

Alternatives

  • Logistic Regression. The outcome actually has only two categories.
  • Ordinal Logistic Regression. The outcome categories have a natural order (mild/moderate/severe): using that order needs fewer parameters and gives more powerful, more interpretable results.

Worked example

Scenario

Predicting penguin species (three levels, reference = Adelie) from flipper length and body mass.

Result

Gentoo equation: flipper length RRR = 1.94 per mm (95% CI [1.47, 2.57], p < .001); Chinstrap equation: flipper length RRR = 1.19 per mm (95% CI [1.12, 1.27], p < .001), with body mass held fixed. McFadden's R-squared = 0.63; classification accuracy = 81.6% versus a no-information rate of 44.2%.

Interpretation

At a fixed body mass, each extra millimeter of flipper roughly doubles the relative risk of Gentoo versus Adelie and raises that of Chinstrap versus Adelie by about 19%. The 81.6% accuracy is well above the 44.2% no-information rate, so the model adds real information, but these two size measurements alone leave many Adelie and Chinstrap birds confused; bill measurements would be needed to separate them.

Dataset: penguins.csv

Common misconceptions

Misconception

A coefficient in the multinomial model tells you how a predictor affects that category's probability compared to all the OTHER categories combined.

Correction

Every coefficient is a comparison to the REFERENCE category specifically, not to 'the average' and not to the other categories pooled together. A positive coefficient in one category's equation says that category becomes more likely relative to the REFERENCE only; it says nothing directly about that category versus any other non-reference category, which would require a different reference or an explicit contrast.

Misconception

The model classified 82% of rows correctly, so it must be a good model.

Correction

Classification accuracy must be compared against the NO-INFORMATION RATE: the accuracy achieved by always guessing the single most common category. If 80% of rows already belong to one category, an 82% accuracy is barely better than a trivial constant guess, which the reported no-information rate makes visible.

Read more: Misconception: statistical significance means practical importance

References

  1. Applied Logistic Regression, Hosmer, D. W., Lemeshow, S. and Sturdivant, R. X. (2013).
  2. Comparing alternative tests of the independence of irrelevant alternatives, Cheng, S. and Long, J. S. (2007), Sociological Methods & Research, 35(4), 583-600.