Tutorials › Multiple Imputation by Chained Equations (MICE) › Worked Binary-Variable Imputation

Imputation Models by Variable Type · Tutorial 165 of 497

Worked Binary-Variable Imputation

Learn to fit and interpret a binary logistic imputation model and turn its predicted probabilities into stochastic imputations for incomplete clinical records.

Intermediate 12 min read

What You'll Learn

  • Fit a logistic model to a hypothetical binary clinical risk indicator.
  • Interpret a logistic coefficient and its odds ratio in context.
  • Calculate fitted risk probabilities from the model.
  • Generate stochastic binary imputations using Bernoulli draws.
  • Distinguish stochastic imputations from deterministic classification.
  • Check model assumptions and recognize diagnostics that signal instability.

From a Fitted Model to Imputed Values

A binary imputation model does not assign each incomplete record the category that seems most likely. It estimates a conditional probability of category 1, then uses that probability to generate a stochastic value. This distinction matters: imputations should reflect uncertainty about the missing value rather than replace it with a fixed prediction.

Consider a clinical risk indicator \(Y\), where \(Y=1\) denotes high risk and \(Y=0\) denotes not high risk. Let \(X\) denote the predictor information available for a patient. A logistic imputation model specifies the conditional probability of high risk, given that information. In MICE, the model is fitted using records for which \(Y\) is observed, with the current available or imputed predictor values used for the conditional model.

Definition: A binary logistic imputation model for \(Y\) specifies $$ \operatorname{logit}\{P(Y=1\mid X)\}=\log\left(\frac{P(Y=1\mid X)}{1-P(Y=1\mid X)}\right)=\beta_0+\beta_1X_1+\cdots+\beta_qX_q. $$ The corresponding predicted probability is $$ \hat p(X)=\frac{\exp(\hat\beta_0+\hat\beta_1X_1+\cdots+\hat\beta_qX_q)}{1+\exp(\hat\beta_0+\hat\beta_1X_1+\cdots+\hat\beta_qX_q)}. $$ For an incomplete \(Y\), a stochastic imputation is a Bernoulli draw with probability \(\hat p(X)\), or with a probability calculated from a drawn set of model parameters in a full MICE implementation.

Assumptions and the Imputation Step

The conditional model assumes that \(Y\), given the included predictors, follows a Bernoulli distribution with the stated probability. The logit of that probability must be adequately described by the included terms: a continuous predictor entered linearly, for example, is assumed to have a linear association with the log odds unless nonlinear terms are added. Relevant interactions or nonlinearities must be represented when needed. Predictors should be available for the incomplete records at the current MICE iteration.

For the usual likelihood fit, the observed outcome records must provide enough information to estimate the coefficients; complete separation can make ordinary maximum-likelihood estimates diverge. The model should also include useful predictors of the risk indicator and of its missingness. Interpreting the resulting imputation as appropriate for missing data further relies on a defensible missing-at-random assumption conditional on variables included in the imputation model. A fitted logistic model alone cannot establish that assumption.

In the calculations below, coefficients are treated as fixed to make the Bernoulli imputation step transparent. A full MICE procedure must also represent uncertainty in estimated parameters, commonly by drawing parameters using an appropriate Bayesian or large-sample procedure before calculating the probabilities. Drawing only the binary outcomes at fixed fitted coefficients does not, by itself, represent that parameter uncertainty.

1
Fit the conditional model.
Use observed values of the binary outcome and the available predictors to estimate the logistic regression coefficients.
2
Calculate a probability.
For each record with missing \(Y\), substitute its predictor values into the fitted linear predictor and transform the result to a probability.
3
Make a Bernoulli draw.
Generate \(Y=1\) with the calculated probability and \(Y=0\) otherwise. In a full MICE run, repeat this using the appropriate parameter draw for that imputation.

Worked Example: Fit and Interpret a Model

Worked Example: Fit and Interpret a Model

In a hypothetical clinical dataset, a risk indicator is observed for 80 patients. Among 40 patients without a recent hospitalization, 8 are high risk and 32 are not. Among 40 patients with a recent hospitalization, 18 are high risk and 22 are not. Fit a logistic model with hospitalization as the only predictor, where \(H=1\) denotes a recent hospitalization and \(H=0\) denotes none.

