Why Compare Categories Directly?
A baseline-category logit model reports a logit for each nonbaseline category relative to one designated baseline. Yet a scientific question may compare two nonbaseline categories directly: for example, whether the odds of choosing treatment B rather than treatment C change with age. The two fitted logits contain exactly the information needed for this comparison. Subtracting them gives the log odds for one category versus the other, and exponentiating gives the corresponding odds ratio.
The subtraction also matters for uncertainty. The two fitted logits are generally correlated because their coefficient estimates come from the same multinomial model. A standard error for their difference must therefore use the covariance between the estimates, not just their separate variances.
Pairwise Log Odds From Baseline Logits
Suppose the response has categories \(0,1,\ldots,J\), with category \(0\) as the baseline. At covariate value \(x\), write \(p_j(x)\) for the probability of category \(j\). The baseline-category model specifies \( \eta_j(x)=\log\{p_j(x)/p_0(x)\}=z_j(x)^{\mathsf T}\beta_j \) for \(j=1,\ldots,J\). Here \(z_j(x)\) is the design vector for category \(j\), and \(\beta_j\) is its coefficient vector. The baseline logit is defined as \(\eta_0(x)=0\).
If both categories are nonbaseline, subtract their logits. If one is the baseline, the comparison is just the corresponding baseline logit, with its sign determined by the order of the comparison.
To verify the result when both categories are nonbaseline, use the definitions of the logits: \( \eta_a(x)-\eta_b(x)=\log\{p_a(x)/p_0(x)\}-\log\{p_b(x)/p_0(x)\}=\log\{p_a(x)/p_b(x)\} \). When \(a=0\), \(\eta_0-\eta_b=-\log\{p_b/p_0\}=\log\{p_0/p_b\}\). When \(b=0\), \(\eta_a-\eta_0=\log\{p_a/p_0\}\). If \(a=b\), both sides equal zero. This covers every pair.
The identity can also be seen from the softmax representation: all category probabilities share the same normalizing denominator, which cancels in their ratio. The pairwise log odds are therefore linear contrasts of the fitted logits, even though the category probabilities themselves are not linear functions of the coefficients.
Worked Example: Comparing Two Nonbaseline Categories
Suppose category A is the baseline, with logits for categories B and C \( \eta_B(x)=-0.4+0.7x \) and \( \eta_C(x)=0.2-0.1x \). Find the odds of B rather than C when \(x=2\).
First evaluate both logits: \( \eta_B(2)=-0.4+0.7(2)=1.0 \) and \( \eta_C(2)=0.2-0.1(2)=0.0 \). Thus the B-versus-C log odds are \( \eta_B(2)-\eta_C(2)=1.0-0.0=1.0 \).
Exponentiating gives the odds ratio: \( \exp(1.0)\approx2.718 \). At \(x=2\), the odds of category B rather than category C are about 2.72 to 1. This is a comparison between B and C, not between B and the baseline A.
Building the Coefficient Contrast
For inference, collect all nonbaseline coefficient vectors into one stacked vector, \( \beta=(\beta_1^{\mathsf T},\ldots,\beta_J^{\mathsf T})^{\mathsf T} \). Let \(\widehat{\beta}\) be its fitted estimate and let \(\widehat{\Sigma}\) be the estimated covariance matrix of that full vector. At a fixed covariate value \(x\), the pairwise log odds can be written as \(c_{ab}(x)^{\mathsf T}\beta\), where the contrast vector places the appropriate design vectors into the relevant category blocks.
- If \(a\) and \(b\) are both nonbaseline, put \(z_a(x)\) in block \(a\), \(-z_b(x)\) in block \(b\), and zero in every other block.
- If \(a\) is nonbaseline and \(b=0\), put \(z_a(x)\) in block \(a\) and zero elsewhere.
- If \(a=0\) and \(b\) is nonbaseline, put \(-z_b(x)\) in block \(b\) and zero elsewhere.
The fitted log odds are \( \widehat{\Delta}_{ab}(x)=c_{ab}(x)^{\mathsf T}\widehat{\beta} \), and the fitted odds ratio is \( \exp\{\widehat{\Delta}_{ab}(x)\} \). The contrast vector depends on the comparison and the covariate values; it is not generally just a difference between two intercept estimates.
The variance identity follows from the definition of a covariance matrix. For any random vector \(U\) with finite second moments and fixed vector \(c\), \( \operatorname{Var}(c^{\mathsf T}U)=E[(c^{\mathsf T}\{U-E[U]\})^2] \). Writing the scalar inside the expectation as a quadratic form gives \( E[(U-E[U])^{\mathsf T}cc^{\mathsf T}(U-E[U])] \). Expanding by components yields \(c^{\mathsf T}\operatorname{Cov}(U)c\). Applying this linear-contrast identity to the fitted coefficient vector and substituting its estimated covariance matrix gives the stated estimated variance. \(\square\)
In block form, the variance for two nonbaseline logits includes both their within-category variances and their cross-category covariance. For example, when they share design vector \(z(x)\), the contrast is \(z(x)^{\mathsf T}\widehat{\beta}_a-z(x)^{\mathsf T}\widehat{\beta}_b\), so its estimated variance is \( z(x)^{\mathsf T}\{\widehat{\Sigma}_{aa}+\widehat{\Sigma}_{bb}-\widehat{\Sigma}_{ab}-\widehat{\Sigma}_{ba}\}z(x) \). This expression shows why treating the fitted logits as independent is generally unjustified.
Worked Example: A Baseline Comparison and Its Standard Error
Let A be the baseline. At \(x=1.5\), suppose the fitted logit for B is \( \eta_B(x)=0.3-0.5x \). The estimated coefficient vector, ordered as intercept and slope, is \( \widehat{\beta}_B=(0.3,-0.5)^{\mathsf T} \), with estimated covariance matrix \( \widehat{\Sigma}_{BB}=\begin{pmatrix}0.04&-0.01\\-0.01&0.0225\end{pmatrix} \). Find the fitted B-versus-A odds ratio and its standard error on the log-odds scale.
The fitted log odds are \( \widehat{\Delta}_{BA}(1.5)=0.3-0.5(1.5)=0.3-0.75=-0.45 \). Therefore the fitted odds ratio is \( \exp(-0.45)\approx0.638 \): the fitted odds of B rather than A are about 0.638 to 1.
The contrast vector is \(c=(1,1.5)^{\mathsf T}\). Its estimated variance is \( c^{\mathsf T}\widehat{\Sigma}_{BB}c =0.04+2(1)(1.5)(-0.01)+(1.5)^2(0.0225) =0.04-0.03+0.050625=0.060625 \). Thus the estimated standard error is \( \sqrt{0.060625}\approx0.246 \).
For illustration, an approximate 95% Wald interval for the log odds is \( -0.45\mathbin{\pm}1.96(0.246) \), or approximately \([-0.932,0.032]\). Exponentiating the endpoints gives an approximate 95% interval for the odds ratio of \([\exp(-0.932),\exp(0.032)]\approx[0.394,1.033]\). The interval includes 1, equivalently the log-odds interval includes 0.
Uncertainty and Approximate Inference
In a regular, identifiable multinomial logit model with a finite-dimensional parameter, suppose the observations are independent, the true parameter is an interior point, and the usual likelihood regularity conditions hold, including nonsingular Fisher information and a consistent maximum likelihood estimator. Under these conditions, the estimator is asymptotically normal, with covariance estimated by the inverse observed information (or another consistent covariance estimator). A fixed linear contrast is then approximately normal with estimated variance \(c^{\mathsf T}\widehat{\Sigma}c\).
This gives the approximate Wald interval \( \widehat{\Delta}_{ab}(x)\mathbin{\pm}z_{1-\alpha/2}\sqrt{c_{ab}(x)^{\mathsf T}\widehat{\Sigma}c_{ab}(x)} \) for the pairwise log odds, where \(z_{1-\alpha/2}\) is the corresponding standard normal quantile. Exponentiating both endpoints gives an approximate interval for the pairwise odds ratio. This is an interval for the ratio of category probabilities at the specified covariate values, not a probability interval for either category.
Worked Example: Comparing Two Nonbaseline Slopes
Suppose categories B and C have logits \( \eta_B(x)=\alpha_B+0.8x \) and \( \eta_C(x)=\alpha_C+0.3x \). The fitted slope estimates have variances \(0.09\) and \(0.04\), and their covariance is \(0.01\). Find the odds ratio describing how the B-versus-C odds change when \(x\) increases by one unit, and calculate its standard error on the log scale.
At covariate value \(x\), the B-versus-C log odds are \( \eta_B(x)-\eta_C(x)=(\alpha_B-\alpha_C)+(0.8-0.3)x=(\alpha_B-\alpha_C)+0.5x \). Increasing \(x\) by one changes these log odds by \(0.5\). Hence the ratio of the B-versus-C odds at \(x+1\) to those at \(x\) is \( \exp(0.5)\approx1.649 \). This is a change in pairwise odds across covariate values, not the odds ratio at one particular value of \(x\).
The slope contrast is the B slope minus the C slope. Its estimated variance is \(0.09+0.04-2(0.01)=0.11\), so its standard error is \( \sqrt{0.11}\approx0.332 \). An approximate 95% interval for the log change is \(0.5\mathbin{\pm}1.96(0.332)\), or approximately \([-0.150,1.150]\). Exponentiating gives an approximate interval of \([0.861,3.158]\) for the odds ratio associated with a one-unit increase in \(x\).
Common Mistake: Dropping the Covariance
A tempting but incorrect calculation is to take the variance of the B-versus-C log odds as the variance of the B logit plus the variance of the C logit. That treats the two fitted logits as independent. The correct expression subtracts twice their covariance when the contrast is B minus C. Depending on the sign and size of that covariance, ignoring it can either overstate or understate uncertainty.
For example, if two scalar fitted logits each have variance \(0.10\) and covariance \(0.06\), their difference has variance \(0.10+0.10-2(0.06)=0.08\), not \(0.20\). In a model with several coefficients per category, the same principle applies to the full covariance blocks and the covariate-dependent contrast vectors. Use the covariance matrix for the stacked coefficient estimate rather than combining separate standard errors informally.
Check Your Understanding
Answer each question using the category order stated.
- If \( \eta_B(x)=0.4+0.2x \) and \( \eta_C(x)=-0.1+0.5x \), what are the B-versus-C log odds at \(x=1\), and what is the corresponding odds ratio?
- For a comparison of a nonbaseline category \(a\) with the baseline category 0, what coefficient blocks appear in the contrast vector?
- Why does the variance of the difference between two fitted logits include their covariance?
- If the fitted A-versus-B odds ratio is 2.5, what is the fitted B-versus-A odds ratio?
- What does exponentiating the endpoints of a confidence interval for pairwise log odds produce?