Tutorials › Multiple Imputation by Chained Equations (MICE) › Modeling Heteroscedastic Continuous Variables

Imputation Models by Variable Type · Tutorial 158 of 497

Modeling Heteroscedastic Continuous Variables

Learn to represent changing residual variance in a continuous MICE model and see why accounting for it matters for imputed values and uncertainty.

Intermediate 12 min read

What You'll Learn

  • Recognize heteroscedasticity in a continuous conditional model
  • Specify a positive variance function alongside the conditional mean
  • Derive the likelihood contribution for a normal location-scale model
  • Calculate predictive imputation draws using predictor-dependent variance
  • Diagnose variance-model misfit without confusing it with skewness or bounds
  • Compare variance-aware modeling with constant-variance and transformation approaches

Why Conditional Spread Matters

A continuous imputation model must describe more than the expected value of the missing variable. It must also represent how much individual values vary around that expectation. In a normal linear regression imputation model, the usual assumption is that this residual spread is the same at every predictor pattern. When the spread changes with the predictors, the conditional distribution is heteroscedastic.

This matters because an imputed value is drawn from a predictive distribution, not simply set equal to a fitted mean. If high-predictor cases naturally have more variability than low-predictor cases, a constant-variance model tends to make the former imputations too concentrated and the latter too dispersed. The conditional mean model can be reasonable while the imputed values and their uncertainty are still poorly represented.

Definition: A continuous outcome \(Y\) is conditionally heteroscedastic given predictors \(X\) when its conditional variance depends on those predictors: \(\operatorname{Var}(Y\mid X=x)=\sigma^2(x)\), where \(\sigma^2(x)\) is not constant over the relevant values of \(x\). A variance-aware imputation model specifies both a conditional mean and a conditional variance.

In a MICE update, \(Y\) is the variable currently being imputed and \(X\) denotes the other variables used in its conditional model. The model is fitted using cases with observed \(Y\), then used to generate replacements for missing \(Y\). The normal linear model and predictive parameter and residual draws were introduced in the earlier material on normal linear regression and parameter and residual uncertainty. Here the key change is that the residual variance is allowed to depend on \(X\).

A Location-Scale Model

A standard variance-aware specification gives the conditional mean a regression form and models the logarithm of the conditional variance:

$$ Y_i\mid X_i=x_i \sim N(\mu_i,\sigma_i^2),\qquad \mu_i=x_i^\mathsf{T}\beta,\qquad \log(\sigma_i^2)=z_i^\mathsf{T}\gamma. $$

Here \(x_i\) contains predictors for the mean, \(z_i\) contains predictors for the variance, \(\beta\) and \(\gamma\) are model parameters, and \(N(\mu_i,\sigma_i^2)\) uses \(\sigma_i^2\) as the variance. The predictors in the two parts need not be identical. Exponentiating the variance equation gives \(\sigma_i^2=\exp(z_i^\mathsf{T}\gamma)>0\), so the model cannot imply a negative variance.

The model assumes that, conditional on the predictors, observations are independent and normally distributed with the stated mean and variance functions. The functional forms must be adequate for the data: a linear mean and a log-linear variance are modeling choices, not automatic truths. For an imputation analysis, the fitted conditional model should also be appropriate for the analysis and include relevant predictors and relationships. As with other imputation models, accounting for heteroscedasticity does not by itself resolve a nonignorable missingness mechanism.

Model interpretation: A one-unit increase in a variance predictor \(z_k\), holding other variance predictors fixed, multiplies the conditional variance by \(\exp(\gamma_k)\). It multiplies the conditional standard deviation by \(\exp(\gamma_k/2)\). These are variance and spread interpretations, not changes in the conditional mean.

Likelihood and a Short Derivation

For observed outcomes \(y_i\), define the residual \(r_i=y_i-\mu_i\) and variance \(v_i=\sigma_i^2\). Under the conditional normal model, the log likelihood, apart from no omitted data-dependent terms, is

$$ \ell(\beta,\gamma) =-\frac{1}{2}\sum_i\left\{\log(2\pi)+\log(v_i)+\frac{(y_i-\mu_i)^2}{v_i}\right\}. $$

This expression explains why the variance model affects both the fit and the uncertainty. A large squared residual contributes less when the model assigns that case a larger variance, but assigning very large variances everywhere is penalized by the \(\log(v_i)\) term. To see how the log-variance parameters respond, let \(\log(v_i)=z_i^\mathsf{T}\gamma\). Differentiating the \(i\)th likelihood contribution with respect to \(\gamma\) gives

