Why categorical imputation must reflect the hierarchy
A categorical variable observed for people within clinics, schools, or other groups has two features to represent: its category structure and the dependence among observations in the same cluster. An ordinal response, such as a three-level severity rating, has a meaningful order. A nominal response, such as treatment preference, does not. Choosing a model that ignores either the order or the clustering can distort the category probabilities used to fill in missing values.
The imputation model should also distinguish predictors measured for individuals from predictors measured for clusters. Individual-level predictors can vary within a cluster; a cluster-level predictor has one value shared by all individuals in that cluster. If there is a reason to separate within-cluster and between-cluster associations for an individual-level predictor, its cluster mean can be included alongside the individual’s deviation from that mean, as in the earlier material on nonlinear effects within and between clusters.
Model assumptions and category probabilities
Let \(Y_{ij}\) be a categorical variable for individual \(i\) in cluster \(j\). For an ordinal variable, suppose its \(K\) categories are ordered from 1 to \(K\). A cumulative-logit model with a cluster random intercept is
Here \(X_{ij}\) contains individual-level predictors, \(W_j\) contains cluster-level predictors, \(\tau_1<\cdots<\tau_{K-1}\) are ordered cutpoints, and \(b_j\) is a shared cluster effect. A common assumption is \(b_j\sim N(0,\sigma_b^2)\), independently across clusters. Conditional on predictors and \(b_j\), individuals’ outcomes are usually treated as independent. The shared \(b_j\) induces dependence among people in the same cluster.
The model assumes proportional odds: each predictor has the same coefficient at every cumulative split \(Y\leq k\) versus \(Y>k\). With the displayed sign convention, a positive predictor coefficient shifts probability toward higher categories. To obtain the probability of each category, define \(F(t)=1/(1+\exp(-t))\), \(\tau_0=-\infty\), and \(\tau_K=+\infty\). Set \(\eta_{ij}=X_{ij}^{T}\beta+W_j^{T}\gamma+b_j\). Then
For a nominal variable, categories have no natural order. Choose category \(K\) as a reference and use a baseline-category multinomial-logit model:
The vector \(\mathbf{u}_j=(u_{j1},\ldots,u_{j,K-1})^T\) represents shared cluster effects and is commonly modeled as multivariate normal with mean zero and covariance matrix \(\Sigma\). The category probabilities are the softmax probabilities: if \(q_{ijk}=\exp(\alpha_k+X_{ij}^{T}\beta_k+W_j^{T}\gamma_k+u_{jk})\) for \(k<K\), and \(q_{ijK}=1\), then \(P(Y_{ij}=k)=q_{ijk}/\sum_{\ell=1}^K q_{ij\ell}\). Category-specific coefficients allow predictor effects to differ across contrasts with the reference category. Changing the reference changes coefficient descriptions, not the fitted probabilities.
These models require the category order to be substantively meaningful for the ordinal model, a suitable link and predictor specification, and enough observed data to estimate the cutpoints or category-specific coefficients. The random-effects distribution and conditional-independence assumptions should be reasonable. For imputation under a missing-at-random assumption, the conditional model should include observed variables that predict the missing category or its missingness, including variables used in the substantive analysis. If a category is absent or extremely rare in many clusters, cluster-specific probabilities may be poorly determined.
Why the category formula is coherent
For the ordinal model, write \(C_k=P(Y_{ij}\leq k\mid X_{ij},W_j,b_j)\), with \(C_0=0\) and \(C_K=1\). The category events are disjoint, and \(\{Y=k\}=\{Y\leq k\}\setminus\{Y\leq k-1\}\). Therefore \(P(Y=k)=C_k-C_{k-1}\). The ordered cutpoints make \(F(\tau_k-\eta)\) nondecreasing in \(k\), so these differences are nonnegative. They sum to
Thus the cumulative model yields a valid probability distribution over the original categories without fitting a separate binary model for every split. In a multilevel model, these probabilities are conditional on the cluster effect. A shared effect matters: people in the same cluster use the same \(b_j\) or \(\mathbf{u}_j\), which can make their category outcomes associated even when their individual-level predictors differ.
Worked Example: Ordinal probabilities with a cluster effect
Suppose a hypothetical three-category symptom rating is modeled with cutpoints \(\tau_1=-0.5\), \(\tau_2=1.0\). For one person, the combined fixed-predictor contribution is \(0.7\), and the cluster effect is \(b_j=0\), so \(\eta_{ij}=0.7\). The cumulative probabilities are
The category probabilities are therefore \(P(Y=1)=0.2315\), \(P(Y=2)=0.5744-0.2315=0.3429\), and \(P(Y=3)=1-0.5744=0.4256\). They sum to \(1.0000\). If a random number used for the categorical draw is \(0.73\), the cumulative probability through category 2 is \(0.5744\), and through category 3 is 1; the imputed category is 3.
For another person in the same cluster, suppose the fixed contribution is still \(0.7\), but the shared cluster effect is \(b_j=-0.4\). Now \(\eta_{ij}=0.3\). The cumulative probabilities are \(F(-0.8)=0.3100\) and \(F(0.7)=0.6682\), giving category probabilities \(0.3100\), \(0.6682-0.3100=0.3582\), and \(1-0.6682=0.3318\). The same cluster effect enters each person’s predictor; it is not a new independent effect for every missing row.
Worked Example: Nominal probabilities with category-specific effects
Consider a hypothetical three-category preference variable \(A,B,C\), with \(C\) as the reference. Let \(x=1\), and suppose the fitted cluster-specific logits are \(\log\{P(A)/P(C)\}=0.2+0.5x+u_{jA}\) and \(\log\{P(B)/P(C)\}=-0.4+0.3x+u_{jB}\). For a cluster with \(u_{jA}=0.1\) and \(u_{jB}=-0.2\), the logits are \(0.8\) and \(-0.3\).
Exponentiating gives relative weights \(q_A=\exp(0.8)=2.2255\), \(q_B=\exp(-0.3)=0.7408\), and \(q_C=1\). The sum is \(2.2255+0.7408+1=3.9663\). Therefore \(P(A)=2.2255/3.9663=0.5611\), \(P(B)=0.7408/3.9663=0.1868\), and \(P(C)=1/3.9663=0.2521\), which sum to 1.0000. A draw of \(0.68\) falls above the \(A\) interval \([0,0.5611)\) and below the cumulative \(A\)-or-\(B\) probability \(0.7479\), so the imputed category is \(B\).
Unlike an ordinal model, this approach does not force a common direction or size of effect across categories. That flexibility is useful for genuinely unordered categories, but it requires more parameters as the number of categories grows.
Using predictors from both levels
The predictor specification should reflect how the data were generated and how the substantive analysis will use them. For example, including only an individual-level measurement \(X_{ij}\) can blend its within-cluster and between-cluster associations. A useful specification may include the cluster mean \(\bar{X}_j\) and the deviation \(X_{ij}-\bar{X}_j\) separately, together with a cluster-level predictor \(W_j\). The example below shows how these terms change the ordinal imputation probabilities.
Worked Example: Separating within- and between-cluster predictors
Suppose a hypothetical ordinal rating has three ordered categories and cutpoints \(0\) and \(1.5\). Its linear predictor is \(\eta_{ij}=0.6(X_{ij}-\bar{X}_j)+0.25\bar{X}_j+0.4W_j+b_j\), where \(X_{ij}\) and its cluster mean are measured in a common scale, \(W_j\) is a binary cluster characteristic, and \(b_j\) is the cluster effect. For an individual with \(X_{ij}=8\), \(\bar{X}_j=6\), \(W_j=1\), and \(b_j=0.3\),
The cumulative probabilities are \(F(0-3.4)=F(-3.4)=0.0323\) and \(F(1.5-3.4)=F(-1.9)=0.1301\). Hence the category probabilities are \(0.0323\), \(0.1301-0.0323=0.0978\), and \(1-0.1301=0.8699\). For an individual with \(X_{ij}=4\) in the same cluster, the predictor is \(0.6(4-6)+1.5+0.4+0.3=1.0\). The cumulative probabilities become \(F(-1)=0.2689\) and \(F(0.5)=0.6225\), giving category probabilities \(0.2689\), \(0.3536\), and \(0.3775\). The contrast in probabilities reflects the within-cluster deviation while retaining the same cluster mean, cluster characteristic, and shared effect.
Imputation, alternatives, and diagnostics
In a chained-equations procedure, the relevant conditional model is fitted using observed values and the current values of other variables in the imputation system. For each missing categorical value, the model supplies probabilities for all allowed categories, and a category is drawn from that distribution. The draw should reflect uncertainty in the fitted model and cluster effects; substituting a single fitted most-likely category would suppress variation and understate uncertainty. A cluster-level categorical variable is different: it has one value per cluster, so it should be imputed once at the cluster level and then represented consistently for its members, not independently for each row.
A pooled single-level ordinal or multinomial model is simpler, but treats observations as conditionally independent across clusters and may misrepresent both uncertainty and cluster-specific category patterns. A cumulative-link model uses the ordinal information efficiently when proportional odds is reasonable. A multinomial model avoids that restriction but spends more parameters and ignores ordering. Fitting separate binary models for ordinal thresholds is another possible strategy, but their predicted cumulative probabilities can violate the required ordering unless constraints are imposed. The model choice should be based on the variable’s meaning and diagnostics, not on which model produces the most convenient result.
Useful checks include examining category counts overall and by cluster, inspecting whether imputations reproduce important observed associations, and checking convergence and stability of model estimates. For an ordinal model, assess whether the common-slope proportional-odds assumption is plausible; systematic differences across cumulative splits warn against it. For a nominal model, check whether some category contrasts are nearly unsupported by the data or whether estimates are unstable. Compare observed and imputed category frequencies within relevant predictor and cluster groups. Implausible cluster-specific predictions, persistent computational warnings, or chains that do not stabilize are reasons to revisit the specification, category coding, or available information.
No model can recover a category that is unsupported by the observed data without strong assumptions. Sparse clusters, very rare categories, few clusters, and a misspecified random-effects distribution can make estimates fragile. Do not collapse categories solely to make a model run: collapsing changes the scientific meaning and may discard a meaningful order or distinction. Instead, assess whether the variable can be modeled more parsimoniously, whether predictors can be simplified without omitting essential analysis terms, or whether the limits of the available information must be reported.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions below.
- In a cumulative-logit model with three categories, the cumulative probabilities are \(0.20\) and \(0.65\). What are the three category probabilities?
- Why does a shared cluster intercept induce dependence among individuals’ categorical outcomes?
- A four-category response has no meaningful ordering. Which model family is generally appropriate, and what does its reference category do?
- A categorical predictor has one value shared by everyone in each clinic. Should it be imputed separately for each person or once per clinic?
- Name one diagnostic warning for a cumulative-link model and one for a multinomial model.
Solutions. (1) The probabilities are \(0.20\), \(0.65-0.20=0.45\), and \(1-0.65=0.35\); they sum to 1. (2) Individuals in the same cluster share the same latent shift in their category probabilities, so their outcomes are conditionally linked through that common effect even if independent given it. (3) Use a multinomial model; its reference category defines the baseline for the category-specific log-odds, without changing the model’s probabilities. (4) Impute once per clinic, because the variable is defined at the clinic level, and use that value consistently for its members. (5) A proportional-odds violation is a warning for the cumulative model; unstable category-specific estimates or near-empty categories are warnings for the multinomial model.