Tutorials › Multiple Imputation by Chained Equations (MICE) › Mapping the Analysis Formula to Imputation Models

Imputation-Model Compatibility With the Analysis Model · Tutorial 260 of 497

Mapping the Analysis Formula to Imputation Models

You will learn to audit an analysis formula and map its terms to appropriate imputation targets, predictors, and derived-variable handling.

Advanced 12 min read

What You'll Learn

  • Distinguish variables in an analysis formula from the terms used to represent them.
  • Build a target-by-target imputation plan from a specified analysis formula.
  • Map quadratic transformations and categorical predictors without imputing deterministic terms independently.
  • Identify when the analysis formula alone does not determine a compatible set of conditional imputation models.
  • Diagnose formula-mapping errors before fitting the analysis model.

From an Analysis Formula to an Imputation Plan

An analysis formula specifies the relationships used to estimate the scientific quantity of interest. In MICE, however, missing values are filled in one variable at a time, using a separate conditional model for each variable that has missing values. The formula for the analysis therefore cannot simply be copied unchanged into every imputation equation. It must first be translated into a plan: which variables are analysis variables, which terms represent them, and how should those terms be handled when each variable is the imputation target?

This translation is a design and model-specification task, not a guarantee that the resulting conditional models are mutually compatible. Compatibility depends on the full conditional distributions, not only on whether the same variable names appear. The earlier material on compatibility and congeniality establishes that distinction. Here the goal is narrower: make the analysis formula visible in the imputation specification, and avoid dropping or mishandling its structure.

Definition: An analysis formula is a compact specification of the outcome and the predictors and terms used in the substantive model. An imputation model for a target variable is a conditional model used to draw values for that variable when they are missing. Mapping the formula means auditing the analysis variables and terms and deciding how each is represented in the relevant target-specific imputation models.

The mapping begins with the analysis formula as written, not with a default MICE predictor list. Record the outcome, each predictor, any categorical coding, and any transformation or derived term. Then, for every variable with missing values, identify its target-specific imputation model and check that the model can represent the required relationships among the analysis variables. The precise conditional family must suit the target: for example, a continuous target and a binary target do not use the same response distribution.

A Practical Mapping Procedure

1
Write the analysis model in full.
List the outcome, predictors, units, categories, transformations, and reference levels. Do not treat a transformed term as a new measured variable unless it is actually recorded as one.
2
Make a term inventory.
For every term, record the variables it uses and the mathematical form, such as a linear term, a square, or a categorical contrast. This is the model-design information that must not disappear in translation.
3
Review each incomplete variable as a target.
Select a conditional model appropriate to its scale and support, then check whether the needed analysis variables and functional forms can be represented in that equation.
4
Handle derived terms consistently.
If a term is a deterministic function of an incomplete variable, compute it from that variable after each update. Do not independently impute two quantities that must obey a fixed mathematical identity.
5
Audit the implemented specification.
Compare the formula and the actual MICE equations. Check that transformations, categorical coding, target-specific model families, and the analysis formula used after imputation agree with the plan.

This procedure is a structured audit, not a recipe that uniquely determines every conditional model. A term’s presence in the analysis formula signals a relationship to preserve or assess; it does not prove that a simple linear conditional model will preserve it. Nor does it establish that the collection of chosen conditional models corresponds to a single joint distribution.

Worked Examples

Worked Example: A Linear Analysis Formula

Suppose a hypothetical study records a continuous test score \(Y\), in points, age \(X\), in years, and a binary program indicator \(Z\) (1 for enrolled and 0 otherwise). The specified analysis model is \(Y \sim X + Z\). For illustration, suppose the fitted coefficients are an intercept of 62 points, 0.30 points per year of age, and 4.0 points for program enrollment.

The analysis design has an intercept and two terms: \(X\) and \(Z\). For a participant aged 50 years and enrolled in the program, the fitted mean is

$$ \widehat{Y}=62+0.30(50)+4.0(1)=62+15+4=81.0\text{ points}. $$

The arithmetic shows exactly what the analysis formula means: age contributes through a linear term, and program status through a 0/1 contrast. If age is incomplete, its imputation target is continuous; the imputation plan must represent the analysis variables and relationships chosen for that target. If program status is incomplete, its target model must respect its binary support, rather than generating arbitrary continuous values and rounding them afterward. If the score is incomplete, its target model must be appropriate for a continuous outcome. The formula audit records these target-specific requirements; it does not, by itself, settle every predictor-inclusion decision.