Model and assumptions. The model is \(\operatorname{logit}\{P(Y=1\mid H)\}=\beta_0+\beta_1H\). It allows a separate risk probability in each of the two hospitalization groups. For this hypothetical calculation, assume independent binary outcomes conditional on \(H\), no missing predictor values, and no separation: each group contains both high-risk and not-high-risk patients.

Estimate the group probabilities. The observed proportions are \(\hat p_0=8/40=0.2000\) without hospitalization and \(\hat p_1=18/40=0.4500\) with hospitalization. With a binary predictor and an intercept, the model is saturated for these two groups. The likelihood in each group is proportional to \(p^y(1-p)^{n-y}\); its log-likelihood has derivative \(y/p-(n-y)/(1-p)\). Setting that derivative to zero gives \(y(1-p)=(n-y)p\), hence \(\hat p=y/n\). Thus these group proportions are the fitted probabilities.

Calculate the coefficients. At \(H=0\), the fitted log odds are the intercept:

$$ \hat\beta_0=\log\left(\frac{8}{32}\right)=\log(0.25)=-1.3863. $$

At \(H=1\), the fitted log odds equal \(\hat\beta_0+\hat\beta_1\), so the coefficient is the difference between group log odds:

$$ \hat\beta_1 =\log\left(\frac{18}{22}\right)-\log\left(\frac{8}{32}\right) =\log\left(\frac{18/22}{8/32}\right) =\log(3.2727) \approx 1.1856. $$

Interpret the coefficient. Conditional on this model, the estimated odds of high risk for patients with a recent hospitalization are about 3.273 times the estimated odds for patients without one. This is an association in these hypothetical records, not evidence that hospitalization causes high risk. The fitted probabilities are \(0.2000\) and \(0.4500\), respectively.

Worked Example: Stochastic Imputations for Incomplete Records

Worked Example: Stochastic Imputations for Incomplete Records

Continue with the fitted model above. Six hypothetical patients have a missing risk indicator, but their hospitalization status is observed. To demonstrate the stochastic step at fixed fitted coefficients, suppose the independent uniform draws for these records are the values shown below. The rule is to impute 1 when \(U<\hat p(H)\), and 0 otherwise, where \(U\sim\operatorname{Uniform}(0,1)\).

PatientHospitalization \(H\)Fitted probabilityUniform draw \(U\)Imputed \(Y\)
A00.20000.121
B00.20000.630
C10.45000.311
D10.45000.720
E10.45000.411
F00.20000.880

For patient A, \(0.12<0.2000\), so the draw is 1. For patient B, \(0.63\) is not less than \(0.2000\), so the draw is 0. For patient C, \(0.31<0.4500\), giving 1; patient D has \(0.72>0.4500\), giving 0; and patient E has \(0.41<0.4500\), giving 1. Patient F has \(0.88>0.2000\), giving 0. The completed values for these six records are therefore 1, 0, 1, 0, 1, 0.

The imputations need not reproduce the group probabilities exactly in a small set of records. For example, two of the three patients without hospitalization were imputed as high risk here, even though each had probability 0.2000. That outcome is possible by chance and is not a reason to replace the stochastic rule with a fixed assignment.

Worked Example: Calculate Probabilities With Two Predictors

Worked Example: Calculate Probabilities With Two Predictors

Suppose a fitted model from a separate hypothetical dataset is \(\operatorname{logit}\{P(Y=1\mid A,H)\}=-3.00+0.040(A-60)+0.900H\), where \(A\) is age in years and \(H\) indicates recent hospitalization. A patient aged 70 with hospitalization has missing \(Y\). Calculate the probability and impute using a uniform draw \(U=0.12\).

The predictors are observed, and this calculation assumes the specified linear logit model applies at age 70. Substitute the values: the age contribution is \(0.040(70-60)=0.400\), and the hospitalization contribution is \(0.900(1)=0.900\). Thus the linear predictor is \(-3.00+0.400+0.900=-1.700\), and

