Tutorials › Econometrics (Graduate) › Maximum Likelihood For Multinomial Logit

Multinomial and Ordinal Outcomes · Tutorial 482 of 952

Maximum Likelihood For Multinomial Logit

Learn to build and maximize the multinomial-logit likelihood, derive its score contributions, and interpret estimated coefficients relative to a reference alternative.

Advanced 12 min read

What You'll Learn

  • Write the individual-choice likelihood and log likelihood for multinomial logit
  • Derive the score contribution for each choice and coefficient block
  • Calculate an individual’s probabilities, log likelihood, and score at given coefficients
  • Estimate a multinomial logit model from a small hypothetical choice dataset
  • Interpret a coefficient as a change in log odds relative to the reference alternative
  • Recognize likelihood assumptions and common estimation pitfalls

From Choice Probabilities to a Likelihood

Multinomial logit turns a model for the probability of each available choice into a method for estimating unknown coefficients from observed choices. The central construction is simple: each individual contributes the probability assigned to the alternative they actually chose. Multiplying those contributions gives the likelihood; taking logarithms turns the product into a sum that can be optimized.

Suppose there are \(J\) alternatives, labelled \(1,\ldots,J\), and \(n\) independent individuals. Each individual chooses exactly one alternative from the choice set under study. Let \(y_{ij}=1\) if individual \(i\) chooses alternative \(j\), and \(y_{ij}=0\) otherwise. Thus, for each individual, \(\sum_{j=1}^J y_{ij}=1\). Use alternative \(J\) as the reference, with its coefficients normalized to zero. For a basic specification, let \(x_i\) be a vector of individual characteristics and let alternative \(j\)'s systematic utility be \(x_i^\top\beta_j\), where \(\beta_J=0\).

Under the multinomial-logit probability model, the probability of choosing \(j\), conditional on \(x_i\), is \(p_{ij}=\exp(x_i^\top\beta_j)/\sum_{r=1}^J\exp(x_i^\top\beta_r)\). The reference alternative's numerator is \(\exp(0)=1\). These probabilities are positive and sum to one. The likelihood below also relies on the sampling assumption that individuals' choices are conditionally independent given the included covariates and model parameters.

Definition: The individual-choice likelihood contribution for individual \(i\) is \(L_i(\beta)=\prod_{j=1}^J p_{ij}^{y_{ij}}\). Since exactly one \(y_{ij}\) equals one, this is the probability the model assigns to the observed choice. For conditionally independent individuals, the sample likelihood is \(L(\beta)=\prod_{i=1}^n L_i(\beta)\), and the log likelihood is \(\ell(\beta)=\sum_{i=1}^n\sum_{j=1}^J y_{ij}\log p_{ij}\).

Maximum likelihood estimation chooses coefficient values that maximize this log likelihood. It does not require that the model assign probability one to any observed choice. Rather, it finds the parameter values under which the observed choices, taken together, receive the greatest likelihood among the values allowed by the model.

Deriving the Score Contributions

The score is the vector of first derivatives of the log likelihood with respect to the parameters. Its individual contribution shows how an observation pushes the estimated coefficients when the model-implied probability differs from the observed choice indicator. For each non-reference alternative \(k\), the parameter block is \(\beta_k\).

$$ \ell_i(\beta) =\sum_{j=1}^J y_{ij}x_i^\top\beta_j -\log\left(\sum_{r=1}^J\exp(x_i^\top\beta_r)\right), \qquad \beta_J=0. $$

To differentiate with respect to \(\beta_k\), the first term contributes \(y_{ik}x_i\). For the second term, differentiating the log of the sum of exponentials gives \(p_{ik}x_i\). Subtracting the second contribution yields the individual score. Summing over individuals gives the sample score used in estimation.

$$ s_{ik}(\beta) =\frac{\partial \ell_i(\beta)}{\partial\beta_k} =x_i(y_{ik}-p_{ik}), \qquad S_k(\beta) =\frac{\partial \ell(\beta)}{\partial\beta_k} =\sum_{i=1}^n x_i(y_{ik}-p_{ik}), \quad k=1,\ldots,J-1. $$

The score is a vector: each component corresponds to one element of \(x_i\). If \(y_{ik}>p_{ik}\), the observation contributes a positive multiple of \(x_i\) to the score for alternative \(k\); if \(y_{ik}<p_{ik}\), that contribution points in the opposite direction. At an interior maximum, the sample score is zero for every estimated coefficient. This is a balance across observations, not a requirement that each individual score be zero.