A common mapping error would be to fit an age equation with no representation of program status, while retaining program status in the analysis formula. The correction is to review the age target equation against the analysis plan and include or otherwise represent relevant analysis variables according to the intended imputation specification. Whether a particular conditional specification is compatible still requires a separate assessment.

Worked Example: A Quadratic Term and Its Scale

Consider a hypothetical analysis of test score \(Y\), measured in points, using \(Y \sim X_c + I(X_c^2) + Z\), where \(X\) is age in years, \(Z\) is a binary indicator, and age is centered and scaled as \(X_c=(X-40)/10\). Thus one unit of \(X_c\) represents 10 years. Suppose the illustrative coefficients are 70 points for the intercept, 0.80 points for \(X_c\), \(-0.15\) points for \(X_c^2\), and 3.0 points for \(Z=1\).

For a 60-year-old participant with \(Z=1\), first compute the centered, scaled value and its square:

$$ X_c=\frac{60-40}{10}=2,\qquad X_c^2=2^2=4. $$

The fitted mean is then

$$ \widehat{Y}=70+0.80(2)-0.15(4)+3.0 =70+1.60-0.60+3.0=74.0\text{ points}. $$

The term inventory contains one measured age variable, represented by both \(X_c\) and its square in the analysis design. If age is missing, \(X_c\) and \(X_c^2\) are not two independently missing measurements: both are calculated from the same imputed age. After each age update, compute \(X_c=(X-40)/10\), then \(X_c^2\). If the score target model is intended to mirror the specified analysis mean structure, it must include both the linear and quadratic age terms. By contrast, an age-target equation cannot use a square calculated from an unknown age value as if it were independently observed. Its conditional form needs to be chosen with the required nonlinear relationship in mind; merely writing a linear regression for age does not ensure that the analysis curvature is preserved.

The scaling is part of the specification. Defining \(X_c=X-40\) instead would give \(X_c=20\) at age 60, not 2, and would change both the linear and squared terms. The formula, data transformation, imputation calculation, and analysis calculation must all use the same definition.

Worked Example: A Categorical Predictor With Reference Coding

Suppose a hypothetical analysis uses \(Y \sim \text{age}+\text{treatment}+\text{site}\), where age is measured in years, treatment is coded 1 for active treatment and 0 for comparison, and site has categories A, B, and C. Use site A as the reference category. The design has an age term, a treatment contrast, and two site indicators: one for B and one for C. Suppose illustrative coefficients are an intercept of 60 points, 0.20 points per year, 2.4 points for active treatment, \(-1.2\) points for site B, and 0.7 points for site C.

For a 55-year-old participant receiving active treatment at site B, the site B indicator is 1 and the site C indicator is 0. The fitted value is

$$ \widehat{Y}=60+0.20(55)+2.4-1.2+0.7(0) =60+11+2.4-1.2=72.2\text{ points}. $$

The term inventory prevents a common mistake: representing site as a numeric score such as A = 1, B = 2, C = 3, which would impose an unsupported linear ordering. If site has missing values, its target model must treat it as categorical; for three nominal categories, a multinomial model is one standard choice. A binary treatment target likewise requires a model respecting its two possible values. The formula’s reference coding must also be used consistently when fitting the analysis model after imputation.

Why the Mapping Is Not a Mechanical Copy

An analysis formula describes a conditional mean or other substantive parameterization, while an imputation equation describes a conditional distribution for a particular target. These are different objects. For example, the term \(X_c^2\) in a score model is a column of the analysis design matrix. It does not imply that an incomplete age and its square should be treated as separate targets. Likewise, selecting a model family for a target requires knowing that target’s type and support, not just copying the outcome family from the analysis.

A short algebraic check clarifies the distinction. Let the analysis design vector for a record be \(d=(1,X_c,X_c^2,Z)\). Its quadratic contribution is determined by one value \(X_c\): once \(X_c\) is known, the square is fixed. If the imputed value is \(X_c=2\), then \(X_c^2=4\); a separately imputed square of 5 would violate the definition of the design vector. Therefore, whenever a derived term is represented as a stored column, it must be regenerated from its source variable after that variable changes.

This is the logic of passive imputation: a derived variable is recalculated deterministically from its source variables rather than sampled as an independent target. Alternatively, a software formula can calculate the transformation when needed, without storing a separate column. Either approach is acceptable only if the transformed value used in each analysis and conditional model corresponds to the same source data and definition.

