Introduction
Missing data are almost unavoidable in clinical research. Patients may withdraw from a study, miss visits, discontinue treatment, experience an adverse event, or simply fail to provide a measurement at a planned assessment.
The statistical problem is that the analysis usually needs information that is not observed for every patient.
A common response is to perform a complete-case analysis, using only subjects with no missing values for the variables required by the analysis.
Although simple, this approach can waste information and can produce biased estimates when the probability of being observed is related to patient characteristics or outcomes.
Multiple imputation provides a principled framework for replacing missing values with plausible values while preserving uncertainty about the missing observations.
What Is Multiple Imputation?
Suppose a dataset contains a variable \(Y\) with missing observations. Instead of replacing every missing value with one deterministic value, multiple imputation creates \(m\) completed datasets:
\[ D^{(1)},D^{(2)},\ldots,D^{(m)} \]Each dataset contains different plausible values for the missing observations.
The analysis model is then fitted separately to every completed dataset.
For example, if \(m=20\), the investigator obtains 20 regression estimates, 20 standard errors, and 20 sets of inferential statistics.
These results are then combined using Rubin's rules.
Why Not Just Use the Mean?
One of the simplest approaches to missing continuous data is mean imputation.
For example, if the observed values are:
| Patient | Observed Value |
|---|---|
| 1 | 10 |
| 2 | 12 |
| 3 | 14 |
| 4 | Missing |
| 5 | 16 |
The observed mean is:
\[ \bar{Y} = \frac{10+12+14+16}{4} = 13 \]A simple imputation approach would replace the missing value with 13.
The problem is that this treats the imputed value as though it were actually observed.
It also reduces the variability of the dataset because every missing observation is replaced with the same value.
Missing Data Mechanisms
Multiple imputation is closely connected to assumptions about why observations are missing.
Three standard missing-data mechanisms are:
| Mechanism | Meaning |
|---|---|
| MCAR | Missingness is unrelated to observed and unobserved data. |
| MAR | Missingness may depend on observed data after conditioning on variables included in the model. |
| MNAR | Missingness depends on unobserved values even after accounting for observed information. |
MCAR
Missing completely at random, or MCAR, is the strongest assumption.
Conceptually:
\[ P(R\mid Y_{\mathrm{obs}},Y_{\mathrm{mis}}) = P(R) \]where \(R\) denotes the missingness indicator.
Under MCAR, whether a value is missing is unrelated to both observed and unobserved values.
For example, imagine that laboratory specimens are randomly lost because of an equipment failure unrelated to patient characteristics.
MCAR can make complete-case analysis valid under appropriate conditions, but it is often considered unrealistic for clinical-trial data.
MAR
Missing at random, or MAR, is less restrictive.
Under MAR, missingness can depend on variables that have been observed.
For example, suppose patients with poor baseline health are more likely to miss a later assessment. If baseline health is observed and included in the missing-data model, the missingness mechanism may be plausibly modeled as MAR.
Informally:
\[ P(R\mid Y_{\mathrm{obs}},Y_{\mathrm{mis}}) = P(R\mid Y_{\mathrm{obs}}) \]MAR does not mean that missingness is unrelated to the unobserved outcome. It means that, conditional on the observed information included in the model, the additional dependence on the missing value can be ignored for the imputation model.
MNAR
Missing not at random, or MNAR, refers to situations in which missingness depends on unobserved information even after conditioning on observed data.
For example, patients who discontinue because their treatment is ineffective may have systematically different unobserved outcomes than patients who remain in the study.
A standard MAR-based multiple-imputation analysis may not adequately capture this possibility.
That is why clinical-trial analyses frequently supplement a primary MAR analysis with sensitivity analyses under alternative MNAR assumptions.
Multiple Imputation and the Imputation Model
A crucial concept is that the imputation model and the final analysis model serve different purposes.
The imputation model predicts missing values.
The analysis model estimates the treatment effect or other scientific parameter of interest.
A good imputation model generally contains variables that are strongly related to:
- The variable being imputed
- The probability that the value is missing
- The outcome being analyzed
- Treatment assignment
- Important baseline prognostic factors
Why Include the Outcome?
Suppose the primary analysis estimates treatment effects on a continuous endpoint \(Y\). If \(Y\) has missing values, predictors of \(Y\) should generally be available to the imputation model.
If a variable strongly predicts the outcome but is omitted from the imputation model, the imputed values may be unnecessarily weakly associated with the observed data.
This can distort treatment-effect estimates and reduce efficiency.
Why Include Treatment Assignment?
In a randomized clinical trial, treatment assignment is usually an essential variable for the imputation model.
Suppose the treatment effect is:
\[ \Delta = E(Y\mid A=1)-E(Y\mid A=0) \]If treatment assignment is omitted from the imputation model, the imputed outcomes may fail to preserve the treatment-group structure.
A common strategy is therefore to include treatment assignment in the imputation model even when treatment is not itself being imputed.
Installing the mice Package
The mice package is one of the most widely used
implementations of multiple imputation by chained equations in R.
install.packages("mice")
Then load it:
library(mice)
A useful companion package for data manipulation and visualization is
dplyr, although the core imputation workflow can be
performed using mice alone.
Step 1: Create an Example Clinical-Trial Dataset
Consider a randomized clinical trial with:
id= patient identifiertrt= treatment groupage= baseline agebaseline= baseline disease scoreweek4= Week 4 scoreweek8= Week 8 score
The following code creates an illustrative dataset:
set.seed(2026) n <- 120 dat <- data.frame( id = 1:n, trt = rbinom(n, 1, 0.5), age = round(rnorm(n, 60, 10)), baseline = round(rnorm(n, 50, 12)), week4 = round(rnorm(n, 43, 13)), week8 = round(rnorm(n, 40, 14)) ) dat$week4[sample(1:n, 18)] <- NA dat$week8[sample(1:n, 25)] <- NA
This is only an educational example. In an actual trial, the missingness pattern should arise from the observed study data rather than being artificially generated.
Step 2: Examine the Missingness
Before performing imputation, inspect the amount and pattern of missing data.
summary(dat)
A simple way to count missing values is:
colSums(is.na(dat))
You might obtain output resembling:
| Variable | Missing Values |
|---|---|
| id | 0 |
| trt | 0 |
| age | 0 |
| baseline | 0 |
| week4 | 18 |
| week8 | 25 |
Step 3: Inspect the Missingness Pattern with mice
The md.pattern() function provides a compact
description of missing-data patterns.
md.pattern(dat)
The output identifies combinations of observed and missing variables.
This is particularly useful because missingness is often not independent across variables.
For example, patients missing Week 4 may be disproportionately likely to be missing Week 8.
Step 4: Let mice Describe the Default Setup
A useful first diagnostic is:
ini <- mice( dat, maxit = 0, printFlag = FALSE ) ini$method ini$predictorMatrix
Setting maxit = 0 does not perform imputation.
It initializes the object and shows how mice would
treat the variables.
Understanding the Method Vector
The method vector specifies the imputation method
for each variable.
Typical methods include:
| Method | Typical Use |
|---|---|
pmm |
Continuous variables using predictive mean matching |
norm |
Continuous variables under a normal-model approach |
logreg |
Binary variables |
polyreg |
Unordered categorical variables with more than two categories |
polr |
Ordered categorical variables |
2l.pan |
Two-level hierarchical continuous data |
Predictive Mean Matching
Predictive mean matching, or PMM, is a particularly useful method for continuous clinical variables.
Rather than generating an arbitrary value from a fitted normal distribution, PMM predicts the missing observation and then selects an observed value from a patient with a similar predicted value.
This has an important practical advantage: the imputed value is an observed value from the donor pool.
For example, if a clinical score is measured on a particular scale, PMM tends to preserve realistic values and can reduce implausible extrapolation.
Step 5: Build an Appropriate Predictor Matrix
The predictor matrix tells mice which variables
should be used to impute each target variable.
pred <- ini$predictorMatrix pred
Rows represent variables being imputed. Columns represent potential predictors.
A value of 1 indicates that a variable is used as a predictor for another variable.
A value of 0 means that it is not used.
Why Patient ID Should Not Predict Outcomes
The patient identifier is generally not a meaningful predictor of clinical outcomes.
Therefore, it should usually be excluded from the predictor matrix.
pred[, "id"] <- 0
Similarly, the identifier itself should not be imputed.
ini$method["id"]
For a fully observed ID variable, the method should be blank.
Step 6: Specify the Imputation Methods
For this example, Week 4 and Week 8 are continuous clinical measurements.
meth <- ini$method meth["week4"] <- "pmm" meth["week8"] <- "pmm"
The fully observed variables remain unchanged.
Step 7: Run Multiple Imputation
Suppose we want 20 imputed datasets.
imp <- mice( dat, m = 20, method = meth, predictorMatrix = pred, maxit = 20, seed = 2026 )
The key arguments are:
| Argument | Purpose |
|---|---|
m |
Number of completed datasets to create |
method |
Imputation method for each variable |
predictorMatrix |
Variables used to predict each incomplete variable |
maxit |
Number of iterations of the chained-equations algorithm |
seed |
Random-number seed for reproducibility |
What Does maxit Mean?
Multiple imputation by chained equations fits a sequence of conditional models.
For example:
\[ X_1\mid X_2,X_3,\ldots \]then:
\[ X_2\mid X_1,X_3,\ldots \]and so on.
The process cycles through the incomplete variables repeatedly.
The number of cycles is controlled by maxit.
A value such as 10, 20, or 30 may be reasonable depending on the problem, but the appropriate number should be evaluated using diagnostics rather than selected mechanically.
Step 8: Inspect the Imputation Object
After running mice(), inspect the object:
imp
You can also examine the methods:
imp$method
and the predictor matrix:
imp$predictorMatrix
This provides an important audit trail for understanding exactly how the imputation was performed.
Step 9: Examine Convergence
Multiple imputation is iterative, so convergence diagnostics are important.
The plot() method can display iteration histories.
plot(imp)
For a continuous variable, the chains should generally mix reasonably well rather than displaying strong systematic trends.
Step 10: Compare Imputed and Observed Distributions
Another important diagnostic is to compare observed values with imputed values.
densityplot( imp, ~ week4 )
You can similarly inspect Week 8:
densityplot( imp, ~ week8 )
A reasonable imputation model should produce imputed values that are broadly consistent with the observed distribution while still reflecting uncertainty.
Why Distributional Diagnostics Matter
Suppose observed Week 8 scores range from 20 to 80, but the imputation model generates many values above 150.
That would be a warning sign.
Likewise, if the imputed values are suspiciously concentrated around the mean, the model may be failing to preserve the variability of the observed data.
Diagnostics should therefore examine:
- Range
- Location
- Spread
- Distributional shape
- Relationships with important predictors
Step 11: Extract a Completed Dataset
A particular completed dataset can be extracted using:
complete(imp, 1)
The argument 1 requests the first imputed dataset.
The second is:
complete(imp, 2)
and so on.
You can also extract all completed datasets in long format:
long_dat <- complete( imp, action = "long", include = TRUE )
The resulting data include an indicator identifying which imputation each row belongs to.
Do Not Analyze One Imputed Dataset
A critical rule is: do not choose one completed dataset and treat it as though it were the original observed dataset.
Doing so throws away the primary advantage of multiple imputation: incorporating uncertainty about the missing values.
Instead, fit the analysis model to all \(m\) datasets and pool the results.
Step 12: Fit a Regression Model
Suppose the primary analysis is a linear model for Week 8 outcome:
\[ Y_8 = \beta_0 + \beta_1 A + \beta_2 Y_0 + \epsilon \]where \(A\) represents treatment assignment and \(Y_0\) is baseline score.
The model can be fitted to every imputed dataset using:
fit <- with( imp, lm(week8 ~ trt + baseline) )
The object fit contains the model fitted separately
to each imputed dataset.
Step 13: Pool the Results
Use pool() to combine the estimates:
pooled <- pool(fit) summary(pooled)
The resulting output contains pooled estimates, standard errors, test statistics, degrees of freedom, and confidence intervals.
This is the result that should generally be used for the primary inferential analysis.
Rubin's Rules
Suppose there are \(m\) imputed datasets. Let:
\[ \hat{\theta}_1,\hat{\theta}_2,\ldots,\hat{\theta}_m \]be the parameter estimates from the individual datasets. The pooled point estimate is the average:
\[ \bar{\theta} = \frac{1}{m} \sum_{j=1}^{m} \hat{\theta}_j \]The within-imputation variance is:
\[ \bar{U} = \frac{1}{m} \sum_{j=1}^{m} U_j \]where \(U_j\) is the estimated variance from imputation \(j\).
The between-imputation variance is:
\[ B = \frac{1}{m-1} \sum_{j=1}^{m} (\hat{\theta}_j-\bar{\theta})^2 \]The total variance is then:
\[ T = \bar{U} + \left(1+\frac{1}{m}\right)B \]The second term is what allows multiple imputation to incorporate uncertainty about the missing values.
Interpreting the Between-Imputation Variance
If all imputed datasets produce nearly identical estimates, the between-imputation variance will be small.
If the estimates differ substantially across imputations, the missing data are contributing meaningful uncertainty.
This is exactly the behavior we want the method to capture.
Fraction of Missing Information
A useful diagnostic is the fraction of missing information. Conceptually, it measures how much of the uncertainty in an estimate is associated with missing data.
For a parameter \(\theta\), a simplified expression is related to:
\[ \lambda \approx \frac{(1+1/m)B}{T} \]A larger value indicates that missing data contribute more substantially to the uncertainty of the estimate.
The exact inferential quantities reported by modern implementations also account for the finite number of imputations.
How Many Imputations Should You Use?
There is no universal number that is correct for every analysis.
Historically, relatively small numbers of imputations were common. Modern practice often uses substantially more, especially when the fraction of missing information is appreciable.
Values such as:
- 20 imputations
- 50 imputations
- 100 imputations
may all be reasonable depending on the problem.
Monte Carlo Error
Multiple imputation uses a finite number of simulated or stochastic imputations. Therefore, the pooled result itself contains some Monte Carlo variation.
Increasing \(m\) reduces this simulation-related variation.
If a final clinical-trial analysis depends heavily on multiple imputation, using more imputations can provide more stable results without changing the underlying missing-data assumption.
Step 14: Analyze a Binary Endpoint
Multiple imputation is not limited to continuous outcomes. Suppose the primary endpoint is binary:
\[ Y= \begin{cases} 1,&\text{response}\\ 0,&\text{no response} \end{cases} \]For a binary variable, a logistic-regression-based imputation method may be appropriate.
meth["response"] <- "logreg"
The imputation model can then include treatment and other prognostic variables.
imp_bin <- mice( dat, m = 50, method = meth, predictorMatrix = pred, maxit = 20, seed = 2026 )
Step 15: Analyze a Binary Endpoint After Imputation
A logistic regression model can be fitted using:
fit_bin <- with(
imp_bin,
glm(
response ~ trt + age + baseline,
family = binomial()
)
)
summary(
pool(fit_bin)
)
The pooled model can then be interpreted in terms of treatment effects on the log-odds scale or transformed into odds ratios.
Step 16: Analyze a Continuous Change-from-Baseline Endpoint
A common clinical-trial analysis uses change from baseline:
\[ \Delta_i = Y_{i,\mathrm{post}} - Y_{i,\mathrm{baseline}} \]However, when a baseline-adjusted ANCOVA is prespecified, it is often preferable to model the post-baseline outcome directly:
\[ Y_{i,\mathrm{post}} = \beta_0 + \beta_1 A_i + \beta_2Y_{i,\mathrm{baseline}} + \epsilon_i \]The imputation model should be constructed to support the planned analysis.
Step 17: Include Auxiliary Variables
An auxiliary variable is a variable that may improve the imputation model even if it is not part of the final analysis model.
Examples include:
- Earlier measurements of the same outcome
- Other disease-severity measures
- Patient-reported outcomes
- Laboratory measurements
- Prior treatment response
- Variables associated with dropout
Suppose Week 4 and Week 8 outcomes are both partially missing. Week 4 may be a strong predictor of Week 8 and should therefore generally be considered in the Week 8 imputation model.
Longitudinal Clinical-Trial Data
Longitudinal data require additional care because repeated measurements within the same patient are correlated.
For example:
| Patient | Baseline | Week 4 | Week 8 | Week 12 |
|---|---|---|---|---|
| 001 | 52 | 48 | 45 | 42 |
| 002 | 47 | 44 | Missing | Missing |
| 003 | 61 | 55 | 52 | 49 |
A strong imputation strategy should preserve the relationships among repeated measurements rather than treating every visit as an unrelated variable.
Including multiple visits as predictors can help preserve longitudinal information.
Monotone Missingness
A special pattern occurs when once a patient becomes missing, all later measurements are also missing.
For example:
\[ Y_1=\text{observed}, \qquad Y_2=\text{observed}, \qquad Y_3=\text{missing}, \qquad Y_4=\text{missing} \]This is called a monotone missingness pattern.
Nonmonotone patterns are more complicated because a patient can have an observed measurement after a missing measurement.
The mice framework is designed to handle general
patterns of missingness.
Intermittent Missingness
Consider:
\[ Y_1=\text{observed}, \qquad Y_2=\text{missing}, \qquad Y_3=\text{observed} \]This is intermittent missingness.
The fact that the patient later returns provides useful information for imputing the earlier missing observation.
This is one reason longitudinal imputation models should generally use as much relevant observed information as is scientifically justified.
Step 18: Predictors of Dropout
Suppose patients with worsening disease are more likely to discontinue.
If a variable reflecting disease severity is observed before dropout, it may be an important predictor in the imputation model.
For example:
\[ P(R_i=1) = f( \text{baseline severity}, \text{Week 4 severity}, \text{treatment}, \text{other covariates} ) \]The more informative the observed data are about missingness and the missing outcome, the more plausible a MAR-based imputation analysis can become.
Step 19: Include Post-Baseline Information Carefully
Post-baseline variables can be valuable predictors, but their use requires careful thought.
A variable should not be included merely because it is available.
Ask:
- Is it measured before the variable being imputed?
- Is it affected by treatment?
- Does it represent an intermediate event?
- Is it part of the estimand?
- Could including it create an inappropriate conditioning structure?
The imputation model should be aligned with the scientific question and estimand.
Multiple Imputation and Estimands
Modern clinical-trial analyses should distinguish the missing-data method from the estimand.
An estimand specifies what treatment effect is being targeted. For example, the question might be:
What would the treatment effect be if all randomized patients were followed regardless of treatment discontinuation?
Or the question might instead concern outcomes under a treatment-policy strategy, hypothetical strategy, while-on-treatment strategy, or another intercurrent-event strategy.
Intercurrent Events and Imputation
Consider a patient who discontinues study treatment because of an adverse event.
The subsequent missing outcome is not simply an arbitrary missing value.
The investigator must first determine how the intercurrent event is handled under the chosen estimand.
Only then can the missing-data strategy be specified appropriately.
This is why multiple imputation should not be treated as a generic "fix for missing data."
Step 20: Sensitivity Analysis
A primary multiple-imputation analysis may use an MAR assumption.
But the analysis should often be supplemented with sensitivity analyses that explore departures from MAR.
Possible approaches include:
- Pattern-mixture models
- Reference-based imputation
- Tipping-point analyses
- Delta-adjusted imputation
- Control-based imputation
- Jump-to-reference assumptions
The purpose is not to prove that MAR is true.
The purpose is to evaluate whether the substantive conclusion is robust to plausible departures from the primary missing-data assumption.
Delta Adjustment
A simple sensitivity analysis modifies imputed outcomes by a specified quantity.
For a continuous endpoint:
\[ Y_{\mathrm{imp}}^{*} = Y_{\mathrm{imp}} + \delta \]where \(\delta\) represents a departure from the primary MAR assumption.
For example, investigators might evaluate:
\[ \delta \in \{-5,-3,-1,0,1,3,5\} \]The analysis can then determine how much the imputed values would need to change before the study conclusion changes.
Tipping Point Analysis
A tipping-point analysis systematically varies assumptions about the missing outcomes.
For example:
| Scenario | Delta | Conclusion |
|---|---|---|
| Favorable | +3 | Significant |
| Primary MAR | 0 | Significant |
| Moderate penalty | -2 | Significant |
| Strong penalty | -4 | Not significant |
If the treatment conclusion changes only under implausibly severe departures, the result may be considered relatively robust.
Step 21: Compare With Complete-Case Analysis
A useful diagnostic is to compare the primary multiple-imputation analysis with a complete-case analysis.
complete_dat <- dat[
complete.cases(dat[, c("week8", "trt", "baseline")]),
]
cc_fit <- lm(
week8 ~ trt + baseline,
data = complete_dat
)
summary(cc_fit)
This is not necessarily the preferred primary analysis.
It is a useful comparison.
Step 22: Compare Observed and Imputed Relationships
A particularly useful diagnostic is to check whether the imputation model preserves relationships among variables.
Suppose baseline disease severity strongly predicts Week 8 outcome. The imputed observations should generally reflect that relationship.
A model that reproduces marginal distributions but destroys important covariate relationships can still be inadequate.
Step 23: Check Plausibility of Imputed Values
Clinical variables often have natural limits. For example, a percentage cannot be below 0 or above 100.
A score may have a fixed minimum and maximum.
A count cannot be negative.
If the imputation model generates impossible values, the imputation model needs to be reconsidered.
Potential solutions include:
- Predictive mean matching
- Transformation of the outcome
- Appropriate bounded distributions
- Two-part models for semicontinuous variables
- Ordinal models for ordered outcomes
Step 24: Categorical Variables
Suppose a variable contains three unordered categories:
| Code | Category |
|---|---|
| 1 | Mild |
| 2 | Moderate |
| 3 | Severe |
If the categories are genuinely unordered, an ordinal model may be inappropriate.
For an unordered categorical variable with multiple levels,
polyreg is commonly used.
meth["severity"] <- "polyreg"
If the categories are genuinely ordered, such as:
\[ \text{mild} < \text{moderate} < \text{severe} \]
then an ordinal method such as polr may be
appropriate.
Step 25: Binary Variables
For a binary variable, such as treatment response:
\[ Y\in\{0,1\} \]logistic regression is a natural imputation model.
meth["response"] <- "logreg"
This avoids treating a binary outcome as though it were a normally distributed continuous variable.
Step 26: Imputing Treatment or Baseline Covariates
Randomized treatment assignment is usually fully observed and should not be imputed.
Likewise, variables that are fully observed should generally have no imputation method assigned.
If baseline covariates themselves contain missing values, however, they may need to be imputed.
The imputation strategy should reflect the variable's measurement scale and its role in the final analysis.
Passive Imputation
Sometimes a variable is deterministically derived from another variable. For example:
\[ \text{BMI} = \frac{\text{weight}}{\text{height}^2} \]If height and weight are imputed, BMI should generally be recalculated from the imputed components rather than independently imputed as a third variable.
This is an example of passive imputation.
Step 27: A More Complete Clinical-Trial Imputation Setup
A realistic clinical-trial imputation model might contain:
- Treatment assignment
- Baseline outcome
- Baseline prognostic factors
- Previous post-baseline outcomes
- Later observed outcomes
- Variables associated with dropout
- Relevant auxiliary variables
For example:
vars <- c( "trt", "age", "baseline", "week4", "week8", "week12" ) imp_dat <- dat[, vars] ini <- mice( imp_dat, maxit = 0, printFlag = FALSE ) meth <- ini$method pred <- ini$predictorMatrix meth["week4"] <- "pmm" meth["week8"] <- "pmm" meth["week12"] <- "pmm" pred[, "trt"] <- 1 pred[, "age"] <- 1 pred[, "baseline"] <- 1 imp <- mice( imp_dat, m = 50, method = meth, predictorMatrix = pred, maxit = 20, seed = 2026 )
Step 28: Analyze a Treatment Effect
Suppose the primary endpoint is Week 12.
fit <- with(
imp,
lm(
week12 ~ trt + baseline
)
)
pooled <- pool(fit)
summary(
pooled,
conf.int = TRUE
)
The coefficient for trt estimates the adjusted
treatment effect.
Step 29: Extract the Pooled Estimate
The pooled result can be converted into a data frame:
results <- summary( pooled, conf.int = TRUE ) results
You can then identify the treatment row:
results[ results$term == "trt", ]
This provides a reproducible pathway from imputation to the final treatment effect.
Step 30: Reproducibility
Always set a random seed for an analysis intended to be reproducible.
set.seed(2026)
or specify the seed directly in mice():
imp <- mice( dat, m = 50, maxit = 20, seed = 2026 )
The exact imputed values can depend on the software version, random-number implementation, model settings, and analysis environment.
Therefore, the analysis should preserve the code, software environment, package versions, and analysis datasets.
Common Mistake: Imputing the Outcome Separately by Treatment Without a Reason
Investigators sometimes create completely separate imputation models for the treatment groups without considering whether this is necessary.
In a randomized trial, treatment assignment should generally be incorporated into the imputation model.
Whether separate imputation models by treatment group are scientifically appropriate depends on the estimand, data structure, and assumed conditional relationships.
The decision should be justified rather than made automatically.
Common Mistake: Leaving Important Predictors Out
Suppose dropout is strongly related to baseline disease severity. If baseline severity is omitted from the imputation model, the imputation may fail to represent the observed missingness process adequately.
The imputation model should therefore include important predictors of both missingness and the incomplete variable whenever possible.
Common Mistake: Using the Wrong Variable Type
Do not automatically use a normal continuous imputation model for every variable.
For example:
| Variable | Potential Method |
|---|---|
| Continuous score | pmm |
| Binary response | logreg |
| Unordered categorical variable | polyreg |
| Ordered categorical variable | polr |
The measurement scale matters.
Common Mistake: Imputing the ID
Patient identifiers should not be imputed as though they were clinical variables.
If the ID is complete, it should simply remain unchanged.
pred[, "id"] <- 0 meth["id"] <- ""
Common Mistake: Ignoring Convergence
Running mice() successfully does not guarantee
that the imputation model is appropriate.
Always inspect:
- Trace plots
- Distributional diagnostics
- Ranges of imputed values
- Observed-versus-imputed relationships
- Warnings generated by the model
Common Mistake: Treating MAR as a Fact
MAR is an assumption about the missingness mechanism.
It cannot generally be verified from the observed data alone because the missing outcomes are precisely the values that are unavailable.
Therefore, a good analysis distinguishes:
- The primary assumption
- The sensitivity assumptions
- The scientific rationale for each assumption
Common Mistake: Reporting Only the Imputed Estimate
A clinical-trial report should explain more than: "Multiple imputation was performed."
Readers should be able to understand:
- How many imputations were generated
- Which variables were imputed
- Which methods were used
- Which predictors were included
- How treatment assignment was handled
- How the analysis model was fitted
- How results were pooled
- What sensitivity analyses were performed
Reporting the Number of Imputations
The report should explicitly state \(m\).
For example:
Reporting the Imputation Model
The imputation model should be sufficiently described to allow a statistician to understand the analysis.
For example:
- Variable types
- Imputation methods
- Predictors
- Number of imputations
- Number of iterations
- Random seed where relevant
- Handling of transformations
- Handling of derived variables
Reporting Sensitivity Analyses
If MAR is the primary assumption, sensitivity analyses should describe how departures from MAR were constructed.
For example:
\[ Y_{\mathrm{imp}}^{*} = Y_{\mathrm{imp}}+\delta \]The report should explain:
- The values of \(\delta\)
- Why those values were clinically plausible
- Whether the same adjustment was applied across treatment groups
- How the final analysis was performed
- Whether the treatment conclusion changed
Multiple Imputation Versus LOCF
Last observation carried forward, or LOCF, has historically been used to replace missing longitudinal measurements.
For example:
\[ Y_{8,\mathrm{imputed}} = Y_{4,\mathrm{observed}} \]This assumes that the patient's outcome would remain exactly at the last observed value.
That assumption is usually difficult to justify.
LOCF also treats the imputed value as known rather than uncertain.
| Feature | LOCF | Multiple Imputation |
|---|---|---|
| Uses predictors | Usually no | Yes |
| Represents uncertainty | No | Yes |
| Allows different plausible values | No | Yes |
| Model-based | Very limited | Yes |
| Useful for sensitivity analysis | Generally poor choice as a default | Yes |
Multiple Imputation Versus Mean Imputation
| Feature | Mean Imputation | Multiple Imputation |
|---|---|---|
| Uses covariates | Usually no | Yes |
| Preserves variability | Poorly | Better |
| Reflects imputation uncertainty | No | Yes |
| Supports pooled inference | No | Yes |
Multiple Imputation Versus Complete Cases
Complete-case analysis is not automatically invalid.
Under certain missing-data mechanisms and model assumptions, it can provide valid inference.
However, complete-case analysis discards observations with missing values.
If many patients are excluded, statistical efficiency can be substantially reduced.
The key issue is therefore not that complete-case analysis is always wrong, but that its validity depends on assumptions that should be evaluated in the context of the study.
Multiple Imputation and MMRM
Multiple imputation is not the only way to handle incomplete longitudinal outcomes.
A mixed model for repeated measures, or MMRM, directly models the observed longitudinal outcomes under assumptions about the mean structure and covariance structure.
Under appropriate conditions, likelihood-based longitudinal models can use all available observations without explicitly imputing each missing value.
When Multiple Imputation Is Especially Useful
Multiple imputation is particularly useful when:
- Several variables contain missing values.
- Important predictors of missingness are observed.
- The missing-data mechanism can plausibly be represented using an imputation model.
- The analysis requires a complete analysis dataset.
- Sensitivity analyses around the primary missing-data assumption are desired.
When Multiple Imputation Requires Extra Care
Additional statistical expertise may be required for:
- MNAR sensitivity analyses
- Intercurrent events
- Longitudinal hierarchical data
- Clustered studies
- Survival outcomes
- Repeated binary outcomes
- Truncated or bounded measurements
- Nonlinear transformations
- Derived variables
- Complex treatment-policy estimands
Multiple Imputation for Survival Outcomes
Time-to-event outcomes require special consideration.
Simply applying a standard continuous-variable imputation method to a survival time can produce invalid results.
The imputation model should respect:
- Event indicators
- Censoring
- Follow-up time
- Covariate relationships
- The estimand
For many survival analyses, a direct likelihood-based or survival-modeling approach may be preferable to naive imputation of survival times.
Step 31: Save the Imputation Object
For a reproducible analysis, the imputation object can be saved:
saveRDS( imp, file = "multiple_imputation_object.rds" )
It can later be restored with:
imp <- readRDS( "multiple_imputation_object.rds" )
In a validated clinical-trial programming environment, the analysis dataset, program code, logs, outputs, software versions, and configuration should all be managed according to the applicable organizational validation and reproducibility procedures.
Step 32: Create a Reproducible Analysis Script
A clean analysis script can follow this structure:
# 1. Load packages
library(mice)
# 2. Read analysis data
dat <- read.csv("analysis_data.csv")
# 3. Inspect missingness
summary(dat)
colSums(is.na(dat))
md.pattern(dat)
# 4. Initialize mice
ini <- mice(
dat,
maxit = 0,
printFlag = FALSE
)
# 5. Define methods
meth <- ini$method
# 6. Define predictor matrix
pred <- ini$predictorMatrix
# 7. Remove nonclinical predictors
pred[, "id"] <- 0
# 8. Run multiple imputation
imp <- mice(
dat,
m = 50,
method = meth,
predictorMatrix = pred,
maxit = 20,
seed = 2026
)
# 9. Diagnose
plot(imp)
# 10. Fit analysis model
fit <- with(
imp,
lm(week8 ~ trt + baseline)
)
# 11. Pool results
pooled <- pool(fit)
# 12. Display final results
summary(
pooled,
conf.int = TRUE
)
A Complete End-to-End Example
The following compact example puts the major steps together.
library(mice) set.seed(2026) # Example data n <- 120 dat <- data.frame( id = 1:n, trt = rbinom(n, 1, 0.5), age = round(rnorm(n, 60, 10)), baseline = round(rnorm(n, 50, 12)), week4 = round(rnorm(n, 43, 13)), week8 = round(rnorm(n, 40, 14)) ) # Introduce illustrative missingness dat$week4[sample(1:n, 18)] <- NA dat$week8[sample(1:n, 25)] <- NA # Inspect colSums(is.na(dat)) md.pattern(dat) # Initialize ini <- mice( dat, maxit = 0, printFlag = FALSE ) meth <- ini$method pred <- ini$predictorMatrix # ID is not a predictor pred[, "id"] <- 0 # Continuous variables meth["week4"] <- "pmm" meth["week8"] <- "pmm" # Multiple imputation imp <- mice( dat, m = 50, method = meth, predictorMatrix = pred, maxit = 20, seed = 2026 ) # Diagnostics plot(imp) densityplot(imp, ~ week8) # Analysis fit <- with( imp, lm(week8 ~ trt + baseline) ) # Pool pooled <- pool(fit) # Final results summary( pooled, conf.int = TRUE )
How to Think About the Entire Workflow
The complete multiple-imputation process can be viewed as a chain:
What Multiple Imputation Does—and Does Not—Do
| Multiple Imputation Does | Multiple Imputation Does Not |
|---|---|
| Use observed information to generate plausible missing values | Recover the actual unobserved values |
| Propagate imputation uncertainty | Prove that MAR is true |
| Allow analysis of multiple completed datasets | Eliminate bias under an incorrect model |
| Support sensitivity analyses | Automatically define the estimand |
| Use information from incomplete records | Guarantee valid inference for every missing-data problem |
Quality-Control Checklist
Before finalizing a multiple-imputation analysis, ask:
- Have the missing-data patterns been examined?
- Is the estimand clearly defined?
- Is the primary missing-data assumption documented?
- Are important predictors of missingness included?
- Are important predictors of the incomplete outcome included?
- Is treatment assignment included where appropriate?
- Are variable types correctly specified?
- Are deterministic transformations handled appropriately?
- Are imputation diagnostics acceptable?
- Are imputed values clinically plausible?
- Is the number of imputations adequate?
- Are all completed datasets analyzed?
- Are results pooled correctly?
- Are sensitivity analyses prespecified?
- Can the analysis be reproduced from the stored code and data?
Common Clinical-Trial Reporting Errors
- Calling single imputation "multiple imputation." Replacing each missing value once does not constitute multiple imputation.
- Not specifying the number of imputations. The value of \(m\) should be reported.
- Failing to describe the imputation model. Readers need to know which variables and methods were used.
- Using an analysis model that is inconsistent with the estimand. The missing-data strategy must support the scientific question.
- Ignoring diagnostics. A successful software run is not proof that the imputation model is adequate.
- Ignoring sensitivity analyses. MAR should generally be treated as a modeling assumption requiring scientific justification and, where appropriate, sensitivity analysis.
- Analyzing only one completed dataset. This discards between-imputation uncertainty.
- Pooling incorrectly. The individual model results should be combined using appropriate multiple- imputation inference rather than simply averaging p-values.
- Imputing variables without respecting their measurement scale. Binary, ordinal, categorical, continuous, and bounded variables may require different models.
Practical R Template
For many continuous-outcome problems, the following provides a useful starting framework:
library(mice)
# Inspect
md.pattern(dat)
# Initialize
ini <- mice(
dat,
maxit = 0,
printFlag = FALSE
)
# Extract defaults
meth <- ini$method
pred <- ini$predictorMatrix
# Do not use ID as a predictor
pred[, "id"] <- 0
# Example methods
meth["continuous_variable"] <- "pmm"
meth["binary_variable"] <- "logreg"
meth["categorical_variable"] <- "polyreg"
# Impute
imp <- mice(
dat,
m = 50,
method = meth,
predictorMatrix = pred,
maxit = 20,
seed = 2026
)
# Diagnose
plot(imp)
# Analyze
fit <- with(
imp,
lm(
outcome ~ treatment + baseline
)
)
# Pool
results <- pool(fit)
summary(
results,
conf.int = TRUE
)
Multiple Imputation in a Clinical-Trial Programming Pipeline
In a production clinical-trial environment, multiple imputation is only one component of the analysis pipeline.
A typical workflow may look like:
Why Multiple Imputation Is More Than an R Function
The command:
mice(dat)
is easy to execute.
The difficult part is deciding whether the resulting imputation model is scientifically defensible.
A statistically sophisticated implementation can still be inappropriate if:
- The wrong estimand is targeted.
- Important predictors are omitted.
- The wrong variable type is modeled.
- Intercurrent events are ignored.
- The MAR assumption is implausible.
- Sensitivity analyses are inadequate.
The software is therefore only the implementation layer.
mice().
Final Practical Checklist
| Question | What to Check |
|---|---|
| What is missing? | Variables, amounts, and patterns of missingness |
| Why is it missing? | Clinical and operational reasons for missingness |
| What is the estimand? | Target treatment effect and intercurrent-event strategy |
| What is the primary assumption? | Usually a scientifically justified MAR model for the primary analysis |
| Which variables predict missingness? | Include relevant observed predictors |
| Which variables predict the outcome? | Include important prognostic variables |
| Which imputation method? | Match the variable's measurement scale |
| How many imputations? | Use enough to control Monte Carlo error |
| Did the algorithm converge? | Inspect trace plots |
| Are imputed values plausible? | Check distributions, ranges, and relationships |
| How are results analyzed? | Fit the same prespecified analysis to every imputed dataset |
| How are results combined? | Use Rubin's rules through appropriate pooling procedures |
| Is the conclusion robust? | Perform appropriate sensitivity analyses |
Worked Example Summary
For the example in this tutorial, the workflow is:
| Component | Example Choice |
|---|---|
| Software | R |
| Primary package | mice |
| Missing continuous outcomes | Predictive mean matching |
| Number of imputations | 50 |
| Iterations | 20 |
| Predictors | Treatment, baseline variables, and relevant clinical measurements |
| Primary analysis | Baseline-adjusted linear regression |
| Pooling | Rubin's rules |
| Primary assumption | MAR |
| Sensitivity analysis | Explore plausible departures from MAR |
The Most Important Concept
The most important idea is that multiple imputation is not the process of guessing what the missing observations "really were."
Instead, it recognizes that the missing value is uncertain.
If several values are plausible given the observed data, multiple imputation allows those possibilities to be represented across multiple completed datasets.
The analysis is then performed across all of those datasets, and the results are combined.
Mathematically, the final estimate is approximately the average of the individual estimates:
\[ \bar{\theta} = \frac{1}{m} \sum_{j=1}^{m} \hat{\theta}_j \]while the variance includes both within-imputation and between-imputation uncertainty:
\[ T = \bar{U} + \left(1+\frac{1}{m}\right)B \]That second component is crucial.
It prevents the analysis from behaving as though the imputed values were actually observed.
References
Rubin, D.B. (1987).
Multiple Imputation for Nonresponse in Surveys.
John Wiley & Sons.
Little, R.J.A. & Rubin, D.B. (2019).
Statistical Analysis with Missing Data.
3rd ed. Wiley.
van Buuren, S. (2018).
Flexible Imputation of Missing Data.
2nd ed. Chapman & Hall/CRC.
White, I.R., Royston, P. & Wood, A.M. (2011).
Multiple imputation using chained equations: Issues and guidance for
practice.
Statistics in Medicine, 30, 377–399.
van Buuren, S. & Groothuis-Oudshoorn, K. (2011).
mice: Multivariate Imputation by Chained Equations in R.
Journal of Statistical Software, 45(3), 1–67.
Carpenter, J.R. & Kenward, M.G. (2013).
Multiple Imputation and its Application.
Wiley.
National Research Council. (2010).
The Prevention and Treatment of Missing Data in Clinical Trials.
National Academies Press.
ICH E9(R1) (2019).
Addendum on Estimands and Sensitivity Analysis in Clinical Trials to
the Guideline on Statistical Principles for Clinical Trials.
International Council for Harmonisation.