Tutorials › Multiple Imputation by Chained Equations (MICE) › Imputing Cross-Level Interactions

Nested and Multilevel Data · Tutorial 353 of 497

Imputing Cross-Level Interactions

You will learn to preserve cross-level interactions in multilevel chained equations and diagnose the consequences of leaving them out.

Advanced 12 min read

What You'll Learn

  • Express a cross-level interaction on the same predictor scale used in the analysis model.
  • Distinguish imputing an interaction term from recomputing a deterministic product after imputing its components.
  • Derive how a level-2 characteristic can change the conditional distribution used to impute a missing level-1 predictor.
  • Calculate how an additive model can misrepresent group-specific slopes.
  • Identify model, data-support, and implementation problems that can undermine interaction-preserving imputations.

Why a Cross-Level Interaction Must Survive Imputation

A level-1 predictor varies among individuals within a cluster; a level-2 characteristic is shared by members of the same cluster. A cross-level interaction means that the association between the level-1 predictor and an outcome can differ according to the level-2 characteristic. If the analysis asks whether that association varies, imputation must retain the information needed to estimate the variation. An additive imputation model can erase it before the analysis begins.

Let \(i\) index individuals and \(j\) index clusters. Write \(X_{ij}\) for the level-1 predictor and \(Z_j\) for the level-2 characteristic. On the scales and centering used in the substantive analysis, their product is \(X_{ij}Z_j\). The simple linear analysis model below makes the target explicit; it can be extended with other predictors and multilevel terms.

$$ Y_{ij}=\beta_0+\beta_1X_{ij}+\beta_2Z_j+\beta_3X_{ij}Z_j+u_{0j}+u_{1j}X_{ij}+\varepsilon_{ij}. $$

Here \(u_{0j}\) and \(u_{1j}\) represent cluster-specific intercept and slope deviations when these random effects are included, and \(\varepsilon_{ij}\) is the individual-level residual. In the fixed-effects part, the slope of \(Y\) with respect to \(X\), at a given \(Z_j\), is \(\beta_1+\beta_3Z_j\). Thus \(\beta_3\) describes how that slope changes for a one-unit increase in \(Z\). The product must use the same definition of \(X\) and \(Z\) as the analysis: changing centering or scaling changes coefficient interpretations and can change which terms the imputation models need.

Definition: A cross-level interaction is an interaction between predictors measured at different levels of a hierarchy. In this tutorial, it is represented by the product \(X_{ij}Z_j\). To preserve the interaction, the imputation procedure must retain the dependence represented by this product when imputing incomplete variables; it is not enough to fit an additive model and add the product only at analysis time.

Assumptions and Construction

The imputation model must represent the multilevel structure and the relationships needed by the substantive analysis. In practice, this requires assumptions that are relevant to the variables being imputed: the missingness mechanism is adequately handled by conditioning on observed data under the chosen missing-at-random assumption; the conditional models have suitable functional forms and distributions; and the observed data contain enough information to estimate the interaction. For a normally distributed continuous outcome, normal conditional models may be reasonable, but that assumption should be checked rather than adopted automatically. Cluster effects and the dependence among people in the same cluster also need suitable treatment.

A key construction rule is to distinguish the product from its components. If \(X_{ij}\) is incomplete, \(X_{ij}Z_j\) is incomplete because it depends on \(X_{ij}\). After each imputation of \(X_{ij}\), calculate the product from the current \(X_{ij}\) and \(Z_j\); do not impute the product as if it were an independent variable. If \(Y_{ij}\) is incomplete, its imputation model should include \(X_{ij}\), \(Z_j\), and \(X_{ij}Z_j\) when that interaction is part of the analysis model.