$$ \frac{\partial \ell_i}{\partial \gamma} =\frac{1}{2}z_i\left\{\frac{(y_i-\mu_i)^2}{v_i}-1\right\}. $$

Thus, cases whose squared residuals tend to exceed their modeled variances push the variance parameters upward in the corresponding predictor directions; cases whose squared residuals tend to be smaller push them downward. This is a justification for estimating a variance function from residual behavior, rather than merely visually labeling a plot. In practice, joint estimation or a suitable likelihood-based fitting procedure must account for uncertainty in both the mean and variance parameters.

For proper multiple imputation, the prediction step must represent uncertainty in the fitted model parameters as well as individual residual variation. For a given posterior or other valid parameter draw \((\beta^{(m)},\gamma^{(m)})\), a missing value at predictors \(x,z\) can be drawn as

$$ Y_{\mathrm{mis}}^{(m)} =x^\mathsf{T}\beta^{(m)} +\exp\!\left(\frac{z^\mathsf{T}\gamma^{(m)}}{2}\right)\epsilon^{(m)}, \qquad \epsilon^{(m)}\sim N(0,1). $$

The square root appears because the residual draw is scaled by the standard deviation, not the variance. Using a single fitted parameter estimate and only drawing residuals generally omits parameter uncertainty; replacing the residual draw with zero would omit individual residual uncertainty as well.

Worked Example: Detecting Unequal Residual Spread

Suppose a hypothetical set of observed outcomes is fitted with a mean model using a continuous predictor \(x\). To examine spread, residuals are grouped into low-\(x\) and high-\(x\) cases. The five residuals in the low group are \(-2,-1,0,1,2\) units; those in the high group are \(-6,-3,0,3,6\) units. Both groups are centered at zero.

For the low group, the sample residual variance is

$$ s_{\mathrm{low}}^2 =\frac{(-2)^2+(-1)^2+0^2+1^2+2^2}{5-1} =\frac{10}{4}=2.50\ \text{units}^2. $$

For the high group, it is

$$ s_{\mathrm{high}}^2 =\frac{(-6)^2+(-3)^2+0^2+3^2+6^2}{5-1} =\frac{90}{4}=22.5\ \text{units}^2. $$

The estimated high-group residual variance is \(22.5/2.50=9.00\) times the low-group variance, and its estimated standard deviation is three times as large. This pattern is consistent with increasing conditional spread. It is a diagnostic illustration, not a formal test or proof: the grouping is coarse, estimates are noisy, and the mean model must be adequate before residual spread is interpreted.

Working Through a Variance-Aware Imputation

The next example uses a deliberately specified log-variance function. In an analysis, its coefficients would be estimated from observed outcomes and uncertainty in those coefficients would be included in imputation.

Worked Example: Drawing a Missing Value at a High Predictor Value

Suppose a hypothetical outcome is measured in outcome units and has conditional mean \(\mu=20+2x\). A fitted variance model is \(\log(\sigma^2)=\log(4)+0.4x\). For this illustration, take one parameter draw as given, and consider a case with \(x=2\). A standard normal residual draw happens to be \(\epsilon=0.75\).

The conditional mean is

$$ \mu=20+2(2)=24\ \text{outcome units}. $$

The conditional variance and standard deviation at \(x=2\) are

$$ \sigma^2=\exp\{\log(4)+0.4(2)\} =4\exp(0.8)=8.902\ \text{outcome units}^2, \qquad \sigma=\sqrt{8.902}=2.984\ \text{outcome units}. $$

The predictive draw is therefore

$$ Y_{\mathrm{mis}}=24+(2.984)(0.75)=26.24\ \text{outcome units}. $$

The draw is above the conditional mean because the specified standard normal draw is positive. The larger standard deviation at \(x=2\) allows greater deviations than at lower values of \(x\). In an actual MICE run, the coefficients would not be treated as known: a fresh valid parameter draw would be used for each imputation, along with the residual draw.

What a Constant-Variance Model Can Miss

A constant-variance model may still estimate a useful average trend, but it assigns the same conditional residual spread across predictor values. That can create systematically miscalibrated predictive distributions. In the hypothetical data below, use the residual variances calculated above as illustrative estimates of the two group variances. If the two groups have equal sizes, pooling them under a common variance gives

$$ s_{\mathrm{pooled}}^2 =\frac{(5-1)(2.50)+(5-1)(22.5)}{(5-1)+(5-1)} =\frac{10+90}{8}=12.5\ \text{units}^2, \qquad s_{\mathrm{pooled}}=3.536\ \text{units}. $$

The pooled spread is larger than the low-group spread and smaller than the high-group spread. The following comparison treats the two group means as fitted correctly and uses normal predictive intervals to illustrate the consequence of the different variance assumptions.

