Tutorials › Multiple Imputation by Chained Equations (MICE) › Imputing Missing Level-2 Values

Nested and Multilevel Data · Tutorial 346 of 497

Imputing Missing Level-2 Values

Learn to build a cluster-level imputation dataset, choose useful summaries, and return one appropriately drawn value to every member of a cluster.

Advanced 12 min read

What You'll Learn

  • Explain why a cluster-level variable must contribute one imputation record per cluster, not one per person.
  • Construct cluster-level summaries of individual-level predictors for imputing a missing cluster-level value.
  • State the assumptions needed for a cluster-level conditional imputation model.
  • Work through a predictive draw and copy the resulting value consistently to all cluster members.
  • Diagnose problems caused by duplicate weighting, weak overlap, unsuitable summaries, and deterministic imputation.
  • Compare cluster-level imputation with person-level regression and constant-mean replacement.

Why the Imputation Unit Matters

A level-2 variable belongs to a cluster: for example, a clinic’s staffing policy, a school’s funding category, or a neighborhood’s average resource level. Although it may appear on every person’s row in a long data set, it has only one value per cluster. If that value is missing, the imputation must preserve that structure: one value is drawn for the cluster and then shared by all its members.

The central practical step is to create an imputation data set with one row per cluster. Cluster-level predictors can be included directly. Individual-level variables can contribute summaries—such as a cluster mean or proportion—when those summaries are relevant to the conditional distribution of the missing cluster-level variable. This is not the same as treating all people as independent evidence about a cluster-level value.

Definition: Let \(j=1,\ldots,J\) index clusters and \(i=1,\ldots,n_j\) index members of cluster \(j\). A level-2 variable \(W_j\) has one value for cluster \(j\), even if it is displayed repeatedly on the \(n_j\) person-level rows. For imputing missing \(W_j\), form one record per cluster, draw one imputed value \(W_j^{(m)}\), and assign that same value to every member \(i\) of cluster \(j\) in completed data set \(m\).

The earlier material on Imputing Cluster-Level Variables Without Replication established why repeated person-level rows do not provide independent replications of a cluster-level value. Here the focus is on constructing and using a cluster-level imputation dataset, including relevant summaries of level-1 information.

Model and Assumptions

For a continuous \(W_j\), a simple conditional model might be

$$ W_j \mid Z_j,S_j \sim N(\gamma_0+\gamma^\mathsf{T}Z_j+\delta^\mathsf{T}S_j,\tau^2), $$

where \(Z_j\) contains observed cluster-level predictors and \(S_j\) contains selected summaries of individual-level variables within cluster \(j\). Examples of \(S_j\) include a mean, a proportion, or a spread. The model is defined over clusters, not over individual rows. For a categorical \(W_j\), the conditional model must instead respect its categories; an ordinary normal regression is not justified merely because categories have been coded as numbers.

The imputation is appropriate only insofar as its assumptions are plausible. In particular, the missingness of \(W_j\) should be explainable by variables observed for that cluster and by the summaries included in the model (the usual missing-at-random condition for this conditional imputation). The chosen conditional model should represent the important relationships needed for the analysis, its functional form and residual distribution should be reasonable, and there should be adequate overlap: clusters with missing \(W_j\) should not require predictions far beyond the predictor patterns represented among clusters with observed \(W_j\). In addition, the cluster identifier and membership must be correct, and \(W_j\) must genuinely be constant within a cluster.

In practice, a multiple-imputation procedure should reflect both uncertainty about the model parameters and uncertainty about a missing value given those parameters. A prediction at the fitted conditional mean alone is not a complete imputation: it suppresses variation between plausible values and can make completed data sets artificially similar. The examples below show a predictive draw with explicitly stated parameter values to make the arithmetic transparent.

From Person-Level Rows to Cluster-Level Records

Suppose person-level data contain a level-1 measurement \(X_{ij}\). A cluster mean can be calculated as

$$ \bar X_j=\frac{1}{n_j}\sum_{i=1}^{n_j}X_{ij}. $$

This summary can help predict \(W_j\) when the distribution of the cluster-level variable is associated with the average level-1 measurement. A mean is not automatically the right summary: a proportion may be suitable for a binary variable, and a mean alone may miss important differences in spread or composition. The summary should be chosen to preserve information needed by the substantive analysis, rather than selected only because it is easy to calculate.

If the level-1 variable has missing values, the summary must be defined using a defensible set of values in each imputation. For example, when a current completed version of that variable is available, its cluster summary can be calculated for that iteration. If some cluster summaries are based on very few observations, they may be noisy; treating them as exact covariates can overstate their information. The earlier material on Cluster Means And Their Sampling Uncertainty addresses that issue. This tutorial assumes the summaries supplied to the cluster-level model are appropriately constructed for the analysis at hand.

