Tutorials › Multiple Imputation by Chained Equations (MICE) › Decomposing Level-1 Predictors

Nested and Multilevel Data · Tutorial 341 of 497

Decomposing Level-1 Predictors

Construct and interpret within-cluster and between-cluster predictor terms, and understand why both are needed in multilevel imputation models.

Advanced 12 min read

What You'll Learn

  • Calculate a level-1 predictor’s cluster mean and within-cluster deviation.
  • Specify a model with separate within- and between-cluster coefficients.
  • Interpret the coefficients and their difference in context.
  • See why using the raw predictor alone can impose an unwanted restriction.
  • Check decomposition terms and identify common coding and interpretation errors.

Why Decompose a Level-1 Predictor?

A level-1 predictor varies across individuals within a cluster and may also vary between clusters. Those two sources of variation need not have the same association with an outcome. For example, an individual whose measured exposure is high relative to others in the same clinic may differ from an individual in a clinic with a high average exposure. Treating both comparisons as one association can obscure that distinction.

In multilevel imputation, this matters when a level-1 variable is used to predict another variable. Including a within-cluster term and a between-cluster term allows the imputation model to represent the two associations separately. The decomposition is an algebraic construction; it does not, by itself, account for clustering or guarantee that an imputation model is well specified.

Definition: Let \(x_{ij}\) denote a level-1 predictor for individual \(i\) in cluster \(j\), and let \(n_j\) be the number of individuals in that cluster with a value of \(x\). Its cluster mean is \(\bar{x}_{.j} = \frac{1}{n_j}\sum_i x_{ij}\). The within-cluster deviation is \(x_{W,ij}=x_{ij}-\bar{x}_{.j}\), and the between-cluster term is \(x_{B,j}=\bar{x}_{.j}\). Thus, \(x_{ij}=x_{W,ij}+x_{B,j}\).

The deviation \(x_{W,ij}\) describes how far an individual’s value is above or below their own cluster mean, in the original units of \(x\). The cluster mean \(x_{B,j}\) describes the cluster’s average level of the predictor. Within each cluster, the deviations sum to zero when the same individuals are used to compute the mean:

$$ \sum_i x_{W,ij} = \sum_i (x_{ij}-\bar{x}_{.j}) = \sum_i x_{ij}-n_j\bar{x}_{.j} = 0. $$

This identity is a useful coding check. It also makes clear that a deviation is not an individual’s raw value: it is a comparison with the individual’s own cluster.

Separate Associations in a Multilevel Model

A common linear specification for an outcome \(y_{ij}\) is

$$ y_{ij} = \beta_0 + \beta_W(x_{ij}-\bar{x}_{.j}) + \beta_B\bar{x}_{.j} + u_j + \epsilon_{ij}. $$

Here \(\beta_W\) is the within-cluster association: it describes the expected outcome difference associated with a one-unit difference in \(x\) between two individuals in the same cluster, holding the cluster mean fixed. The coefficient \(\beta_B\) is the between-cluster association: it describes the expected outcome difference associated with a one-unit difference in cluster means, comparing clusters at the same within-cluster deviation. These are model-based associations, not automatically causal effects.

In a random-intercept model, \(u_j\) represents cluster-specific variation in the outcome intercept, and \(\epsilon_{ij}\) represents individual-level residual variation. A usual Gaussian version assumes \(u_j\) has mean zero and variance \(\tau^2\), \(\epsilon_{ij}\) has mean zero and variance \(\sigma^2\), and the two are independent, with residuals independent across individuals conditional on the random intercept and predictors. The decomposition itself does not require normality; those distributional assumptions are relevant to this particular Gaussian model and imputation specification.

The earlier material on Within-Between Decomposition and Deriving The Contextual Effect established the interpretation of the coefficient difference. In this parameterization, the contextual association is \(\beta_B-\beta_W\): it compares clusters with different means while holding an individual’s raw \(x\) value fixed. The difference is meaningful only with the model and comparison stated; it is not a third independent predictor coefficient.

Worked Example: Calculating Within and Between Terms

Suppose a hypothetical study records an exposure \(x\), in units per week, for three people in each of two clinics. Clinic A has values 2, 4, and 6; Clinic B has values 8, 10, and 12. Compute the terms for the individual with \(x=6\) in Clinic A and the individual with \(x=8\) in Clinic B.

