Tutorials › Generalized Linear Mixed Models (GLMM) › Two-Level Ordinal Versus Binary Coding

Responses: Binary, Count, Ordinal, Overdispersed · Tutorial 73 of 698

Two-Level Ordinal Versus Binary Coding

Learn how binary and two-level ordinal coding represent the same response information, and when their GLMM formulations are equivalent.

Intermediate 11 min read

What You'll Learn

  • Identify when a two-category response has a meaningful order.
  • Explain why binary and ordinal labels preserve the same response information in this setting.
  • Derive the equivalence between a two-level cumulative-logit model and a binary logistic mixed model.
  • Calculate conditional probabilities under equivalent model parameterizations.
  • Recognize when numeric category scores or extra response states make a simple recoding inappropriate.
  • Diagnose coding and model-interpretation errors.

One Distinction, Two Labels

Suppose an outcome has exactly two possible categories: “no improvement” and “improvement.” The categories have a natural order, but the recorded response still distinguishes only two possibilities. It can be represented by the ordered labels or by an indicator such as \(Z=1\) for improvement and \(Z=0\) for no improvement. Choosing an ordinal label does not create additional response information; choosing a binary indicator does not discard the order between these two categories.

That equivalence is useful when selecting a model, interpreting a coefficient, or checking software output. The two representations may use different parameter names, but under matching assumptions they can describe exactly the same conditional probabilities. The choice should therefore be guided by clear category definitions and a model parameterization that matches the scientific question, not by the appearance of the recorded values.

Definition: A response with exactly two ordered categories has two mutually exclusive and exhaustive outcomes for each observational unit, and one category is meaningfully above the other in the stated ordering. A binary coding assigns one category the value 1 and the other 0. An ordinal coding records the category labels and their order. If these are the only two categories, either representation identifies the same outcome for every unit.

Conditions for Comparing the Codings

The comparison assumes the same observational units and the same two response categories in both representations. The coding must be one-to-one: every response in one representation maps to exactly one response in the other, with no category dropped, merged, or added. If category 2 is designated as the event, the binary response is 1 for category 2 and 0 for category 1. Reversing that designation also preserves the records, although it reverses the direction of coefficients.

For a clustered response, use the same cluster membership, predictors, random-effects structure, and link when comparing models. For example, let \(Y_{ij}\) be the response for unit \(i\) in cluster \(j\), with category 1 below category 2. Define \(Z_{ij}=1\) when \(Y_{ij}=2\), and \(Z_{ij}=0\) when \(Y_{ij}=1\). A conventional logistic mixed model specifies

$$ Z_{ij}\mid b_j \sim \operatorname{Bernoulli}(p_{ij}), \qquad \operatorname{logit}(p_{ij})=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_j, \qquad b_j\sim N(0,\Sigma). $$

Here \(p_{ij}\) is the probability of category 2 conditional on the random effects \(b_j\) and the covariates. This formulation assumes the Bernoulli response model is appropriate and, under the usual GLMM construction, responses are conditionally independent given the random effects and covariates. The random effects for distinct clusters are modelled as independent draws from the stated distribution. The choice of a normal random-effects distribution and of the fixed and random predictors is a modelling assumption, not a consequence of having two categories.

If the two categories have no meaningful order, they can still be represented as binary outcomes, but describing them as ordinal would add an unsupported ordering. Conversely, an outcome with additional ordered categories is not the two-category case: converting it to binary requires deciding which categories to combine, and that may discard distinctions.

Worked Example: Two Recordings of the Same Responses

In a hypothetical cluster of ten patients, the recorded outcome is either “no improvement” or “improvement.” Four patients have improvement. Suppose their conditional probability of improvement, at the specified covariates and random effect, is \(p=0.30\). Show how the two codings represent the same records and calculate the likelihood for these responses under this common probability.

With ordinal labels, the four improvement responses are category 2 and the other six are category 1. Under binary coding, the same records become four 1s and six 0s. The mapping from category 1 to 0 and category 2 to 1 loses no distinction because there are only these two categories.

