Signature
mu_tilde = tau * mu_last + (1 - tau) * mu_end; bias_mu = tau * (mu_last - mu_end)
| Inputs | Definition | Unit |
|---|---|---|
tau | Fraction of the arm whose final-visit value is missing and replaced by the value from the earlier visit | proportion from 0 to 1 |
mu_last | Mean outcome at the earlier visit, the last visit before dropout, whose values are carried forward | the outcome's unit |
mu_end | Mean outcome at the final visit that would be seen if every participant were followed | the outcome's unit |
mu_tilde | Expected mean of the observed and imputed final-visit values in one arm | the outcome's own unit, for example utility on the scale where 1 is full health |
|---|---|---|
bias_mu | Expected analysed mean minus the true final-visit mean. A positive value means LOCF overstates the mean | the outcome's unit |
Function
Last observation carried forward imputation and the bias it adds to an analysed mean
Maps a participant's last observed value to every later scheduled visit, so that the value used at visit k is the value recorded at the last completed visit d whenever k is after d, and then maps the fraction of each arm imputed this way, with the true means at the last observed visit and at the final visit, to the expected mean and between-arm difference that the completed data return. The difference between those expected values and the true final-visit values is the bias that the imputation adds. Trapezoidal QALYs reuse HE-FM-QALY-002 and the cost-effectiveness ratio reuses HE-FM-ICER-001; this package adds the mixture mean, the between-arm bias under unequal dropout and a function that carries both into incremental QALYs and the ICER.
Computational function
Computational function: incremental QALYs and ICER after LOCF from arm utility means and dropout fractions
Takes the inputs a trial-based cost-effectiveness analysis holds, each arm's mean utility at baseline, 6 months and 12 months with complete follow-up, each arm's fraction of dropouts after the 6-month visit and the incremental cost, and returns the incremental QALYs and ICER with complete data and after LOCF. It applies HE-FM-LOCF-001 to each arm's 12-month mean, then the trapezoidal QALY formula HE-FM-QALY-002 with visits at 0, 0.5 and 1 year, where QALYs are 0.25 times the sum of the baseline mean, twice the 6-month mean and the 12-month mean, and then the ICER of HE-FM-ICER-001. Comparing the two ICERs shows how far the imputation alone moves the result.
Inputs and outputs:
u_T_0,u_T_6,u_T_12: Treatment arm mean utilities at baseline, 6 and 12 months with complete follow-up; required. Unit: utility, 1 being full health.;u_C_0,u_C_6,u_C_12: The same for the control arm. Unit: utility.;tau_T,tau_C: Fractions of each arm that stop after the 6-month visit and are carried forward; required, 0 to 1. Unit: proportion.;dC: Incremental cost per patient, treatment minus control, observed for everyone; required. Unit: currency per patient.;u_T_12_LOCF,u_C_12_LOCF: Analysed 12-month means after LOCF. Unit: utility.;dQ_full,dQ_LOCF: Incremental QALYs per patient with complete data and after LOCF. Unit: QALYs.;ICER_full,ICER_LOCF: Incremental cost per QALY with complete data and after LOCF. Unit: currency per QALY.Assumption: Dropout after the 6-month visit is completely at random within each arm, everyone who stops was alive and last observed at 6 months, and costs are complete. Mean utilities at baseline and 6 months are observed for everyone, so the imputation changes only the 12-month means.
Worked example (Article's trial with 40% and 10% dropout): The article's illustrative trial gives 0.035 incremental QALYs and about GBP 42,857 per QALY with complete data, but 0.0375 QALYs and GBP 40,000 per QALY after LOCF.
u_T_0 = 0.70; u_T_6 = 0.68; u_T_12 = 0.64; u_C_0 = 0.70; u_C_6 = 0.64; u_C_12 = 0.58; tau_T = 0.4; tau_C = 0.1; dC = 1500; u_T_12_LOCF = 0.656; u_C_12_LOCF = 0.586; dQ_full = 0.035; dQ_LOCF = 0.0375; ICER_full = 42857.14; ICER_LOCF = 40000Worked example (Same trial with 25% dropout in each arm): With equal dropout the widening difference is understated instead: 0.03375 incremental QALYs and about GBP 44,444 per QALY after LOCF (computed here for illustration).
u_T_0 = 0.70; u_T_6 = 0.68; u_T_12 = 0.64; u_C_0 = 0.70; u_C_6 = 0.64; u_C_12 = 0.58; tau_T = 0.25; tau_C = 0.25; dC = 1500; u_T_12_LOCF = 0.65; u_C_12_LOCF = 0.595; dQ_full = 0.035; dQ_LOCF = 0.03375; ICER_full = 42857.14; ICER_LOCF = 44444.44Worked example (No dropout returns the complete-data result): With no dropout in either arm the LOCF results equal the complete-data results, a limiting case that checks the implementation.
u_T_0 = 0.70; u_T_6 = 0.68; u_T_12 = 0.64; u_C_0 = 0.70; u_C_6 = 0.64; u_C_12 = 0.58; tau_T = 0; tau_C = 0; dC = 1500; u_T_12_LOCF = 0.64; u_C_12_LOCF = 0.58; dQ_full = 0.035; dQ_LOCF = 0.035; ICER_full = 42857.14; ICER_LOCF = 42857.14Excel:
=IncCost/(0.25*(UtilT0+2*UtilT6+(TauT*UtilT6+(1-TauT)*UtilT12))-0.25*(UtilC0+2*UtilC6+(TauC*UtilC6+(1-TauC)*UtilC12)))With the mean utilities in cells named UtilT0 to UtilC12, the dropout fractions in TauT and TauC and dC in IncCost, the formula returns ICER_LOCF; setting TauT and TauC to 0 returns ICER_full.R:
locf_icer <- function(u_T, u_C, tau_T, tau_C, dC, t = c(0, 0.5, 1)) { K <- length(t); w <- (c(diff(t), 0) + c(0, diff(t))) / 2; aT <- sum(w * u_T); aC <- sum(w * u_C); bT <- aT + w[K] * tau_T * (u_T[K-1]-u_T[K]); bC <- aC + w[K] * tau_C * (u_C[K-1]-u_C[K]); c(dQ_full = aT-aC, dQ_LOCF = bT-bC, ICER_full = dC / (aT-aC), ICER_LOCF = dC / (bT-bC)) }Takes each arm's mean utilities at visit times t, in years, and carries the second-last visit forward into the last for the stated fractions.Python:
def locf_icer(u_T, u_C, tau_T, tau_C, dC, t=(0, 0.5, 1)): K = len(t); w = [((t[k]-t[k-1]) if k > 0 else 0) / 2 + ((t[k+1]-t[k]) if k < K-1 else 0) / 2 for k in range(K)]; aT = sum(wk * uk for wk, uk in zip(w, u_T)); aC = sum(wk * uk for wk, uk in zip(w, u_C)); bT = aT + w[-1] * tau_T * (u_T[-2]-u_T[-1]); bC = aC + w[-1] * tau_C * (u_C[-2]-u_C[-1]); return {'dQ_full': aT-aC, 'dQ_LOCF': bT-bC, 'ICER_full': dC / (aT-aC), 'ICER_LOCF': dC / (bT-bC)}The same steps in plain Python for any visit schedule.Test (Article's ICERs reproduced): The complete-data and LOCF ICERs round to GBP 42,857 and GBP 40,000 per QALY. Expected result: TRUE. Excel check:
=AND(ROUND(1500/(0.25*(0.70+2*0.68+0.64)-0.25*(0.70+2*0.64+0.58)),0)=42857,ROUND(1500/(0.25*(0.70+2*0.68+0.656)-0.25*(0.70+2*0.64+0.586)),0)=40000)Test (LOCF shift in incremental QALYs equals the weighted arm biases): dQ_LOCF minus dQ_full equals 0.25 times the bias of the 12-month difference from HE-FM-LOCF-002, 0.25 times 0.010. Expected result: TRUE. Excel check:
=ABS((0.25*(0.656-0.586)-0.25*(0.64-0.58))-0.25*(0.4*(0.68-0.64)-0.1*(0.64-0.58)))<1E-9Common error (Carrying a utility forward past death): Values after death are not missing data. Carrying the last utility forward for a participant who died credits QALYs that were never lived; the function applies only to living participants who stopped providing data.
Common error (Reading the LOCF ICER as precise): The imputed values carry no uncertainty, so a standard error, confidence interval or acceptability curve computed from LOCF-completed QALYs can be too narrow. The National Research Council panel notes that LOCF may understate uncertainty when imputed values feed an area under the curve, and Faria and colleagues advise against last-value carried forward for missing outcomes in cost-effectiveness analysis.
Source: Lachin JM. Fallacies of last observation carried forward analyses. Clinical Trials. 2016;13(2):161-168. Equations 1 and 4. Faria R, Gomes M, Epstein D, White IR. A guide to handling missing data in cost-effectiveness analysis conducted within randomised controlled trials. PharmacoEconomics. 2014;32(12):1157-1170. Introduction on QALYs as cumulative measures built from longitudinal data and the checklist item advising that last-value carried forward be avoided.
u_T_12_LOCF = tau_T * u_T_6 + (1 - tau_T) * u_T_12; u_C_12_LOCF = tau_C * u_C_6 + (1 - tau_C) * u_C_12; dQ_full = 0.25 * (u_T_0 + 2 * u_T_6 + u_T_12) - 0.25 * (u_C_0 + 2 * u_C_6 + u_C_12); dQ_LOCF = 0.25 * (u_T_0 + 2 * u_T_6 + u_T_12_LOCF) - 0.25 * (u_C_0 + 2 * u_C_6 + u_C_12_LOCF); ICER_full = dC / dQ_full; ICER_LOCF = dC / dQ_LOCF
Try this function
Implementations
Excel
LOCF mixture mean and its bias from named cells
With the fraction imputed in a cell named Tau, the earlier-visit mean in MuLast and the true final mean in MuEnd, the first formula, in a cell named MuTilde, returns the analysed mean and the second, in a cell named BiasMu, its bias.
=Tau*MuLast+(1-Tau)*MuEnd; =Tau*(MuLast-MuEnd)
Assumptions
Final-visit values missing completely at random for the LOCF mixture mean
Whether a final-visit value is missing does not depend on the earlier value or on the true final value, so the carried-forward values are a random draw from the earlier visit and the missing values a random draw from the final visit. Lachin shows the same mean whether tau is fixed or random. When dropout is not random, the same mixture holds only with the unobservable means of the dropouts' own earlier and final values (Lachin 2016, equation 3), so the bias cannot be computed from the data.
All imputed values carried from one earlier visit
Every participant with a missing final value was last observed at the same earlier visit, as in Lachin's two-visit model and the article's example. Where dropouts were last seen at different visits, each group carries its own earlier mean and the formula is applied to each group in turn.
Worked examples
LOCF mean in the treatment arm with 40% dropout after six months
In the article's illustrative trial, 40% of the treatment arm stop after the 6-month visit, where the mean utility is 0.68, against a true 12-month mean of 0.64. LOCF returns an analysed 12-month mean of 0.656, an upward bias of 0.016 in a deteriorating condition.
tau = 0.4; mu_last = 0.68; mu_end = 0.64; mu_tilde = 0.656; bias_mu = 0.016
LOCF mean in the control arm with 10% dropout after six months
In the control arm 10% stop after the 6-month visit, where the mean is 0.64, against a true 12-month mean of 0.58. The analysed mean is 0.586, an upward bias of 0.006, smaller than in the treatment arm because fewer values are imputed.
tau = 0.1; mu_last = 0.64; mu_end = 0.58; mu_tilde = 0.586; bias_mu = 0.006
LOCF mean when the earlier visit shows a decline that later reverses
Lachin's case 6: 30% of final values are imputed from an earlier visit with a mean change from baseline of minus 1, while the true final mean change is 1. The analysed mean change is diluted to 0.4, a bias of minus 0.6.
tau = 0.3; mu_last = -1; mu_end = 1; mu_tilde = 0.4; bias_mu = -0.6
LOCF mean with no true change at the final visit
Lachin's case 3: the true final mean change is 0 but the earlier mean is 1, so with 30% imputed the analysed mean is 0.3. In Lachin's setting, with n = 100 and variance 20 at both visits, a one-sided test of no change at the 0.05 level then rejects with probability 0.164 instead of the nominal 0.05.
tau = 0.3; mu_last = 1; mu_end = 0; mu_tilde = 0.3; bias_mu = 0.3
Common errors
Treating LOCF as unbiased because data are missing completely at random
Random dropout does not remove the bias: in the article's treatment arm dropout is unrelated to utility, yet LOCF overstates the 12-month mean by 0.016 because the mean falls between 6 and 12 months. The completers alone would recover the true mean of 0.64 in this case. The National Research Council panel notes that LOCF is sometimes mistakenly considered valid under missing completely at random or missing at random data.
Calling LOCF conservative in a deteriorating condition
When the outcome worsens over time, mu_last is above mu_end and the bias tau times their difference is positive in every arm, so LOCF makes each arm look better than it is. The EMA guideline describes LOCF in Alzheimer's disease as very likely to be overly optimistic in both arms, and not appropriate where active-arm participants withdraw earlier.
Sources
Lachin mixture mean of observed and LOCF-imputed values
Lachin JM. Fallacies of last observation carried forward analyses. Clinical Trials. 2016;13(2):161-168. Section on one-sample biases under missing completely at random data, equation 1 and Table 1; the abstract states that LOCF is unbiased only when the carried-forward values share the distribution of the missing final values.
National Research Council statement of the LOCF no-change assumption
National Research Council, Panel on Handling Missing Data in Clinical Trials. The Prevention and Treatment of Missing Data in Clinical Trials. Washington, DC: National Academies Press; 2010. Chapter 4, example on LOCF imputation: the strong assumption that the outcome does not change after dropout, the predicted final value equal to the previous value with zero variance, and the MNAR assumption this implies.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0