For an incomplete \(X_{ij}\), simply putting \(X_{ij}Z_j\) on the right-hand side of an equation that predicts \(X_{ij}\) is not a solution: that term contains the unknown being imputed. Instead, its conditional model must reflect how the observed variables relate to \(X_{ij}\) across levels of \(Z_j\). For example, when \(Y_{ij}\) is observed and informative about \(X_{ij}\), the conditional relationship may differ by \(Z_j\); a model containing \(Y_{ij}\), \(Z_j\), and \(Y_{ij}Z_j\) can express that difference. This is a useful representation, not a universal guarantee of compatibility with every substantive model. In some settings the exact conditional distribution is nonlinear or contains additional terms.

In chained equations, each incomplete variable has its own conditional imputation model. The interaction is preserved by specifying those models in relation to the substantive interaction, respecting the level at which each variable is measured, and updating the product whenever its components change. Each imputation should include appropriate random draws of model parameters and residual variation; inserting fitted conditional means alone does not represent imputation uncertainty.

Worked Example: Reading the Interaction as Group-Specific Slopes

Suppose a hypothetical continuous outcome follows \(Y_{ij}=10+2X_{ij}+3Z_j+4X_{ij}Z_j+\varepsilon_{ij}\), with \(Z_j\) equal to 0 or 1 and errors having mean zero. Treat the displayed fixed-effect model as correctly specified for this illustration.

When \(Z_j=0\), the product is zero and the conditional mean is \(10+2X_{ij}\). The slope with respect to \(X\) is 2 outcome units per one-unit increase in \(X\). When \(Z_j=1\), the conditional mean is \(10+2X_{ij}+3+4X_{ij}=13+6X_{ij}\), so the slope is 6 outcome units per one-unit increase in \(X\). The difference in slopes is \(6-2=4\), exactly \(\beta_3\).

At \(X=1\), the predicted means are 12 for \(Z=0\) and 19 for \(Z=1\). The level-2 difference is not a constant 3 across all \(X\): it is \(3+4X\), which equals 7 at \(X=1\). This calculation shows why an additive model cannot represent the specified relationship.

Why Imputing a Predictor Can Require More Than Its Product

When \(X_{ij}\) is missing, the observed outcome can inform its imputation. The following small derivation shows directly how the level-2 characteristic changes that conditional distribution. It uses deliberately simple assumptions so the calculation is transparent; it is not a general formula for every multilevel imputation model.

Assumptions for the derivation: For a fixed \(Z_j=z\), assume \(X_{ij}\sim N(0,1)\), and assume \(Y_{ij}\mid X_{ij},Z_j=z\sim N(a_z+b_zX_{ij},4)\). Take the errors and prior distribution as specified, with no additional cluster effects in this simplified illustration.

The normal prior for \(X\) contributes precision 1, and the normal likelihood contributes precision \(b_z^2/4\). Completing the square in the product of the prior and likelihood gives the conditional variance and mean shown here.

$$ \operatorname{Var}(X_{ij}\mid Y_{ij}=y,Z_j=z)=\frac{4}{4+b_z^2}, \qquad E(X_{ij}\mid Y_{ij}=y,Z_j=z)=\frac{b_z}{4+b_z^2}(y-a_z). $$

The derivation follows because the exponent in the conditional density, apart from a constant, is \(-x^2/2-(y-a_z-b_zx)^2/8\). Its quadratic coefficient in \(x\) is \(-(4+b_z^2)/8\), giving variance \(4/(4+b_z^2)\); its linear coefficient is \(b_z(y-a_z)/4\), giving the stated mean.

Worked Example: Updating a Missing Level-1 Predictor

Use the previous hypothetical outcome model with residual variance 4, together with the derivation's assumption \(X_{ij}\sim N(0,1)\) at either value of \(Z_j\). Thus, for \(Z=0\), \(a_0=10\) and \(b_0=2\); for \(Z=1\), \(a_1=13\) and \(b_1=6\). Consider an individual with missing \(X\) and observed outcome \(Y=14\) in a cluster with \(Z=0\).

The conditional mean is \(\frac{2}{4+2^2}(14-10)=\frac{2}{8}\times4=1\), and the conditional variance is \(\frac{4}{4+2^2}=\frac{4}{8}=0.5\). Under these assumptions, the conditional distribution used for this individual is \(N(1,0.5)\).