Worked Example: Building a Clinic-Level Imputation Dataset

In a hypothetical set of clinics, \(W_j\) is the number of staff training days per year. It is observed for three clinics and missing for clinic D. The available cluster information is:

ClinicNumber of patients \(n_j\)Mean patient severity \(\bar X_j\)Training days \(W_j\)
A204.03.0
B305.05.0
C256.06.0
D157.0Missing

The imputation data set has four rows, one per clinic. A proposed conditional model uses \(\bar X_j\) to predict training days. For illustration, suppose one iteration has produced a parameter draw with intercept \(4.1\), slope \(1.1\) per severity point, and residual standard deviation \(1.4\) training days. For clinic D, the conditional mean is

$$ 4.1+1.1(7.0)=11.8\text{ training days}. $$

Suppose the predictive residual draw for D is \(-0.5(1.4)=-0.7\) training days. Then the imputed value for this iteration is

$$ W_D^{(m)}=11.8-0.7=11.1\text{ training days}. $$

The value \(11.1\) is assigned to every patient in clinic D in completed data set \(m\); it is not separately drawn for each of D’s 15 patients. The model and draw are illustrative, not a claim that these parameters were estimated reliably from three observed clinics. With so few observed clusters, the conditional model could be highly uncertain, which should be assessed rather than hidden by the calculation.

Why Repeating Rows Changes the Problem

If a cluster-level variable is copied onto every person-level row and those rows are then treated as independent observations in its imputation model, large clusters contribute more records than small clusters. That changes the effective weighting and can make uncertainty appear smaller than it is. The number of people in a cluster can be useful information, but it should enter through a reasoned model choice—not accidentally because a cluster’s value was duplicated.

The distinction follows directly from the likelihood for the cluster-level conditional model. If the cluster records are \(W_1,\ldots,W_J\), and clusters are conditionally independent given their predictors, their contribution has the form

$$ L(\gamma,\tau^2)=\prod_{j=1}^{J} f(W_j\mid Z_j,S_j;\gamma,\tau^2). $$

Duplicating \(W_j\) \(n_j\) times and treating those copies as independent would instead produce a factor proportional to \(f(W_j\mid Z_j,S_j;\gamma,\tau^2)^{n_j}\). That is not the likelihood for \(J\) independent cluster-level values: it gives a cluster with more members a larger contribution solely because its one value appears on more rows. The one-row-per-cluster construction avoids this accidental replication.

Worked Example: Seeing the Effect of Duplicate Weighting

Suppose two hypothetical clusters have observed values of a cluster-level covariate \(W\): cluster A has \(W_A=0\) and \(n_A=2\), while cluster B has \(W_B=10\) and \(n_B=8\). The mean across the two distinct clusters is

$$ \frac{0+10}{2}=5. $$

If the values are duplicated across person-level rows and the row mean is calculated, the result is instead

$$ \frac{2(0)+8(10)}{2+8}=\frac{80}{10}=8. $$

The value 8 is a person-weighted mean, not the equally cluster-weighted mean of 5. Neither target is universally right for every analysis, but using 8 unintentionally in a cluster-level imputation model changes the target without justification. The imputation record should therefore be one per cluster, with cluster size included or handled only when the intended model calls for it.

Turning a Draw Back into Person-Level Data

After generating a value for each missing cluster, join the imputed cluster-level data back to the person-level data using the cluster identifier. Observed values of \(W_j\) remain unchanged; imputed values replace only those clusters with missing \(W_j\). Every member of a given cluster must receive the same completed value in each imputed data set.

1
Check the cluster structure.
Confirm that the identifier maps each person to one cluster and that the level-2 variable is consistent within clusters wherever observed.
2
Create one record per cluster.
Retain level-2 variables and construct selected summaries of level-1 variables using a stated rule.
3
Fit and draw from the conditional model.
Use an appropriate model for the variable type, and include parameter and predictive uncertainty in the imputation.
4
Return the cluster value to all members.
Merge by cluster identifier and verify that the completed level-2 value is identical within each cluster.

Worked Example: A Summary Predicts a Missing Cluster Value

Consider a hypothetical study of six clinics. Each clinic has a mean patient outcome score \(\bar X_j\), and a cluster-level measure \(W_j\) records a clinic resource index. Clinic F has six patients whose outcome scores sum to 42, so its cluster mean is

$$ \bar X_F=\frac{42}{6}=7.0\text{ score points}. $$