For Clinic A, the mean is \(\bar{x}_{.A}=(2+4+6)/3=4\). The person with \(x=6\) therefore has \(x_W=6-4=2\) and \(x_B=4\). Their raw value is recovered as \(2+4=6\).

For Clinic B, the mean is \(\bar{x}_{.B}=(8+10+12)/3=10\). The person with \(x=8\) has \(x_W=8-10=-2\) and \(x_B=10\), giving \(-2+10=8\). Although this person’s raw exposure is higher than the Clinic A person’s, their within-cluster deviation is lower: they are below their clinic’s mean, whereas the Clinic A person is above theirs.

For a check, Clinic A’s three deviations are \(-2,0,2\), which sum to zero; Clinic B’s are \(-2,0,2\), which also sum to zero. The decomposition has separated position within a clinic from the clinic’s average exposure.

Why the Raw Predictor Alone Can Be Restrictive

Because \(x_{ij}=x_{W,ij}+x_{B,j}\), a model using only the raw predictor,

$$ y_{ij}=\beta_0+\beta x_{ij}+u_j+\epsilon_{ij}, $$

is equivalent to a decomposed model in which the within- and between-cluster coefficients are constrained to be equal. Substitution gives:

$$ \beta x_{ij} = \beta x_{W,ij}+\beta x_{B,j}. $$

Thus, a raw-\(x\) model imposes \(\beta_W=\beta_B=\beta\). That equality may be suitable if it is substantively justified, but it is not guaranteed by the data structure. Including both terms removes this equality constraint. The random intercept still has a separate role: it represents residual cluster-level outcome variation, not the between-cluster association in \(x\).

Worked Example: Interpreting Separate Coefficients

In a hypothetical model for a health score measured in points, suppose the fitted within-cluster coefficient is \(\beta_W=1.2\) points per weekly exposure unit and the between-cluster coefficient is \(\beta_B=2.0\) points per weekly exposure unit. The model includes both \(x_W\) and \(x_B\).

For two people in the same clinic, the cluster mean is shared. A one-unit difference in their exposure is therefore also a one-unit difference in \(x_W\), so the model associates that contrast with \(1.2\) additional health-score points on average, conditional on the other model terms.

For a between-cluster comparison at the same within-cluster deviation, a one-unit difference in the clinic mean corresponds to a one-unit difference in \(x_B\). The model associates it with \(2.0\) additional points on average. The contextual association is \(2.0-1.2=0.8\) points per weekly exposure unit. This is a contrast between the two modeled associations, not evidence that changing a clinic’s mean exposure would cause a score change.

A model using raw exposure alone would require both associations to equal one common coefficient. Since the specified estimates differ, that restriction would not represent the fitted model above.

Using the Terms in Multilevel Imputation

Suppose \(y\) is a level-1 variable to be imputed and \(x\) is a level-1 predictor. A conditional imputation model can include \(x_W\) and \(x_B\) as distinct predictors, along with other relevant variables and an appropriate representation of cluster dependence. For a continuous \(y\), one possible model is:

$$ y_{ij}\mid u_j,x_{W,ij},x_{B,j} \sim N\!\left( \beta_0+\beta_W x_{W,ij}+\beta_B x_{B,j}+u_j,\, \sigma^2 \right), \qquad u_j\sim N(0,\tau^2). $$

This model states the conditional distribution used for the illustration: the conditional mean is linear in the two predictor terms, residual variance is \(\sigma^2\), and cluster intercepts have a normal distribution with variance \(\tau^2\). The terms preserve the model’s distinct within- and between-cluster associations. Merely adding a cluster mean to a single-level imputation model would not, on its own, represent residual dependence among people in the same cluster.

In a MICE implementation, the decomposition should correspond to the data used in each completed data set. If \(x\) has missing values, its cluster means and deviations depend on the completed values; treating terms computed once from incomplete data as fixed can make the predictor columns inconsistent. Handling that missing-predictor situation requires additional care and is distinct from the basic construction shown here. The deterministic-identity principles from Passive Imputation apply when derived terms must be kept synchronized with their source variable.

Worked Example: Constructing Imputation Predictors

Consider hypothetical exposure data in two clinics: Clinic A has \(x=2,4,6\), with mean 4, and Clinic B has \(x=8,10,12\), with mean 10. Suppose a continuous outcome \(y\), measured in score points, is the target of an imputation model. For the person with \(x=6\) in Clinic A, the predictor row contains \(x_W=2\) and \(x_B=4\). For the person with \(x=8\) in Clinic B, it contains \(x_W=-2\) and \(x_B=10\).