Worked Example: One Individual’s Likelihood and Score

Consider three alternatives, with alternative 3 as the reference. For one hypothetical individual, let \(x_i=(1,2)^\top\), \(\beta_1=(0.2,0.3)^\top\), and \(\beta_2=(-0.1,0.1)^\top\). The individual chose alternative 2, so \(y_{i2}=1\) and the other two choice indicators are zero. The reference coefficients are fixed at zero.

The systematic utilities are \(x_i^\top\beta_1=0.2+2(0.3)=0.8\), \(x_i^\top\beta_2=-0.1+2(0.1)=0.1\), and \(x_i^\top\beta_3=0\). The denominator of the probability formula is \(e^{0.8}+e^{0.1}+e^0\).

$$ D_i=2.2255+1.1052+1=4.3307, \qquad (p_{i1},p_{i2},p_{i3}) \approx(0.5139,\,0.2552,\,0.2309). $$

The likelihood contribution is the probability of the observed alternative, \(L_i=p_{i2}\approx0.2552\). Its log contribution is \(\ell_i=\log(0.2552)\approx-1.366\). The score for \(\beta_1\) uses \(y_{i1}=0\), while the score for \(\beta_2\) uses \(y_{i2}=1\):

$$ s_{i1}=x_i(0-p_{i1}) \approx(-0.5139,\,-1.0278)^\top, \qquad s_{i2}=x_i(1-p_{i2}) \approx(0.7448,\,1.4896)^\top. $$

These are the contributions at the specified coefficients, not estimates by themselves. Other individuals' score contributions must be added before assessing whether the sample score is zero.

How Maximum Likelihood Estimation Works

In general, the score equations are nonlinear because each \(p_{ij}\) depends on all the coefficients. There is usually no closed-form solution, so software maximizes \(\ell(\beta)\) using a numerical optimization method. At a candidate estimate, the optimizer evaluates the probabilities, log likelihood, and score, then updates the coefficients to improve the objective until its convergence criteria are met. A reported solution should be checked for convergence and for a score that is small relative to the scale of the problem.

The curvature of the log likelihood explains why these calculations are tractable in the basic model. Differentiating the score for alternative \(k\) with respect to \(\beta_l\) uses \(\partial p_{ik}/\partial\beta_l=p_{ik}(\mathbf{1}[k=l]-p_{il})x_i\), where \(\mathbf{1}[k=l]\) is one when \(k=l\) and zero otherwise. Therefore the block of the individual Hessian for \(\beta_k,\beta_l\) is:

$$ \frac{\partial^2\ell_i}{\partial\beta_k\,\partial\beta_l^\top} =-p_{ik}(\mathbf{1}[k=l]-p_{il})x_ix_i^\top. $$

For any set of coefficient directions, the quadratic form of the full Hessian is nonpositive: it is the negative of a sum of probability-weighted variances of the alternative-specific linear changes. Thus the log likelihood is concave in the coefficients in this specification. Concavity means a local maximum is also a global maximum, although it does not guarantee a finite, unique estimate: insufficient variation or complete prediction of choices can still prevent a finite solution or identification of all coefficients.

Worked Example: An Exact Fit With Choice Counts

Suppose a hypothetical sample has two groups, \(x=0\) and \(x=1\), and three alternatives \(A,B,C\). Take \(C\) as the reference and let \(x\) be a binary individual characteristic. The table gives counts of independent individuals in each group who chose each alternative.

Value of \(x\)Choose AChoose BChoose CTotal
020101040
110201040

Use alternative-specific intercepts and slopes: \(V_A=\beta_{A0}+\beta_{A1}x\), \(V_B=\beta_{B0}+\beta_{B1}x\), and \(V_C=0\). The observed shares within each group are \((0.5,0.25,0.25)\) for \(x=0\), and \((0.25,0.5,0.25)\) for \(x=1\). The fitted probabilities can match these shares exactly. For \(x=0\), the probabilities imply \(\beta_{A0}=\log(0.5/0.25)=\log 2\) and \(\beta_{B0}=\log(0.25/0.25)=0\). For \(x=1\), matching the shares requires \(\beta_{A0}+\beta_{A1}=\log(0.25/0.25)=0\) and \(\beta_{B0}+\beta_{B1}=\log(0.5/0.25)=\log 2\). Thus:

$$ \widehat\beta_{A0}=\log 2\approx0.6931,\quad \widehat\beta_{A1}=-\log 2\approx-0.6931,\quad \widehat\beta_{B0}=0,\quad \widehat\beta_{B1}=\log 2\approx0.6931. $$

At these coefficients, the fitted probabilities equal the observed proportions in both groups. Consequently, for each alternative and group, the observed count equals the count expected under the fitted model. The score summed over individuals is zero for every intercept and slope: for a group with covariate value \(x\), the intercept score is the observed count minus the fitted expected count, and the slope score is \(x\) times that difference. Since the log likelihood is concave, these coefficients maximize it. The maximized log likelihood is:

$$ \widehat\ell =40\log(0.5)+40\log(0.25) \approx -83.18. $$

The first 40 in the expression counts the observations assigned probability \(0.5\), and the other 40 counts those assigned probability \(0.25\). This construction works particularly neatly because the two group-specific probability vectors can be matched by the intercepts and slopes. Most datasets do not yield such an exact hand calculation, so numerical optimization is generally needed.

Interpreting Coefficients Carefully

A coefficient is attached to a particular alternative relative to the normalized reference. In the basic specification, for non-reference alternative \(j\), the model implies \(\log(p_{ij}/p_{iJ})=x_i^\top\beta_j\). Therefore a coefficient describes a change in the log odds of choosing \(j\) rather than the reference, associated with a one-unit change in the corresponding covariate while other included covariates are held fixed. This is an interpretation of the model’s relative log odds, not a direct change in the probability of choosing \(j\).

Worked Example: Interpreting a Binary Covariate Coefficient

Return to the hypothetical choice-count example, where \(C\) is the reference and \(x\) is a binary characteristic. The fitted slope for alternative \(B\) is \(\widehat\beta_{B1}=\log 2\approx0.6931\). When \(x\) changes from 0 to 1, the model's log odds of choosing \(B\) rather than \(C\) increase by about 0.6931, with the reference normalization and other model terms held fixed. The estimated intercept for \(B\) is zero, so the log odds for \(B\) versus \(C\) are zero at \(x=0\), and \(\log 2\) at \(x=1\). These statements describe the fitted association; they do not establish that changing \(x\) would cause a person's choice to change.

The corresponding slope for \(A\) is \(-\log 2\). Thus, for \(A\) relative to \(C\), the fitted log odds decrease by about 0.6931 between \(x=0\) and \(x=1\). Neither coefficient alone gives the change in any alternative's choice probability: probabilities depend on the utilities of all alternatives through their shared denominator.

Assumptions, Computation, and a Common Pitfall

Maximum likelihood gives a meaningful fit only when the probability model and the sampling structure are appropriate. At minimum, the analysis specifies the alternatives available to each included individual, records exactly one chosen alternative, uses the stated multinomial-logit probability formula, and treats individuals' choices as conditionally independent for the likelihood factorization. The covariates and reference normalization must also be defined consistently. The model's implications should be considered in light of the application; a numerical optimizer cannot make an unsuitable probability model suitable.

A common mistake is to maximize the sum of the probabilities assigned to the observed alternatives, \(\sum_i p_{i,y_i}\), instead of the log likelihood \(\sum_i\log p_{i,y_i}\). These are different objectives and generally yield different estimates. The likelihood follows from the probability of the observed sample under conditional independence: it is the product of the observed-choice probabilities. Taking its logarithm gives the sum of their logarithms, not the sum of the probabilities themselves.

Another practical issue is separation or weak identification. If a covariate pattern perfectly predicts choices, the likelihood may keep increasing as some coefficients grow in magnitude, so no finite maximum exists. A successful software termination message alone is not proof that every coefficient is well determined. Inspect convergence information, the fitted probabilities, and whether the design contains enough variation to estimate the requested parameters.

Key takeaway: Multinomial-logit maximum likelihood sums the log probabilities assigned to observed choices. Each score contribution is the covariate vector multiplied by the difference between the observed choice indicator and its fitted probability. Coefficients describe relative log odds against the normalized reference; probabilities are determined jointly across alternatives.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. Why does an individual's likelihood contribution reduce to the probability of just one alternative?
  2. For a non-reference alternative \(k\), what is the individual score contribution, and what role do the observed indicator and fitted probability play?
  3. In the choice-count example, why do the fitted intercepts and slopes give a zero sample score?
  4. What does a positive coefficient on a binary covariate mean when interpreted relative to the reference alternative?
  5. Why is maximizing the sum of observed-choice probabilities not the same as maximum likelihood estimation?
Clinical Biostats