For independent Bernoulli responses conditional on the covariates and random effect, the likelihood of this particular sequence is \(0.30^4(1-0.30)^6=0.30^4(0.70)^6\). Numerically, \(0.30^4=0.0081\) and \(0.70^6=0.117649\), so the likelihood is approximately \(0.0009530\). The same likelihood results if the records are written as categories 1 and 2, because those labels map one-to-one to the same event indicators.

This calculation is conditional on the specified probability; it does not estimate a cluster effect or establish that the probability is correct. It verifies the basic point: changing the labels does not change the response pattern or its likelihood when the model assigns corresponding probabilities to the two categories.

Why the Two Logistic Formulations Match

A cumulative-logit formulation for an ordered response models the probability of being at or below each category boundary. With exactly two categories, there is only one boundary: category 1 versus category 2. Write a two-level cumulative-logit mixed model as

$$ \operatorname{logit}\{P(Y_{ij}\leq 1\mid b_j)\} =\theta_1-x_{ij}^{\mathsf T}\beta-z_{ij}^{\mathsf T}b_j. $$

The threshold \(\theta_1\) locates the boundary between the two categories. To compare this with the binary model, use \(Z_{ij}=1\) for category 2. Then \(P(Z_{ij}=1\mid b_j)=P(Y_{ij}=2\mid b_j)=1-P(Y_{ij}\leq1\mid b_j)\). For any probability \(q\), \(\operatorname{logit}(1-q)=-\operatorname{logit}(q)\). Therefore,

$$ \operatorname{logit}\{P(Z_{ij}=1\mid b_j)\} =x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_j-\theta_1. $$

This is a binary logistic mixed model with the same predictor slopes and random-effects terms. If the fixed-effects predictor includes an intercept \(\beta_0\), its binary intercept is \(\beta_0-\theta_1\). Thus, the threshold and intercept are not separately identified as two independent location parameters in this comparison; their difference determines the binary intercept. The random-effects distribution and covariance structure must also match for the models to be equivalent.

This derivation establishes equivalence of the conditional response probabilities under the stated parameterization. It does not mean that every program will display identical parameter names or estimates: software may use different signs, thresholds, or intercept conventions. Nor does it mean that the numerical threshold alone has the interpretation of a binary intercept. The likelihood and fitted probabilities are the appropriate objects to compare.

Worked Example: Matching a Threshold Model to a Binary GLMM

Consider a hypothetical two-level ordinal model for a response ordered from “not recovered” (category 1) to “recovered” (category 2). At a particular covariate value \(x=2\) and cluster random intercept \(b_j=0.3\), suppose \(\theta_1=0.7\), \(\beta_0=-0.2\), and \(\beta_1=0.5\), with linear predictor \(\beta_0+\beta_1x+b_j\). Calculate the conditional probability of recovery and its equivalent binary-model expression.

The ordinal location predictor is \(-0.2+(0.5)(2)+0.3=-0.2+1.0+0.3=1.1\). The cumulative logit for category 1 or below is \(\theta_1-1.1=0.7-1.1=-0.4\). Consequently, the conditional probability of category 1 is \(1/(1+e^{0.4})\approx0.4013\), and the probability of recovery is \(1-0.4013=0.5987\).

Equivalently, the binary model has intercept \(\beta_0-\theta_1=-0.2-0.7=-0.9\). Its logit for recovery is \(-0.9+(0.5)(2)+0.3=-0.9+1.0+0.3=0.4\). Thus \(P(Z_{ij}=1\mid b_j)=1/(1+e^{-0.4})\approx0.5987\), the same conditional probability. This agreement depends on using the same covariates and random intercept and on defining recovery as the event.

What the Coding Does Not Justify

Ordering two categories does not imply that they are separated by a measurable distance. If categories are assigned scores 1 and 2, the difference of one unit is a label convention, not evidence that the response is a normally distributed quantitative measurement. A binary probability model directly represents the probability of one category and respects the response support.