Worked Example: Comparing Predictive Spread Across Groups

For an individual outcome with a known conditional mean, a normal 95% predictive interval under variance \(\sigma^2\) is approximately \(\mu\pm1.96\sigma\). This is a range for an individual outcome under the assumed model, not a confidence interval for the mean.

For the low-\(x\) group, using its estimated standard deviation \(s_{\mathrm{low}}=\sqrt{2.50}=1.581\), the interval is

$$ \mu_{\mathrm{low}}\pm1.96(1.581) =\mu_{\mathrm{low}}\pm3.10\ \text{outcome units}. $$

For the high-\(x\) group, \(s_{\mathrm{high}}=\sqrt{22.5}=4.743\), giving

$$ \mu_{\mathrm{high}}\pm1.96(4.743) =\mu_{\mathrm{high}}\pm9.30\ \text{outcome units}. $$

The constant-variance pooled model instead gives \(\mu\pm1.96(3.536)=\mu\pm6.93\) outcome units at both predictor levels. Relative to these illustrative group estimates, it makes the low-group predictive range too wide and the high-group range too narrow. Consequently, it can over-disperse imputations in one region and under-disperses them in another, even if the conditional means are well modeled.

Diagnostics and Alternative Approaches

A variance model is only useful when its assumptions are reasonably compatible with observed data. Examine residuals after fitting the mean model and, where applicable, standardized residuals \(r_i/\hat{\sigma}_i\) after fitting the variance model. A plot of residuals against fitted means or important predictors can reveal a fan shape, changing band width, or subgroup-specific spread. After variance adjustment, standardized residuals should not retain a clear spread pattern; their distribution should also be checked for pronounced nonnormality or outliers.

A fan pattern can also result from a misspecified mean, omitted interactions, influential observations, or mixtures of groups. Check whether the conditional mean has a systematic residual trend before attributing all structure to the variance. A model with a suitable variance function should reduce predictor-related spread while not leaving a strong mean pattern. Where data permit, compare predicted and observed residual dispersion across predictor ranges. The variance model can be unstable when observed cases are sparse in some ranges or when the variance predictors are highly collinear.

A constant-variance normal regression is simpler and can be adequate when residual spread is roughly stable. Transforming a skewed response may sometimes stabilize variance, but a transformation changes the scale of the conditional model and can complicate interpretation after returning to the original scale; the earlier material on transforming skewed continuous variables addresses that distinct issue. If observations form meaningful groups, group-specific variances may be an alternative to a smooth variance function, but estimates can be imprecise when groups are small. Robust methods may reduce sensitivity to outliers, but they are not automatically a substitute for modeling a genuine systematic variance pattern.

Heteroscedasticity is not itself evidence of skewness, a point mass at zero, or a bounded outcome. Those features call for different considerations, as in the earlier material on two-part models and truncated continuous models. Conversely, allowing a changing variance does not guarantee normal tails or protect against influential outliers. These are model limitations to assess, not problems that the variance equation alone solves.

Common pitfall: Seeing residuals spread out at larger fitted values and adding a variance model without checking the mean is wrong reasoning. A missing curve in the mean can create structured residuals that look like a changing spread. First assess whether residuals are centered around zero across predictor values; then model residual variance and check whether standardized residuals have approximately stable spread.

Check Your Understanding

Answer each question using the model definitions and calculations above. Brief solutions follow the questions.

  1. If \(\log(\sigma^2)=\log(9)-0.2x\), by what factor does the variance change when \(x\) increases by one, and by what factor does the standard deviation change?
  2. A variance-aware model gives \(\mu=10\) units and \(\sigma=2\) units for a case. For a standard normal draw of \(-1.5\), calculate the residual draw and imputed value.
  3. Why does a constant-variance model risk poor imputations when residual spread increases with a predictor, even if its mean equation is adequate?
  4. Name two checks that help distinguish a genuine variance pattern from a problem with the mean model or residual distribution.

Solutions. (1) The variance factor is \(\exp(-0.2)=0.8187\), so it decreases by about 18.1% per unit increase in \(x\). The standard-deviation factor is \(\exp(-0.2/2)=\exp(-0.1)=0.9048\), a decrease of about 9.52%. (2) The residual draw is \(2(-1.5)=-3.00\) units, so the imputed value is \(10-3=7.00\) units. (3) It assigns the same spread everywhere, making imputations too concentrated where the actual spread is larger and potentially too dispersed where it is smaller. (4) Check residuals against fitted values or predictors for a systematic mean trend, and inspect standardized residuals for remaining spread patterns and unusual tails or outliers.

Clinical Biostats