For an arithmetic illustration, take \(\beta_0=50\), \(\beta_W=1.2\), \(\beta_B=2.0\), and a cluster intercept \(u_j=0\) for both people. The conditional means are:

$$ \begin{aligned} \widehat{y}_{A,x=6} &=50+(1.2)(2)+(2.0)(4)=60.4\text{ points},\\ \widehat{y}_{B,x=8} &=50+(1.2)(-2)+(2.0)(10)=67.6\text{ points}. \end{aligned} $$

These are fitted conditional means, not observed outcomes or completed imputed draws. The first person is above their clinic mean, while the second is below theirs; their cluster means differ as well. The model can represent both facts because the two columns enter with separate coefficients. A stochastic imputation would also draw residual and, as appropriate, model-parameter uncertainty rather than assigning every missing outcome its fitted mean.

Construction Checks, Alternatives, and Limitations

Before using the terms, verify that cluster membership is correct, that the mean is calculated over the intended individuals, and that the deviation is formed by subtracting that same cluster mean from each person’s \(x\). A simple numerical check is \(x_W+x_B=x\) for every row. Also check that within-cluster deviations sum to approximately zero, allowing for rounding.

Common warning signs include a deviation that does not sum to zero within clusters, a cluster mean that changes across rows within the same cluster, or a supposed within-cluster term that was centered around the overall sample mean instead. Grand-mean centering is a different transformation: it shifts the reference point but does not by itself isolate within-cluster variation. For a within-between decomposition, the centering reference for \(x_W\) must be the individual’s own cluster mean.

The main alternatives have different implications:

SpecificationWhat it representsMain caution
Raw \(x_{ij}\) aloneA common association across within- and between-cluster variationConstrains the two associations to be equal
Within-cluster deviation \(x_W\) aloneAssociation with individual differences relative to cluster meansDoes not model the association with cluster means
Cluster mean \(x_B\) aloneAssociation with differences between cluster averagesDoes not model individual deviations within clusters
Both \(x_W\) and \(x_B\)Allows distinct within- and between-cluster associationsStill requires an appropriate dependence structure and defensible model form

The decomposition is most directly useful when \(x\) varies within clusters and cluster means can be meaningfully defined. If a cluster has no variation in \(x\), its within-cluster deviations are all zero; that cluster provides no within-cluster contrast. Estimates may also be unstable when there are few clusters or little between-cluster variation. A mean calculated from a small cluster is an imprecise summary of its underlying cluster level; the decomposition does not remove that sampling uncertainty.

Finally, including both terms does not solve every modeling problem. The association may be nonlinear, vary across clusters, or interact with other predictors. The mean may be affected by missing values or the way cluster membership is observed. The imputation model must still reflect the target variables, dependence, and relevant structure. Decomposition clarifies which variation is represented; it does not certify that the complete imputation model is adequate.

Key takeaway: For a level-1 predictor, use \(x_W=x_{ij}-\bar{x}_{.j}\) to represent individual deviations from cluster means and \(x_B=\bar{x}_{.j}\) to represent cluster averages. Including both terms allows the within- and between-cluster associations to differ; using raw \(x\) alone equates them.

Check Your Understanding

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

  1. A cluster has predictor values 3, 5, and 7. Find the mean and the within-cluster deviation for the person with value 3.
  2. In a model with \(\beta_W=0.6\) and \(\beta_B=1.1\), what is the contextual association, and what does it compare?
  3. What equality is imposed by using raw \(x\) alone in place of \(x_W\) and \(x_B\)?
  4. Name two checks that can reveal an incorrectly constructed decomposition.

Solutions. (1) The mean is \((3+5+7)/3=5\), and the deviation is \(3-5=-2\). (2) The contextual association is \(1.1-0.6=0.5\) outcome units per predictor unit; it is the between-cluster coefficient minus the within-cluster coefficient. (3) Raw \(x=x_W+x_B\), so one coefficient on raw \(x\) imposes \(\beta_W=\beta_B\). (4) Check that \(x_W+x_B=x\) for each row and that deviations sum to zero within each cluster; also verify that \(x_B\) is constant within each cluster.

Clinical Biostats