Tutorials › Multiple Imputation by Chained Equations (MICE) › Deriving Category Probabilities From Multinomial Logits

Imputation Models by Variable Type · Tutorial 173 of 497

Deriving Category Probabilities From Multinomial Logits

Learn to convert fitted baseline-category logits into a valid probability distribution and use that distribution for stochastic imputations of missing nominal values.

Intermediate 10 min read

What You'll Learn

  • Derive category probabilities from baseline-category logits by exponentiating and normalizing.
  • Calculate the baseline-category probability and verify that all probabilities sum to one.
  • Use a uniform random draw to select a nominal category stochastically.
  • Distinguish category-level randomness from uncertainty in fitted model parameters.
  • Identify common probability-calculation and imputation mistakes.

From Relative Logits to Category Probabilities

A multinomial logistic model for a nominal variable describes how each nonbaseline category compares with a chosen baseline. Its fitted logits are useful summaries of relative odds, but they are not themselves probabilities. To impute a missing value, the model must supply a probability for every possible category, with those probabilities adding to one. This tutorial derives that conversion and shows how to use the resulting distribution for a stochastic draw.

Suppose \(Y\) has \(K\) nominal categories, labelled \(1,\ldots,K\), and category \(K\) is the baseline. For a predictor vector \(x\), write \(p_k(x)=P(Y=k\mid x)\). The baseline-category logits are \(\eta_k(x)=\log\{p_k(x)/p_K(x)\}\) for \(k=1,\ldots,K-1\). In a fitted multinomial logistic regression, each \(\eta_k(x)\) is given by a linear predictor, such as an intercept plus predictor coefficients multiplied by the values in \(x\).

Definition: Given baseline-category logits \(\eta_1(x),\ldots,\eta_{K-1}(x)\), define \(w_k(x)=\exp\{\eta_k(x)\}\) for each nonbaseline category and \(w_K(x)=1\) for the baseline. The normalized category probabilities are \(p_k(x)=w_k(x)/\sum_{j=1}^{K}w_j(x)\), for \(k=1,\ldots,K\).

The baseline weight is one because its log-odds against itself are zero: \(\log\{p_K(x)/p_K(x)\}=0\). For the other categories, exponentiating a logit gives the odds relative to the baseline, \(p_k(x)/p_K(x)\). Dividing each weight by the sum of all weights turns these relative quantities into probabilities.

Why Normalization Gives the Correct Probabilities

The conversion can be derived directly from the definition of the logits. For \(k<K\), exponentiation gives \(p_k(x)=p_K(x)\exp\{\eta_k(x)\}\). Summing over all categories and using the fact that the probabilities must sum to one yields:

$$ 1 = \sum_{k=1}^{K}p_k(x) = p_K(x)\left[1+\sum_{k=1}^{K-1}\exp\{\eta_k(x)\}\right]. $$

Solving for the baseline probability and substituting it back into the other category probabilities gives the softmax form:

$$ p_K(x)=\frac{1}{1+\sum_{j=1}^{K-1}\exp\{\eta_j(x)\}}, \qquad p_k(x)=\frac{\exp\{\eta_k(x)\}}{1+\sum_{j=1}^{K-1}\exp\{\eta_j(x)\}}, \quad k=1,\ldots,K-1. $$

This derivation assumes that the fitted logits are finite and that the categories in the model are mutually exclusive and collectively exhaustive for the variable being imputed. With finite logits, each weight is positive and finite, so every probability is positive and the denominator is positive. The probabilities sum to one because their numerators sum to the denominator. In practice, probabilities may be extremely close to zero or one, but rounding should not be used to conceal computational problems.

Worked Example: Normalizing Three Category Logits

Suppose a hypothetical nominal outcome has categories A, B, and C, with C as baseline. For a case with specified predictors, assume the fitted logits are \(\eta_A=0.7\) and \(\eta_B=-0.4\). Find all three probabilities.

The relative weights are \(w_A=\exp(0.7)\), \(w_B=\exp(-0.4)\), and \(w_C=1\). Numerically, these are approximately \(2.014\), \(0.6703\), and \(1\). The common denominator is \(D=2.014+0.6703+1=3.6843\).

Therefore, \(p_A=2.014/3.6843=0.5467\), \(p_B=0.6703/3.6843=0.1819\), and \(p_C=1/3.6843=0.2714\), to four significant figures.

The check is \(0.5467+0.1819+0.2714=1.0000\), up to rounding. These values describe the model's conditional probabilities for a case with these predictors; they do not mean that the case must be assigned to the most probable category A.

Turning Probabilities into a Stochastic Imputation

For a missing nominal value, a stochastic imputation selects one category at random using its conditional probabilities. A convenient way to implement this is with a uniform random number \(U\) on \([0,1)\) and cumulative probability intervals. If the category probabilities in order are \(p_1,\ldots,p_K\), assign category 1 when \(0\leq U<p_1\), category 2 when \(p_1\leq U<p_1+p_2\), and continue in this way, assigning category \(K\) to the remaining interval. The length of each interval is its category's probability, so the probability of assigning category \(k\) is \(p_k\).

In a MICE iteration, predictors for a missing case include its observed predictors and the current values of other variables that are incomplete. The fitted conditional model produces the logits for that case; normalization gives its category probabilities; then the categorical draw replaces the missing entry. Observed values of the variable being imputed are not redrawn in that update. A later visit to the variable in the chain can use updated values of other incomplete variables.

Worked Example: Drawing a Category with a Uniform Random Number

Use the probabilities from the previous hypothetical example: \(p_A=0.5467\), \(p_B=0.1819\), and \(p_C=0.2714\). Suppose the random number for this missing case is \(U=0.63\). Which category is imputed?

