Tutorials › Multiple Imputation by Chained Equations (MICE) › Nonlinear Terms in the Analysis Model

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

Nonlinear Terms in the Analysis Model

You will learn to map nonlinear analysis terms into imputation-model requirements, check the consequences of simplifying them, and distinguish retaining a relationship from mechanically copying a formula.

Advanced 12 min read

What You'll Learn

  • Identify squared, transformed, and spline-basis terms in an analysis model.
  • Explain why a linear-only imputation model can weaken a nonlinear analysis relationship.
  • Distinguish imputing a variable from calculating its derived terms.
  • Check whether an imputation specification preserves the needed functional form and support.
  • Compare passive calculation with directly modeling nonlinear terms.
  • Diagnose common warning signs of lost nonlinear structure.

Why Nonlinear Terms Matter for Imputation

An analysis model may describe an outcome using more than the raw value of a predictor. It might include the predictor squared, its logarithm, or several basis functions that together represent a spline. These terms encode a particular shape: curvature, a transformed scale, or a slope that changes across ranges of the predictor. If the predictor has missing values, imputation must preserve enough of the relevant relationship to make that analysis meaningful.

The central issue is not simply whether the imputation model contains a variable with a similar name. The issue is whether it can reproduce the relevant association between the incomplete predictor, the outcome, and other predictors under the functional form used in the analysis. A model that treats a curved relationship as linear can fill in plausible-looking values while weakening the very curvature the analysis is intended to estimate.

Definition: A nonlinear analysis term is a modeled function of a predictor that is not restricted to a straight-line effect on the outcome. Examples include \(X^2\), \(\log(X)\), and spline basis functions of \(X\). To retain the nonlinear relationship during imputation means to specify the imputation process so that imputations do not systematically erase or distort the relationship represented by those terms.

This is a compatibility principle, not a requirement that every imputation equation be a verbatim copy of the final analysis equation. The imputation model must preserve the relevant conditional structure; the form needed to do so depends on which variable is incomplete and on the other variables in the model. As established in the earlier material on outcome inclusion, the outcome generally belongs among the predictors used to impute an incomplete analysis predictor. Here the additional question is whether the functional form is also represented.

Recognizing the Structure to Preserve

Start by reading the analysis model as a list of functions of variables, not just a list of variable names. If the outcome model contains \(X\) and \(X^2\), its mean can bend with \(X\). If it contains \(\log(X)\), the modeled change in the outcome is tied to a change on the log scale. If it contains spline basis functions, the relationship can change slope or curvature across the predictor's range. In each case, a model that includes only a linear \(X\) term imposes a different shape.

When a derived term is a deterministic function of an incomplete variable, its value is not independently missing once the variable is imputed. For example, after imputing \(X\), the corresponding \(X^2\) can be calculated exactly. This prevents inconsistent records such as an imputed \(X=3\) paired with \(X^2=8\). However, deterministic calculation alone does not guarantee that the imputed values of \(X\) preserve the analysis relationship. The imputation model that generates \(X\) still needs to reflect the relevant nonlinear structure.

The term's role also matters. A nonlinear function may appear in the outcome model as a predictor, or a transformed outcome may itself be modeled. The incompleteness pattern and the variables being imputed determine the conditional model that needs to represent the relationship. The safe first step is therefore to inventory the analysis terms and identify which incomplete variables feed into them.

Worked Example: Identifying a Quadratic Relationship

Suppose a hypothetical analysis relates an outcome score \(Y\) to a predictor \(X\), measured in tens of exposure units. The specified conditional mean is \(E(Y\mid X)=10+2X-0.5X^2\). Identify the nonlinear component and calculate the modeled mean at \(X=1\), \(X=2\), and \(X=3\).

The \(X^2\) term makes the relationship quadratic. At \(X=1\), the model gives \(10+2(1)-0.5(1^2)=11.5\) score points. At \(X=2\), it gives \(10+2(2)-0.5(2^2)=12.0\) points. At \(X=3\), it gives \(10+2(3)-0.5(3^2)=11.5\) points.

The increase from \(X=1\) to \(X=2\) is \(0.5\) points, whereas the change from \(X=2\) to \(X=3\) is \(-0.5\) points. Thus the model encodes a rise followed by a fall, not a constant linear trend. If \(X\) is incomplete, an imputation specification that only represents a straight-line association can fail to reproduce this pattern. After imputing \(X\), calculate \(X^2\) from the imputed value for the analysis; do not impute an unrelated value of \(X^2\).