Suppose a fitted conditional model for the resource index has a parameter draw giving the conditional mean \(2+0.6\bar X_j\), and a residual standard deviation of \(1.0\) index point. For clinic F, the predicted mean is

$$ 2+0.6(7.0)=6.2\text{ index points}. $$

If this iteration draws a standardized predictive residual of \(0.4\), then the residual contribution is \(0.4(1.0)=0.4\) index points, and the imputed clinic value is \(6.2+0.4=6.6\) index points. All six patients in clinic F receive \(W_F^{(m)}=6.6\). This calculation assumes the mean score is an appropriate predictor, the model’s scale is suitable for the resource index, and clinic F’s predictor value is within the range supporting prediction. If the index has a restricted range, the model must also respect that restriction.

Diagnostics, Alternatives, and Limitations

A useful diagnostic starts with structure, not a plot: check that each cluster has one record in the imputation data set, that the observed level-2 values do not conflict within clusters, and that each completed data set has exactly one \(W_j\) per cluster. Then examine whether clusters with missing values resemble observed clusters on the predictors and summaries used by the model. Extreme extrapolation, sparse predictor regions, implausible imputed values, or a large change in the distribution of \(W_j\) across imputations can indicate a poor model or weak information.

Also inspect whether the summaries are behaving as intended. A cluster mean computed from a handful of observed members may be much less precise than one computed from many members. A mean can conceal important within-cluster spread or subgroups. If cluster size is related to the variable being imputed or to missingness, ignoring size may also be consequential; including size mechanically as a weight is not a general remedy. The model must reflect the estimand and data-generating structure.

ApproachWhat it doesMain concern
One-row-per-cluster conditional imputationModels the missing level-2 value using cluster predictors and selected summaries, then returns one draw per cluster.Needs suitable summaries, a plausible conditional model, and enough observed clusters to estimate it.
Person-level regression with duplicated level-2 valuesRepeats the cluster-level value on every member’s row as if those records independently inform its model.Can overweight larger clusters and understate uncertainty.
Replace by a constant, such as the observed meanAssigns the same fixed value to every cluster with missing data.Ignores predictor relationships and imputation uncertainty; usually inappropriate for multiple imputation.

The cluster-level approach does not automatically solve every multilevel missing-data problem. Results can be unreliable with very few observed clusters, weak predictor overlap, poorly measured summaries, or a conditional model that conflicts with the analysis model. It also presumes the level-2 variable itself is genuinely shared within clusters. If different members have distinct values, the variable may instead be level 1 or require a more careful definition. The method here addresses a missing level-2 value; it does not by itself specify a joint strategy when values are missing at both levels.

Common Mistakes

  • “There are 200 people, so there are 200 observations of the clinic value.” There may be 200 rows, but the clinic-level value has as many distinct records as there are clinics.
  • “The cluster mean is always an exact predictor.” A mean based on a small number of members is noisy; its construction and precision can matter.
  • “The fitted value is the imputation.” A deterministic fitted mean omits predictive uncertainty. Multiple imputation requires plausible variation across completed data sets.
  • “Copying the draw back is optional.” Giving different members of one cluster different imputed values violates the level-2 definition.
  • “A normal model is fine for every variable.” Model form must reflect the support and type of the cluster-level variable.
Key takeaway: Build the imputation model at the level where the missing variable exists. For a missing level-2 value, use one record per cluster, include defensible cluster-level predictors and summaries, draw one value per cluster, and copy that value consistently to all its members.

Check Your Understanding

Answer each question, then compare with the brief solutions.

  1. A clinic-level variable is missing for one clinic with 12 patients. How many values should be drawn for that clinic in one completed data set, and how many distinct values should appear on its 12 patient rows?
  2. Two clusters have observed values 2 and 8. What is their equally cluster-weighted mean? If their sizes are 1 and 3, what is the person-weighted mean after duplication?
  3. Name two assumptions or checks needed before using a cluster mean to impute a cluster-level variable.
  4. Why is replacing every missing value by the conditional fitted mean generally inadequate for multiple imputation?

Solutions. (1) Draw one value; that same value appears on all 12 rows. (2) The cluster-weighted mean is \((2+8)/2=5\). The duplicated person-weighted mean is \((1(2)+3(8))/(1+3)=26/4=6.5\). (3) For example, check that the summary is calculated consistently and is informative for the conditional model; assess whether it is noisy, whether missing clusters overlap observed clusters on predictors, and whether the missingness is plausibly explained by observed information. (4) A fitted mean does not include predictive variation, so imputations fail to represent uncertainty about missing values and can make completed data sets too similar.

Clinical Biostats