For comparison, if \(Y=19\) and \(Z=1\), the conditional mean is \(\frac{6}{4+6^2}(19-13)=\frac{6}{40}\times6=0.9\), and the conditional variance is \(\frac{4}{40}=0.1\). The different slope at \(Z=1\) changes both the update and its uncertainty. An imputation model that forces one common, additive relationship between \(Y\) and \(X\) would not generally reproduce these two conditional distributions.

Recompute the Product and Respect the Hierarchy

A deterministic interaction should be constructed from the current imputed components. Suppose \(X\) is on its analysis scale and \(Z\) is observed. If \(X\) is imputed as 1.05 for an individual with \(Z=1\), the product is \(1.05\times1=1.05\). If the product were instead independently imputed as 0.7, the completed record would contain values that contradict the definition of the interaction. When either component changes in a later chained-equations update, the product must be recalculated again.

Cluster membership matters as well. \(Z_j\) is shared by the individuals in cluster \(j\); it should not be treated as if each row supplied an independent level-2 observation. Imputation models should preserve the between-cluster and within-cluster structure relevant to the variables, and account for clustering using a suitable multilevel approach. If \(Z_j\) itself is incomplete, it must be imputed at the cluster level, using information appropriate to that level; the product can then be recomputed for its members. These principles do not specify one universally correct software implementation: the appropriate model depends on the variable types, missingness patterns, and substantive analysis.

Worked Example: Rebuilding an Interaction After an Imputation

Consider two hypothetical records with \(Z\) observed and \(X\) missing. Use the simplified conditional distributions derived above. For record A, \(Z=0\) and \(Y=14\), so the conditional distribution is \(N(1,0.5)\). For record B, \(Z=1\) and \(Y=19\), so it is \(N(0.9,0.1)\). Suppose one completed data set draws \(X=0.8\) for A and \(X=1.05\) for B. These are illustrative possible draws, not conditional means.

For A, the product is \(0.8\times0=0\). For B, it is \(1.05\times1=1.05\). If the imputation model for an incomplete outcome includes the interaction, these newly calculated product values enter that model along with the current component values. In the next update, if B's \(X\) changes to 0.7, its product must become \(0.7\times1=0.7\); retaining 1.05 would leave an internally inconsistent data set.

The example also illustrates why imputing only the product is not a substitute for imputing its components. The product is defined by \(X\) and \(Z\), so each completed record must respect that definition.

What an Additive Imputation Can Get Wrong

Omitting \(X_{ij}Z_j\) from an imputation model rules out the very slope variation that the analysis intends to estimate. It can smooth differences between groups, distort the conditional distributions used to fill missing values, and weaken or bias the estimated interaction. The exact direction and size of the resulting bias depend on the missingness pattern, predictor distributions, and imputation and analysis models; it is not always a simple attenuation toward zero.

Worked Example: Consequences of Leaving Out the Interaction

Suppose a hypothetical balanced set of observations has these outcome cell means under the model in the first example: for \(Z=0\), the means at \(X=0\) and \(X=1\) are 10 and 12; for \(Z=1\), they are 13 and 19. These means satisfy the stated model: the slopes are \(12-10=2\) and \(19-13=6\).

The interaction contrast is the difference between those slopes: \((19-13)-(12-10)=6-2=4\). Now fit an additive model with an intercept, \(X\), and \(Z\), but no product. In this balanced design, its common fitted slope is the average of the two group slopes: \((2+6)/2=4\). The average outcome within \(Z=0\) is \((10+12)/2=11\), and within \(Z=1\) it is \((13+19)/2=16\). The additive fitted values are therefore 9 and 13 for \(Z=0\), and 14 and 18 for \(Z=1\): the \(Z=0\) fitted mean at \(X=0\) is \(11-4(0.5)=9\), and the other fitted means follow by adding the common slope and group difference.