The analysis formula also does not uniquely determine all imputation equations. A linear analysis term does not automatically imply that every target’s conditional distribution should be linear, and exact compatibility is not established merely by including the same named predictors. Choosing conditional model forms, checking their joint behavior, and evaluating substantive-model compatibility remain necessary tasks.

Diagnostics, Alternatives, and Limitations

A formula-mapping audit is most useful before fitting MICE and when reviewing the resulting completed data. Check the model matrix actually passed to the analysis: are the intended terms present, is the centering constant and scale correct, and are factor reference levels unchanged? Check target equations for appropriate variable types and for the functional forms identified by the term inventory. If a derived column is stored, verify after updates that its values equal the corresponding transformation exactly.

Distributional diagnostics remain relevant but answer different questions. Trace behavior and comparisons of observed and imputed distributions can reveal instability or implausible imputations; masked-value diagnostics can assess predictive performance in observed cases. These checks do not prove that the analysis terms were mapped correctly. Conversely, a formula audit does not establish convergence, calibration, or accurate prediction. Use both kinds of assessment.

The principal alternatives address different modeling choices:

  • Passive calculation of derived terms preserves exact identities such as \(X_c^2\) being the square of \(X_c\). It does not by itself ensure that the conditional models are compatible with the substantive model.
  • Directly modeling a transformed target may be appropriate when the transformed quantity, rather than its source, is the actual analysis variable. It is not a justification for independently imputing a deterministic transformation alongside its source.
  • A simpler default conditional model is easier to fit, but can omit important terms from the analysis specification. Simplicity is not a reason to silently change the substantive model.
  • Substantive-model-compatible imputation explicitly targets preservation of the analysis model’s structure. It can be useful when ordinary fully conditional specifications do not adequately represent that structure, but requires additional modeling choices and assumptions.

Limitations should be explicit. Some analysis formulas contain complex transformations, sparse categories, or terms that are difficult to represent in ordinary conditional models. Small samples can make target-specific models unstable, especially when the number of categories is large. A carefully mapped set of equations can still be misspecified, and no formula checklist repairs an unsuitable substantive model or an inadequate set of observed predictors. The mapping is a necessary specification step, not a certificate of validity.

Common Mistakes

  • Copying the analysis formula into every imputation equation. The analysis and target models have different outcomes and roles. Construct an equation for each incomplete target, using a family suitable for that target.
  • Dropping a transformation during imputation. If the analysis uses curvature, a model that represents only a linear term may fail to preserve the planned structure. Record transformations explicitly and decide how each is handled for each target.
  • Imputing a source and its deterministic transform independently. This can produce impossible combinations, such as \(X_c=2\) and \(X_c^2=5\). Recalculate the transform from the imputed source value.
  • Using numeric codes for nominal categories as though they were measurements. A code is not automatically a quantitative predictor. State the reference category or other intended contrast coding.
  • Assuming matching variable names proves compatibility. The distributional form and dependencies in the conditional models matter, not just the predictor list.
Key takeaway: Translate the analysis formula into a term inventory, then audit each incomplete variable’s target model against that inventory. Preserve variable type, transformations, coding, and deterministic identities, while recognizing that formula mapping alone does not establish compatibility or adequate imputation.

Check Your Understanding

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

  1. An analysis uses \(Y \sim X + I(X^2)\). If \(X\) is incomplete, should \(X^2\) be imputed independently? What should happen instead?
  2. A variable has categories A, B, and C with no natural order. Why is coding them 1, 2, and 3 and using a linear numeric term generally not equivalent to categorical coding?
  3. Age is centered and scaled as \(X_c=(X-50)/5\). Calculate \(X_c\) and \(X_c^2\) for age 60 years.
  4. Does including every analysis predictor by name in each imputation equation prove that the imputation models are compatible? Explain briefly.
  5. A binary variable is incomplete. What feature must its target model respect, and why is rounding a continuous imputation afterward not an adequate general solution?

Solutions. (1) No. Impute the source \(X\), then calculate \(X^2\) from each updated value so the identity holds exactly. (2) Numeric coding imposes a particular numerical ordering and spacing; categorical contrasts represent group differences without asserting that those differences follow a linear scale. (3) \(X_c=(60-50)/5=2\), so \(X_c^2=2^2=4\). (4) No. Compatibility depends on the conditional distributions and their functional forms, not only on matching variable names. (5) The target model must generate only the two allowed categories. Rounding a continuous draw can distort probabilities and does not generally correspond to a well-specified binary conditional model.

Clinical Biostats