$$ \hat p=\frac{\exp(-1.700)}{1+\exp(-1.700)} =\frac{0.1827}{1+0.1827} \approx 0.1545. $$

Because \(0.12<0.1545\), the stochastic imputation is \(Y=1\). The hospitalization coefficient corresponds to an odds ratio of \(\exp(0.900)\approx2.460\), conditional on age: for each fixed age, the fitted odds are about 2.460 times as large for the hospitalized group. The age coefficient corresponds to an odds ratio of \(\exp(0.040)\approx1.041\) per additional year, conditional on hospitalization. Neither odds ratio is a probability difference.

Diagnostics, Alternatives, and Limitations

Before relying on imputations, inspect whether the fitted model is behaving plausibly. Useful checks include the number of observed 1s and 0s across predictor patterns, convergence warnings, unusually large coefficients or standard errors, and predicted probabilities concentrated almost entirely at 0 or 1. In a model with continuous predictors, assess whether the logit-linear form is credible and whether important interactions or nonlinear patterns are missing. Compare observed outcome frequencies with fitted probabilities across meaningful groups when the observed data allow it.

A nonconvergent fit or extreme estimates can indicate separation or too little information for the chosen predictor structure. The earlier material on rare binary outcomes and separation and on binary imputation with sparse predictor patterns addresses those specific problems. A successful software fit is not sufficient evidence that the conditional model is well specified, that missingness is ignorable, or that the chain has mixed adequately.

Several alternatives answer different questions or make different trade-offs. Deterministic classification assigns 1 whenever a probability exceeds a threshold, often 0.5. It is useful for classification but loses uncertainty and can distort the distribution of an imputed binary variable. A linear probability model may be simple to calculate, but can produce fitted values outside the interval from 0 to 1 and does not impose the logistic probability structure. Donor-based methods such as hot-deck imputation use observed records rather than this logistic form, but depend on finding suitable donors. Complete-case analysis avoids filling in \(Y\), but discards records with missing values and may target a different, biased result if its assumptions fail.

Logistic imputation also has limitations. It may be unstable with sparse data, sensitive to misspecified predictors, or unable to resolve missing-not-at-random mechanisms from the observed data alone. Its Bernoulli draws capture variation in the missing binary outcomes conditional on the model; proper multiple imputation must also account for model-parameter uncertainty. In practice, review both the fitted model and the imputed values, and assess whether conclusions are sensitive to reasonable modeling choices.

Common Mistake

Key takeaway: A fitted probability is not the imputed value. If a patient has estimated high-risk probability \(0.45\), assigning 1 because that is the more likely category is deterministic classification, not a Bernoulli imputation. Instead generate 1 with probability \(0.45\) and 0 with probability \(0.55\), while accounting for parameter uncertainty in the full MICE procedure.

The wrong reasoning is, “The probability is below 0.5, so the missing value must be 0.” A probability below 0.5 says only that 0 is more likely for that record under the model; it does not make 0 certain. Repeating the same fixed assignment across all imputations erases between-imputation variation and can make downstream uncertainty appear too small.

Check Your Understanding

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

  1. A fitted model gives a missing record a probability of 0.30. If its uniform draw is 0.24, what is the imputed value, and why?
  2. In the first worked example, calculate the odds ratio from the two group odds and state its interpretation.
  3. Why is assigning 0 to every missing record with fitted probability 0.45 not stochastic imputation?
  4. Name two warning signs that a binary logistic imputation model may be unstable or misspecified.

Solutions. (1) The imputed value is 1 because \(0.24<0.30\). (2) The odds ratio is \((18/22)/(8/32)=3.2727\), or about 3.273; the estimated odds of high risk are about 3.273 times as large with recent hospitalization as without it. (3) A fixed assignment ignores the Bernoulli probability and removes variation among imputations; the draw should be 1 with probability 0.45 and 0 otherwise. (4) Examples include nonconvergence, extremely large coefficient estimates or standard errors, near-zero or near-one predicted probabilities, and poor fit of the logit-linear predictor pattern.

Clinical Biostats