A Justification From the Conditional Distribution

A short derivation shows why matching only a linear trend can be inadequate. Suppose, for illustration, that the analysis model for a continuous outcome is \(Y\mid X \sim N(\beta_0+\beta_1X+\beta_2X^2,\sigma^2)\), with \(\beta_2\ne 0\). Suppose also that \(X\) has a density \(p(x)\). By the definition of a conditional density and Bayes' rule,

$$ p(x\mid y)=\frac{p(y\mid x)p(x)}{p(y)} \ \propto\ \exp\!\left[-\frac{\{y-\beta_0-\beta_1x-\beta_2x^2\}^2}{2\sigma^2}\right]p(x). $$

The factor \(p(y)\) does not depend on \(x\), so it is absorbed into the proportionality constant. The expression inside the exponential depends on \(x\) through both \(x\) and \(x^2\). In general, the conditional distribution of \(X\) given \(Y\) therefore cannot be represented by a model that assumes only a linear relation in \(y\) and an unchanged, simple distribution for \(X\). The exact conditional form also depends on \(p(x)\); the derivation does not imply one universal imputation equation.

The implication is limited but important: when \(X\) is incomplete, an imputation model must be capable of preserving the relationship implied by the quadratic outcome model. In a chained-equations procedure, conditional models are specified variable by variable, so compatibility must be considered for those conditionals, not inferred solely from the analysis formula. This derivation motivates checking functional form; it does not supply a one-size-fits-all algorithm.

Transformed and Spline Terms

A transformation changes the scale on which a relationship is modeled. For instance, a model \(E(Y\mid X)=5+3\log(X)\) represents a constant change per unit increase in \(\log(X)\), not per unit increase in \(X\). The transformation also imposes a domain restriction: \(\log(X)\) requires \(X>0\). Imputations must respect that domain if the analysis is to be defined.

Worked Example: A Log-Transformed Predictor

Consider a hypothetical analysis model for a score \(Y\), \(E(Y\mid X)=5+3\log(X)\), where \(X\) is a positive measurement. Calculate the modeled means for \(X=1\), \(X=2\), and \(X=4\), using natural logarithms.

At \(X=1\), \(5+3\log(1)=5+3(0)=5.000\) score points. At \(X=2\), \(5+3\log(2)=5+3(0.6931)=7.079\) points. At \(X=4\), \(5+3\log(4)=5+3(1.3863)=9.159\) points. Doubling \(X\) from 1 to 2 and from 2 to 4 produces the same modeled increase, approximately \(2.079\) points each time, because each doubling adds \(\log(2)\) on the log scale.

A linear-only model in raw \(X\) does not encode this equal change for equal multiplicative increases. If \(X\) is incomplete, the imputation approach should retain the log-scale relationship and generate valid positive values. Calculating \(\log(X)\) after imputing \(X\) keeps the analysis term consistent with its source value, but does not by itself ensure that the imputation model has preserved the outcome association.

Spline terms require the same kind of inventory, though there may be several functions rather than one. A spline represents a relationship through basis functions, with knots marking locations where the shape can change. The analysis model's basis functions collectively define the fitted shape. Retaining only the raw predictor, or substituting a single linear term, need not retain the relationship represented by that collection.

Worked Example: Recognizing a Spline Basis Term

Suppose a hypothetical analysis uses a linear spline with a knot at \(X=4\) and the hinge basis function \(h(X)=\max(0,X-4)\). The fitted mean is \(E(Y\mid X)=20+1.5X-2h(X)\). Calculate the mean at \(X=2\), \(X=4\), and \(X=6\).

At \(X=2\), \(h(2)=\max(0,2-4)=0\), so the mean is \(20+1.5(2)-2(0)=23\) units of \(Y\). At the knot, \(h(4)=0\), giving \(20+1.5(4)=26\) units. At \(X=6\), \(h(6)=\max(0,6-4)=2\), giving \(20+1.5(6)-2(2)=25\) units.