For the \(Z=1,X=1\) cell, the additive fit predicts 18 rather than the cell mean 19; for the \(Z=0,X=1\) cell, it predicts 13 rather than 12. In this balanced illustration the errors are one outcome unit in magnitude, with opposite signs. If the \(Z=1,X=1\) outcomes were missing and were imputed from the additive model, their conditional mean would be 18 rather than the model's value 19. The missing values would then provide less support for the true cross-level slope difference.

Diagnostics, Alternatives, and Limitations

No single diagnostic establishes that an interaction has been preserved. Examine whether the imputation specifications include the product where it belongs, whether products are recalculated after component updates, and whether the fitted conditional relationships differ across relevant levels of \(Z\). Compare observed and imputed distributions of \(X\) within clusters and across values of \(Z\); inspect cluster-level patterns and summaries; and check whether completed data reproduce the interaction-related patterns visible in the observed records. Convergence and trace diagnostics are also important for chained equations, but stable traces cannot rescue a misspecified additive conditional model.

A central data limitation is poor overlap: if nearly all observations at one value of \(Z\) have low \(X\), while another value of \(Z\) occurs only with high \(X\), the interaction is difficult to distinguish from other differences. Sparse clusters, few clusters, or extensive missingness can also make the interaction conditional models unstable. In those settings, report the weakness of the information and use sensitivity analyses rather than treating a complicated model specification as a guarantee of reliable imputations.

The main alternatives have different trade-offs. An additive imputation model is simpler but cannot represent the targeted slope variation. A passive product—recalculating \(XZ\) from its components—is necessary for a deterministic interaction, but by itself does not make the conditional imputation models compatible with the substantive model. Joint multilevel models can represent dependence through a joint distribution, while chained equations specify variable-specific conditionals; either approach still requires suitable structure, assumptions, and uncertainty propagation. A substantive-model-compatible imputation approach may be needed when the exact conditional model implied by the analysis is complex. The choice should be guided by the analysis target and the observed-data structure, not just by convenience.

Common mistake: “The analysis includes \(XZ\), so I can impute \(X\) and \(Y\) with additive models and create \(XZ\) afterward.” Recomputing the product prevents an inconsistent derived variable, but it cannot restore interaction information that the additive conditional models excluded. Include the interaction in the conditional models where appropriate, and ensure the model for an incomplete component reflects the substantive relationship without using that unknown component as a predictor of itself.
Key takeaway: Preserve a cross-level interaction by matching the imputation models to the substantive interaction, respecting the levels of measurement, and recomputing the product from the current imputed components. A correctly calculated product does not compensate for conditional models that assumed away the interaction.

Check Your Understanding

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

  1. In the fixed-effects model \(Y=5+2X+Z+3XZ\), what is the slope of \(Y\) with respect to \(X\) at \(Z=0\) and \(Z=2\)?
  2. If an individual has \(X=1.4\) and \(Z=2\), what is the interaction product? What must happen to the product if \(X\) is later imputed as 1.1?
  3. Why is it not appropriate to predict a missing \(X\) by putting \(XZ\) on the right-hand side of its own imputation equation?
  4. In the balanced example, what is the difference in group-specific slopes, and what common slope does the additive least-squares fit produce?

Solutions. (1) The slope is \(2+3Z\). At \(Z=0\), it is 2 outcome units per unit of \(X\); at \(Z=2\), it is \(2+3(2)=8\). (2) The product is \(1.4\times2=2.8\). After \(X\) changes to 1.1, recompute it as \(1.1\times2=2.2\). (3) The term \(XZ\) contains the unknown \(X\) being imputed, so it is not an available predictor unless the conditional model is formulated in another valid way. The model should instead represent how observed information, such as \(Y\) and \(Z\), relates to \(X\). (4) The group-specific slopes are 2 and 6, so their difference is \(6-2=4\); in the balanced design, the additive least-squares common slope is their average, \((2+6)/2=4\).

Clinical Biostats