The cumulative intervals are A for \(0\leq U<0.5467\), B for \(0.5467\leq U<0.5467+0.1819=0.7286\), and C for \(0.7286\leq U<1\). Since \(0.5467\leq0.63<0.7286\), the stochastic imputation is category B.

This draw is not an error even though A had the largest probability. Repeating the draw for cases with the same model probabilities would assign categories in proportions that tend toward \(0.5467\), \(0.1819\), and \(0.2714\), rather than assigning A to every case.

The category draw represents uncertainty about which outcome occurs for a case under the fitted conditional distribution. Multiple imputation also needs to reflect uncertainty in the model parameters: a typical proper-imputation procedure draws model parameters from an appropriate posterior or sampling distribution, then calculates probabilities and draws categories using that parameter draw. If the same fitted coefficients are held fixed throughout, categorical randomness remains, but parameter uncertainty is omitted. The exact parameter-drawing method depends on the model-fitting procedure; the probability normalization and category draw are the same once a set of logits has been obtained.

Worked Example: Updating Probabilities When a Logit Changes

Consider a hypothetical three-category variable with baseline C. For one case, suppose the logits are \(\eta_A=-0.2\) and \(\eta_B=0.5\). Find the normalized probabilities, then identify the imputation if \(U=0.40\).

The weights are \(\exp(-0.2)=0.8187\), \(\exp(0.5)=1.6487\), and \(1\) for C. Thus \(D=0.8187+1.6487+1=3.4674\). The probabilities are \(p_A=0.8187/3.4674=0.2361\), \(p_B=1.6487/3.4674=0.4755\), and \(p_C=1/3.4674=0.2884\). Their sum is \(1.0000\), up to rounding.

The cumulative intervals are A from 0 to 0.2361, B from 0.2361 to \(0.2361+0.4755=0.7116\), and C from 0.7116 to 1. Since \(0.2361\leq0.40<0.7116\), category B is drawn. If the logits change in a later iteration because predictors or model parameters change, the weights, normalized probabilities, and interval boundaries must all be recalculated.

Checks, Alternatives, and Common Failure Modes

Several checks make this step of the imputation algorithm auditable. First, confirm that one logit has been calculated for every nonbaseline category and that the baseline weight is one. Second, check that all probabilities are between zero and one and that their sum is one within numerical tolerance. Third, verify that the cumulative intervals cover \([0,1)\) without gaps or overlaps. Finally, inspect the imputed category frequencies across cases and iterations alongside the observed data and model-predicted probabilities. Large discrepancies may be meaningful, but can also reveal a coding, category-order, or model-fitting problem.

For numerical stability, very large logits can cause direct exponentiation to overflow even when the final probabilities are well-defined. A standard calculation subtracts the largest of the \(K\) log-weights from every log-weight before exponentiation. Subtracting the same constant from all log-weights leaves the normalized probabilities unchanged, because the common factor cancels from numerator and denominator. This is a computational safeguard, not a change to the model.

A deterministic alternative is to assign the category with the largest probability. That produces a modal prediction, not a stochastic imputation: cases with identical predictors and probabilities always receive the same category. It suppresses variation in the completed data and can distort category proportions. Separately fitting binary models for each category does not automatically provide a valid categorical distribution, because the resulting probabilities need not sum to one. For a nominal outcome, the multinomial model directly represents the competing categories and its normalized probabilities support a coherent draw. Ordinal models, by contrast, use an ordering assumption that is not appropriate merely because a variable has several categories.

Common mistake: Treating \(\exp(\eta_k)\) as the probability of category \(k\), or assigning every case to the category with the largest logit. The exponentiated logit is an odds ratio against the baseline, not a probability. Set the baseline weight to one, divide every weight by the sum of all weights, and draw a category from the resulting distribution.

The conversion itself does not guarantee that the conditional model is appropriate. Its probabilities are only useful for imputation if the predictor specification and fitted model reasonably represent the conditional distribution of the nominal variable. Model diagnostics should therefore consider fit and stability as well as arithmetic correctness. A valid sum-to-one check cannot detect a misspecified relationship, omitted relevant predictors, or inadequate parameter uncertainty. Extremely large logits, unstable estimates, repeated imputed patterns, or implausible conditional distributions warrant investigation rather than automatic acceptance.

The central distinction is between predicting a probability distribution and imputing a category. Normalization supplies the distribution for a case; random sampling supplies a category while retaining the model's uncertainty about the outcome. Neither step should be replaced by rounding logits, treating odds as probabilities, or selecting the modal category for every missing value.

Check Your Understanding

Work through each question, then compare your reasoning with the solutions.

  1. With baseline C, the logits are \(\eta_A=0\) and \(\eta_B=\log(3)\). Find the three category probabilities.
  2. For probabilities \(p_A=0.2\), \(p_B=0.5\), and \(p_C=0.3\), what category is drawn when \(U=0.72\)?
  3. Why does assigning every missing case to its most probable category differ from stochastic imputation?
  4. What is omitted if probabilities are calculated from one fixed set of coefficients and categories are then sampled?

Solutions. (1) The weights are \(1\), \(3\), and \(1\), so the denominator is \(1+3+1=5\). Thus \(p_A=1/5=0.2\), \(p_B=3/5=0.6\), and \(p_C=1/5=0.2\). (2) The cumulative intervals are A: \([0,0.2)\), B: \([0.2,0.7)\), and C: \([0.7,1)\). Since \(0.7\leq0.72<1\), draw C. (3) Modal assignment always selects the largest-probability category and does not preserve the distribution's case-level randomness; stochastic imputation samples according to all category probabilities. (4) The draws include outcome-level categorical randomness but omit uncertainty in the model parameters.

Clinical Biostats