Why a Categorical Interaction Changes Imputation
A regression interaction between a categorical predictor and a continuous predictor allows the relationship between the continuous predictor and the outcome to differ across categories. If a predictor in that model is incomplete, an imputation model that treats the relationship as identical across categories can weaken or distort the interaction the analysis is intended to estimate. The key task is to represent category-specific relationships coherently in the conditional models used by MICE.
Consider a continuous outcome \(Y\), a categorical predictor \(C\) with levels A, B, and C, and a continuous predictor \(Z\). With A as the reference category, let \(D_B\) and \(D_C\) be indicator variables for levels B and C. A linear analysis model with the interaction is:
This specification gives a separate intercept and slope for each category. It is not merely an additive model with a category adjustment: the interaction coefficients allow the slope for \(Z\) to vary by category. Imputation must preserve the relevant structure when the incomplete variable is \(C\), \(Z\), or both.
Reading the Interaction Model
The interpretation is clearest by substituting the indicator values for each category. For A, both indicators are zero, so the expected outcome is \(\beta_0+\beta_ZZ\). For B, \(D_B=1\) and \(D_C=0\), giving intercept \(\beta_0+\beta_B\) and slope \(\beta_Z+\beta_{BZ}\). For C, the corresponding intercept and slope are \(\beta_0+\beta_C\) and \(\beta_Z+\beta_{CZ}\).
This substitution also gives a short justification for why an additive-only imputation can be inadequate. If the conditional relationship needed to predict an incomplete variable differs across categories, a model that imposes one common relationship cannot represent all the category-specific patterns. As a result, imputed values may pull the groups toward a common slope or otherwise change the interaction estimate.
Worked Example: Interpreting the Category-Specific Slopes
Suppose a hypothetical analysis uses the model above, with coefficients \(\beta_0=10\), \(\beta_B=2\), \(\beta_C=-1\), \(\beta_Z=0.5\), \(\beta_{BZ}=0.4\), and \(\beta_{CZ}=-0.2\). The outcome is measured in points and \(Z\) in hours.
For category A, the fitted mean is \(10+0.5Z\), so its slope is \(0.5\) points per hour. For B, the intercept is \(10+2=12\), and its slope is \(0.5+0.4=0.9\) points per hour. For C, the intercept is \(10-1=9\), and its slope is \(0.5-0.2=0.3\) points per hour.
At \(Z=4\) hours, the fitted means are \(10+0.5(4)=12\) points for A, \(12+0.9(4)=15.6\) points for B, and \(9+0.3(4)=10.2\) points for C. These calculations show what the interaction represents: the fitted change per additional hour is not the same for all categories. The coefficients are hypothetical, and this interpretation is associational rather than causal.
Imputing an Incomplete Continuous Predictor
When \(Z\) is incomplete, its conditional imputation model should use the outcome and the categorical predictor, and it should allow the relationship used to predict \(Z\) to vary by category when that is needed to preserve the analysis relationship. A practical model can include category indicators and their interactions with \(Y\). For example, a normal linear conditional model could specify a separate intercept and \(Y\)-slope for each category. The precise conditional model depends on the joint distribution and the analysis; simply adding \(Y\) and \(C\) as additive terms may impose an overly restrictive common relationship.
This is a model-specification requirement, not a claim that a single formula is correct under every data-generating process. The imputation model must also be plausible for the observed data, include relevant predictors of missingness and values, and generate proper imputations that reflect uncertainty in both parameters and missing values. As in other MICE settings, the usual missing-at-random assumption is that, conditional on variables included in the imputation procedure, missingness does not further depend on the unobserved value. That assumption cannot be verified from observed data alone.
Worked Example: A Category-Specific Conditional Mean for an Incomplete Predictor
Suppose \(Z\), measured in hours, is missing for one hypothetical participant. The participant is in category B and has \(Y=16\) points. For illustration, assume the fitted conditional imputation model for \(Z\) has a B-specific mean of \(-2+0.30Y\) hours. The model parameters are treated as given here; an actual MICE procedure would also draw or otherwise account for parameter uncertainty.
For this participant, the conditional mean is:
Thus 2.8 hours is the model-based conditional mean, not the imputed value itself. A stochastic imputation adds a draw from the fitted predictive distribution, including residual variation and parameter uncertainty. For example, if a hypothetical draw from that distribution were 3.1 hours, the completed row would use \(Z=3.1\), not the mean 2.8. The B-specific conditional relationship matters because a single common \(Y\)-slope could yield different predictions and could fail to preserve the intended group pattern.
Imputing an Incomplete Categorical Predictor
When \(C\) is incomplete, use a categorical conditional model appropriate to its number and ordering of levels. For an unordered factor, this is commonly a multinomial logistic model. Include \(Y\), \(Z\), and relevant auxiliary variables as predictors: omitting the outcome can attenuate associations between the incomplete predictor and the outcome. The model should be sufficiently flexible to represent important patterns in the probability of category membership, rather than assuming that a simple additive predictor is automatically compatible with the analysis model.
There is an important distinction between the analysis product \(D_BZ\) and predictors in the conditional model for \(C\). Since \(D_B\) is the response being imputed, its product with \(Z\) is not an observed predictor that can simply be inserted into that model. Instead, the conditional model predicts category probabilities from observed variables such as \(Y\) and \(Z\). When exact compatibility is a concern, a routine multinomial model with only linear additive predictors may be insufficient; assess whether its form can reproduce the relationships represented by the analysis model. This tutorial focuses on the categorical-by-continuous interaction structure, not a general derivation of every conditional distribution.
Worked Example: Imputing a Missing Category With Multinomial Probabilities
Suppose a hypothetical multinomial model for a participant with \(Y=14\) points and \(Z=3\) hours gives linear predictors \(\eta_A=0\), \(\eta_B=0.4\), and \(\eta_C=-0.2\). These values summarize the fitted predictor contributions for this illustration. The category probabilities are calculated by the softmax formula:
The unnormalized weights are \(\exp(0)=1.000\), \(\exp(0.4)=1.492\), and \(\exp(-0.2)=0.8187\). Their sum is \(1.000+1.492+0.8187=3.311\). Therefore the probabilities are \(1.000/3.311=0.302\) for A, \(1.492/3.311=0.451\) for B, and \(0.8187/3.311=0.247\) for C, to three significant figures. They sum to approximately 1.000.
A stochastic categorical imputation draws one category from these probabilities; it does not automatically assign the most probable category B. The probabilities here are only as credible as the fitted conditional model. In practice, inspect whether its predictors and functional form preserve the relationships needed by the analysis, and use methods appropriate to the factor’s structure.
Keeping Product Terms Consistent
An interaction variable is a deterministic function of its components, not an independent measurement. If \(Z\) is imputed, then \(D_BZ\) and \(D_CZ\) must be recomputed from the completed \(Z\) and the category indicators. If \(C\) is imputed, recompute the indicators and products after assigning its category. Never independently impute the interaction products as if they were unrelated variables: this can create impossible rows, such as \(D_B=0\) but a nonzero value for \(D_BZ\).
In chained equations, this consistency is usually handled by passive imputation or an equivalent deterministic update. The conditional model for an incomplete component can use the analysis-relevant information, while the product is recalculated whenever its components change. The completed data sets are then analyzed using the stated regression interaction. Any pooling across imputations must retain uncertainty between completed data sets; treating one completed data set as if it were complete observed data understates uncertainty.
Specify the categorical indicators and each indicator-by-continuous-predictor product that defines the target interaction.
For each incomplete component, include relevant outcomes, predictors, and category-specific structure; use a conditional model suited to the variable type.
After imputing a component, recalculate its indicators or products deterministically rather than imputing those derived quantities independently.
Compare observed and imputed distributions and inspect whether the category-specific predictor-outcome patterns remain plausible.
Alternatives, Diagnostics, and Limitations
A pooled conditional model with explicit interactions can share information across categories while allowing slopes or predictor effects to differ. Separate models fitted within each category offer more direct flexibility, but can be unstable when some categories have few observed values or few observed outcomes. A pooled additive model is simpler, but it imposes common effects and may erase the feature the analysis is designed to estimate. The choice is therefore a trade-off between adequate structure and reliable estimation, not a rule that the most elaborate model is always best.
Diagnostics should be tied to the intended interaction. Compare observed and imputed values of \(Z\) within each category, including ranges and distributional shape. For an incomplete \(C\), compare imputed category proportions across relevant ranges of \(Y\) and \(Z\). In each completed data set, check that product terms agree exactly with their components and that fitted category-specific slopes are not being driven by a few extreme imputations. Also monitor convergence of the chained equations and look for implausible values, empty or nearly empty cells, and unstable estimates across imputations.
These checks can reveal model failures but do not prove that the imputation assumptions hold. If a category has very few observed cases, its conditional model may be weakly identified; if the missingness mechanism is not plausibly missing at random, ordinary MICE cannot resolve that concern by itself. Sensitivity analysis may be needed. The relevant distinction between compatibility and congeniality is useful here: preserving the analysis model’s interaction structure is necessary for a defensible imputation, but does not by itself guarantee that the imputation and analysis models make mutually adequate assumptions.
Common Mistakes
- Using only additive terms. The reasoning “the imputation model includes both variables, so it respects their interaction” is not sufficient. A model with only additive terms can impose common relationships where the analysis allows category-specific ones. Include or otherwise accommodate the relevant category-specific structure.
- Imputing products independently. This can produce values inconsistent with the category and continuous predictor. Recompute every derived indicator and product from the completed components.
- Choosing the most likely category every time. This ignores uncertainty in category membership. Draw from the estimated category probabilities for stochastic imputation.
- Assuming a flexible model fixes sparse data. More terms may be difficult to estimate when categories are rare. Check cell sizes and stability, and consider a better-supported modeling strategy rather than relying on unstable estimates.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- With A as reference, write the fitted slope for \(Z\) in category B when the model contains \(Z\) and \(D_BZ\).
- If \(Z\) is imputed, should \(D_BZ\) be imputed independently or recalculated? Explain.
- Why can assigning every missing category to the category with the largest predicted probability be problematic?
- Name two checks that specifically assess whether the categorical interaction is preserved in the completed data.
Solutions. (1) The slope is \(\beta_Z+\beta_{BZ}\), because \(D_B=1\) in category B. (2) Recalculate it as \(D_B\) times the imputed \(Z\); it is deterministic from the components. (3) It discards uncertainty in category membership and can understate imputation variability. (4) Compare imputed and observed \(Z\) distributions within categories, and inspect category-specific fitted slopes or the distribution of \(Y\) and \(Z\) by category across completed data sets.