Below the knot, the modeled slope is \(1.5\) units of \(Y\) per unit of \(X\); above it, the slope is \(1.5-2=-0.5\). The basis function is zero below the knot and becomes positive above it. If \(X\) is incomplete, the analysis relationship depends on this hinge as well as on \(X\). Impute \(X\) in a way that preserves the relationship represented by the analysis terms, then calculate \(h(X)\) from the resulting \(X\) values.

Specification Choices and Diagnostics

Several strategies can be considered, but none removes the need to check the conditional relationships. One approach is to include the necessary nonlinear functions in the relevant imputation predictors where appropriate. Another is to impute the underlying variable and calculate its derived terms passively at each imputation. Passive calculation ensures mathematical consistency among the raw value and its functions; it is not, by itself, a model for the distribution of the underlying variable. A richer conditional model may represent curvature more flexibly, but adding terms without regard to sample size, support, or model stability can create a different problem.

ApproachWhat it helps preserveLimitation to check
Linear-only imputation for a nonlinear analysis relationshipA straight-line association, if that form is adequateMay smooth away curvature or a change in slope
Impute the source variable and calculate derived termsExact consistency between each imputed value and its calculated functionDoes not alone ensure a compatible imputation distribution
Include nonlinear structure in relevant imputation modelsThe functional form needed for the analysis relationshipMay be unstable with sparse data or too many parameters

Useful checks include comparing observed and imputed predictor distributions, inspecting the relationship between the outcome and the predictor in observed and completed data, and checking that transformed values and basis functions have the expected range and shape. For a squared term, inspect whether imputed values of \(X\) cover the observed range and whether the resulting \(X^2\) values are plausible. For a log term, check for nonpositive imputations. For a spline, check whether imputations provide support on both sides of important knots when the observed data do so.

These checks are diagnostic rather than proof of compatibility. A smooth-looking plot cannot establish that all relevant conditional distributions are correctly specified. Conversely, apparent disagreement may reflect sparse observations, influential values, or genuine uncertainty rather than a single coding error. Investigate the model specification, variable coding, and observed support before interpreting completed-data results.

Common Pitfall and Limits

Wrong reasoning: “I calculated \(X^2\) after imputing \(X\), so the quadratic analysis relationship has automatically been preserved.” Correction: This guarantees that the two columns agree algebraically, but the model used to generate missing \(X\) may still ignore the outcome pattern associated with \(X^2\). Check both deterministic consistency and the conditional model that produced the imputed \(X\) values.

A related mistake is to place every analysis term into every conditional model mechanically. That can create collinearity, separation, sparse cells, or unstable estimates, especially with small samples. The appropriate specification depends on which variables are incomplete, the outcome type, the observed data support, and the substantive model. Multiple imputation cannot recover a shape that is unsupported by the observed data without relying heavily on modeling assumptions. It also does not correct an inappropriate analysis model, resolve structural absence of a predictor value, or make implausible extrapolations safe.

Key takeaway: First identify every nonlinear function used in the analysis. Then determine which incomplete variables generate those terms and whether the imputation models preserve the relevant outcome and predictor relationships. Calculate deterministic terms from their imputed source values, but do not confuse that bookkeeping step with adequate imputation-model specification.

Check Your Understanding

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

  1. An analysis includes \(X\) and \(X^2\), but the imputation model for missing \(X\) uses only a straight-line association with the outcome. What relationship might be lost?
  2. Why is calculating \(\log(X)\) after imputing \(X\) not sufficient, by itself, to show that the imputation model is adequate?
  3. A spline analysis uses a hinge term that is zero below a knot and positive above it. What should be checked when assessing the imputations?
  4. For \(E(Y\mid X)=8+2X-X^2\), calculate the modeled mean at \(X=1\) and \(X=3\). State the units as units of \(Y\).

Solutions. (1) The imputation model may fail to preserve curvature in the outcome-predictor relationship, weakening the quadratic association in the completed data. (2) The calculation ensures the transformed column matches its source value, but the model generating \(X\) may not represent the needed conditional relationship; for a logarithm, imputed \(X\) must also be positive. (3) Check that the hinge values are calculated from the imputed predictor, that the imputed values respect the predictor's plausible range, and that there is adequate support around and on both sides of the knot where relevant. (4) At \(X=1\), \(8+2(1)-1^2=9\) units of \(Y\). At \(X=3\), \(8+2(3)-3^2=5\) units of \(Y\).

Clinical Biostats