Worked Example: Why Numeric Labels Are Not Measurements

In a hypothetical sample, a binary model estimates a probability of category 2 equal to \(0.25\) for one covariate profile. Under scores 1 and 2, the mean score implied by that probability is \((1)(0.75)+(2)(0.25)=0.75+0.50=1.25\). If the same categories are instead labelled 1 and 10, the implied mean score is \((1)(0.75)+(10)(0.25)=0.75+2.50=3.25\).

The category-2 probability remains \(0.25\) under both labelings, but the score mean changes because the arbitrary numerical gap changed. This illustrates why the order of two categories does not, by itself, justify treating their codes as quantitative measurements in a Gaussian model. A model built for a quantitative response would require its own defensible assumptions; the category labels alone do not supply them.

Choosing a Representation and Checking It

For exactly two ordered categories, a binary logistic mixed model is often the most direct description: it names one category as the event and models its conditional probability. A two-level cumulative-logit model can express the same probabilities, but its ordinal structure provides no extra cutpoints or category distinctions in this case. This is a comparison of representations, not a claim that the binary and ordinal models are interchangeable for outcomes with more than two categories.

Before fitting or interpreting either representation, verify that the response definition is stable across units and clusters. Check that the two stated categories are exhaustive for the analysis, that each unit contributes the intended response, and that the designated event is consistent. If records include “unknown,” “not assessed,” or a third response state, silently assigning that state to one of the two categories changes the outcome definition. Decide explicitly how such records should be handled.

After fitting, compare the event definition, signs of coefficients, and fitted probabilities rather than relying on parameter labels alone. A positive coefficient means higher conditional odds of the category designated as the event in the binary model. In the cumulative formulation above, a positive slope increases the conditional probability of the upper category because the logit for the lower cumulative probability contains the negative slope. A reversed category ordering changes the coefficient direction; it does not imply a different underlying set of responses.

The conditional probabilities in a GLMM are conditional on the random effects. They are not generally the same as probabilities averaged over the random-effects distribution. Thus a probability calculated at \(b_j=0\) describes a cluster with random effect set to zero on the model’s linear predictor scale; it is not automatically the population-averaged probability. Keep that distinction in view when comparing model output or reporting results.

Common pitfall: “The outcome is ordered, so an ordinal model must contain more information than a binary model.” With exactly two categories, there is one distinction and one boundary; binary and two-level ordinal coding preserve the same records. Use the formulation whose event or threshold interpretation is clearest, and do not infer extra information from the word “ordinal.”

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A response has categories “mild” and “severe,” with severe designated as category 2. What binary coding corresponds to these labels, and does it discard information?
  2. In the cumulative-logit model \(\operatorname{logit}P(Y\leq1\mid b)=\theta_1-\eta\), derive the logit for category 2.
  3. Suppose the two-level ordinal model has \(\theta_1=0.4\) and \(\eta=0.9\). Calculate the conditional probability of category 2.
  4. A data file contains “mild,” “severe,” and “not recorded.” Can these three values be treated as the two-level ordinal response without further decisions? Explain.
  5. Why can assigning scores 1 and 2 to the categories fail to justify a Gaussian response model?

Solutions. (1) Set \(Z=0\) for mild and \(Z=1\) for severe. Because the mapping is one-to-one across the two response categories, it discards no information. (2) Since \(P(Y=2)=1-P(Y\leq1)\), \(\operatorname{logit}P(Y=2\mid b)=-\operatorname{logit}P(Y\leq1\mid b)=-(\theta_1-\eta)=\eta-\theta_1\). (3) The category-2 logit is \(0.9-0.4=0.5\), so its probability is \(1/(1+e^{-0.5})\approx0.6225\). (4) No. “Not recorded” is an additional state, not one of the two stated ordered response categories. Its treatment must be specified rather than silently combining it with mild or severe. (5) The scores are labels unless a quantitative scale is justified. Their numerical gap can be changed without changing the category probabilities, and a Gaussian model does not directly represent a response restricted to two categories.

Clinical Biostats