REGRESSION MODELLING FOR HEALTH PRACTITIONERS · CHAPTER 12
Handling Missing Data
Missing data are ubiquitous in health research. Patients may fail to attend follow‑up visits, surveys may have unanswered questions and laboratory measurements may be lost. Ignoring missingness or using ad hoc methods can bias estimates and reduce power. This chapter introduces the mechanisms that generate missing values and outlines principled approaches for handling them.
Types of Missingness
Rubin’s taxonomy distinguishes three mechanisms by which data may be missing. When data are missing completely at random (MCAR) the probability of a value being missing does not depend on either observed or unobserved data. Skipping a survey question unintentionally is a classic MCAR example. Under MCAR the absence of data occurs randomly and simple methods like listwise deletion or mean imputation do not introduce bias. When data are missing at random (MAR), the missingness can be explained by observed variables but is not related to the unobserved value itself. For example, younger participants might be less likely to report smoking status, regardless of how much they smoke. MAR requires more sophisticated methods, such as maximum likelihood estimation or multiple imputation, to avoid biased inferences. Finally, missing not at random (MNAR) occurs when the probability of missingness depends on the unobserved value; heavy smokers intentionally withholding their smoking habits would be an example. MNAR is the most challenging situation, requiring explicit modelling of the missingness mechanism or sensitivity analyses.
Methods for Handling Missing Data
There is no one‑size‑fits‑all solution to missing data. The appropriate approach depends on the missingness mechanism, the extent of missing data and the research question.
Listwise deletion: Drop any individual with missing values. This method is simple and valid under MCAR but can result in substantial information loss and biased estimates under MAR or MNAR.
Single imputation: Replace missing values with the mean, median or a predicted value from other variables. Single imputation underestimates variability because it treats imputed values as known and can bias associations when missingness is related to covariates.
Multiple imputation: Create several complete datasets by replacing missing values with draws from an appropriate predictive distribution. Each dataset is analysed separately and results are combined using Rubin’s rules. Multiple imputation assumes MAR and produces unbiased estimates with appropriate standard errors when the imputation model is correctly specified.
Maximum likelihood: Fit models directly using all available data and the likelihood function (e.g., via expectation–maximisation). Under MAR this yields consistent estimates.
Weighting and inverse probability weighting: Assign higher weights to complete cases that resemble incomplete cases. This can reduce bias when missingness depends on observed variables.
Worked Example
Suppose a cohort study records body mass index (BMI) and systolic blood pressure for 200 participants but 15% of BMI values are missing at random. We wish to estimate the association between BMI and systolic blood pressure. We compare listwise deletion and multiple imputation.
Worked example
R (using the mice package):
library(mice)
data <- read.csv("bmi_bp.csv") # hypothetical dataset
## Listwise deletion
fit_cc <- lm(SBP ~ BMI, data = data, na.action = na.omit)
## Multiple imputation with 5 imputations
imp <- mice(data, m = 5, method = "pmm", seed = 123)
fit_imp <- with(imp, lm(SBP ~ BMI))
pooled <- pool(fit_imp)
summary(pooled)
Python (using scikit_learn and
statsmodels):
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.impute import KNNImputer
import statsmodels.api as sm
data = pd.read_csv("bmi_bp.csv")
## Listwise deletion
complete_cases = data.dropna(subset=["BMI"])
X = sm.add_constant(complete_cases[["BMI"]])
y = complete_cases["SBP"]
model = sm.OLS(y, X).fit()
print(model.summary())
## KNN imputation followed by regression
imputer = KNNImputer(n_neighbors=5)
data_imputed = data.copy()
data_imputed[["BMI"]] = imputer.fit_transform(data_imputed[["BMI"]])
X_imp = sm.add_constant(data_imputed[["BMI"]])
y_imp = data_imputed["SBP"]
model_imp = sm.OLS(y_imp, X_imp).fit()
print(model_imp.summary())
Julia (using Impute.jl and
GLM.jl):
using CSV, DataFrames, Impute, GLM, Statistics
data = CSV.read("bmi_bp.csv", DataFrame)
## Listwise deletion
complete_cases = dropmissing(data, :BMI)
model_cc = lm(@formula(SBP ~ BMI), complete_cases)
println(coef(model_cc))
## Mean imputation
data_imp = copy(data)
data_imp.BMI = Impute.fill(data_imp.BMI, Impute.mean)
model_imp = lm(@formula(SBP ~ BMI), data_imp)
println(coef(model_imp))
The results from multiple imputation generally yield similar point estimates to listwise deletion but with smaller standard errors, reflecting more efficient use of the available information.
Interpretation
Identify the missingness mechanism in your data: if the missing values are plausibly independent of both observed and unobserved variables (MCAR), simple methods may suffice. When missingness depends on observed variables (MAR), multiple imputation or likelihood‑based approaches are preferred. If missingness may depend on the unobserved value itself (MNAR), conduct sensitivity analyses to assess how conclusions vary under different assumptions.
Exercises
Describe a real‑world study in your domain where missing data may arise. Classify the missingness mechanism (MCAR, MAR, MNAR) and justify your reasoning.
Simulate a dataset with 20% missing values in one predictor. Fit a linear regression model using listwise deletion and another using multiple imputation. Compare estimates and standard errors.
Using the hypothetical
bmi_bp.csvdataset, implement mean imputation and predictive mean matching in R or Python. How do the regression coefficients differ?Discuss why simple single imputation methods (e.g., mean imputation) can underestimate variability. Illustrate this with a simulation.
Code examples use illustrative datasets. Supply data with the named columns to run them.