Signature
p_L = 1 + (B - 1) * lev_L; p_U = 1 + (B - 1) * lev_U; L = th_kL + (p_L - k_L) * (th_kL1 - th_kL); U = th_kU + (p_U - k_U) * (th_kU1 - th_kU)
| Inputs | Definition | Unit |
|---|---|---|
B | Number of bootstrap replicates in the ordered list | count |
lev_L | Share of the replicate distribution left below the lower limit, alpha for the percentile method or the value of HE-FM-BOO-002 for the moved forms | probability |
lev_U | Share of the replicate distribution left below the upper limit, 1 minus alpha for the percentile method or the value of HE-FM-BOO-002 for the moved forms | probability |
th_kL | Replicate at rank k_L in the ordered list | unit of the statistic |
k_L | Integer part of p_L, the rank of the ordered replicate at or just below the lower cut | rank |
th_kL1 | Replicate at rank k_L plus 1 in the ordered list, or th_kL itself when k_L equals B | unit of the statistic |
th_kU | Replicate at rank k_U in the ordered list | unit of the statistic |
k_U | Integer part of p_U, the rank of the ordered replicate at or just below the upper cut | rank |
th_kU1 | Replicate at rank k_U plus 1 in the ordered list, or th_kU itself when k_U equals B | unit of the statistic |
p_L | Position in the ordered list, counted with the smallest replicate as 1, at which the lower limit lies | position |
|---|---|---|
p_U | Position in the ordered list, counted with the smallest replicate as 1, at which the upper limit lies | position |
L | Lower interval limit read from the ordered replicates at cut level lev_L | unit of the statistic, for example GBP |
U | Upper interval limit read from the ordered replicates at cut level lev_U | unit of the statistic, for example GBP |
Function
Bootstrap confidence interval from paired trial replicates
Maps patient-level costs and QALYs in two trial arms, a value per QALY, a replicate count and a tail probability to a confidence interval for incremental net monetary benefit read from percentiles of the replicates. Each replicate redraws whole patients with replacement within each arm, and its incremental cost, incremental effect and net benefit are differences in resampled means, the numerator and denominator of HE-FM-ICER-001 and the INMB of HE-FM-NMB-002. HE-FM-BOO-001 reads interval endpoints from the ordered replicates, HE-FM-BOO-002 moves the cut points for the bias-corrected and accelerated forms, HE-FM-BOO-003 estimates the acceleration by the jackknife and HE-CF-BOO-001 runs the resampling. The standard error from the same replicates is HE-FM-BSE-001, the normal interval built on it is HE-CF-BSE-001 and its closed form is HE-CF-BSE-002. The share of replicates with positive net benefit takes the form of HE-FM-CEAC-001, which is written for probabilistic simulations and which Fenwick, O'Brien and Briggs (HE-SR-CEAC-002) state for bootstrap replicates as well, so it is not restated. Notation follows the Bootstrapping article.
Computational function
Computational function: paired within-arm bootstrap of incremental cost, effect and net benefit with percentile limits
Runs the resampling that feeds HE-FM-BOO-001. For each of B replicates it draws patients with replacement within each arm at the original arm size, recomputes the mean cost and QALYs of each arm from the same draws, and stores the incremental cost, incremental effect and net benefit, where the net benefit is HE-FM-NMB-002 and the differences are those of HE-FM-ICER-001. It then orders the net benefit replicates and returns the percentile limits of HE-FM-BOO-001, the share below the estimate and the bias-corrected limits with HE-FM-BOO-002 at zero acceleration, the share above zero in the form of HE-FM-CEAC-001, and the number of replicates with no meaningful ICER. The calculator line runs one replicate from a fixed table of draws, and the loop and the sort are in the Excel, R and Python code.
Inputs and outputs:
c_T1toc_T8ande_T1toe_T8are the costs and QALYs of the eight patients drawn into arm T for this replicate, andc_U1toc_U8ande_U1toe_U8those drawn into arm U, in GBP and QALYs.lambdais the value of one QALY in GBP. The chain returns the resampled meansC_T,E_T,C_U,E_U, the differencesDelta_CandDelta_E, andINMBin GBP. The R and Python code take whole armscT,eT,cU,eUwithlam,B,alpha(above 0 and below 0.5) andseed, and returnINMB, the limits,G,z0, the bias-corrected limits,P_posandno_ICER.Assumption: Patients are independent within arms and the arms are resampled independently, with cost and QALYs drawn together, as in HE-AS-BSE-001 and HE-AS-BSE-006. The code rounds net benefit to 6 decimals before ordering and counting, so that replicates tied with the estimate in exact arithmetic stay tied. Each cost or QALY in a draw is an observed value, so a cost no patient incurred cannot appear.
Worked example (First replicate of the article's trial): Arm T draws patients 1, 5, 5, 7, 1, 2, 5, 5 and arm U draws 7, 5, 6, 7, 7, 5, 2, 5, the article's illustrative replicate.
c_T1 = 2600; c_T2 = 3300; c_T3 = 3300; c_T4 = 6900; c_T5 = 2600; c_T6 = 3100; c_T7 = 3300; c_T8 = 3300; e_T1 = 0.82; e_T2 = 0.81; e_T3 = 0.81; e_T4 = 0.60; e_T5 = 0.82; e_T6 = 0.76; e_T7 = 0.81; e_T8 = 0.81; c_U1 = 3200; c_U2 = 2100; c_U3 = 2400; c_U4 = 3200; c_U5 = 3200; c_U6 = 2100; c_U7 = 2300; c_U8 = 2100; e_U1 = 0.62; e_U2 = 0.73; e_U3 = 0.71; e_U4 = 0.62; e_U5 = 0.62; e_U6 = 0.73; e_U7 = 0.76; e_U8 = 0.73; lambda = 30000; C_T = 3550; E_T = 0.78; C_U = 2575; E_U = 0.69; Delta_C = 975; Delta_E = 0.09; INMB = 1725Worked example (Every patient drawn once returns the observed result): A limiting case. A draw table that holds each patient exactly once gives the observed means, the article's incremental cost of 1,350, effect of 0.06 and net benefit of 450.
c_T1 = 2600; c_T2 = 3100; c_T3 = 2900; c_T4 = 4200; c_T5 = 3300; c_T6 = 2800; c_T7 = 6900; c_T8 = 3400; e_T1 = 0.82; e_T2 = 0.76; e_T3 = 0.88; e_T4 = 0.68; e_T5 = 0.81; e_T6 = 0.85; e_T7 = 0.60; e_T8 = 0.80; c_U1 = 1900; c_U2 = 2300; c_U3 = 1700; c_U4 = 2600; c_U5 = 2100; c_U6 = 2400; c_U7 = 3200; c_U8 = 2200; e_U1 = 0.70; e_U2 = 0.76; e_U3 = 0.81; e_U4 = 0.64; e_U5 = 0.73; e_U6 = 0.71; e_U7 = 0.62; e_U8 = 0.75; lambda = 30000; C_T = 3650; E_T = 0.775; C_U = 2300; E_U = 0.715; Delta_C = 1350; Delta_E = 0.06; INMB = 450Excel: In one row per replicate fill 16 draw cells with
=RANDBETWEEN(1,ROWS(CostsT))and=RANDBETWEEN(1,ROWS(CostsU)), then paste them as values so that every later check reads a fixed table. With the row's draws named DrawsT and DrawsU,=SUMPRODUCT(COUNTIF(DrawsT,ROW(CostsT)-MIN(ROW(CostsT))+1),CostsT)/COUNT(DrawsT)returns the resampled mean cost of arm T in a cell named MeanCostT, and the same form with QALYsT, CostsU and QALYsU, using DrawsU for arm U, fills MeanQALYsT, MeanCostU and MeanQALYsU, so the draw count of each patient applies to the cost and the QALYs alike.=ThresholdValue*(MeanQALYsT-MeanQALYsU)-(MeanCostT-MeanCostU)in a cell named ReplicateINMB gives the net benefit, which is rounded and copied down the replicate rows for HE-IM-BOO-001.R:
boot_two_arm <- function(cT, eT, cU, eU, lam, B = 2000, alpha = 0.025, seed = 2026) { set.seed(seed); nT <- length(cT); nU <- length(cU); reps <- t(replicate(B, { a <- sample.int(nT, nT, TRUE); b <- sample.int(nU, nU, TRUE); c(mean(cT[a])-mean(cU[b]), mean(eT[a])-mean(eU[b])) })); nb <- round(lam*reps[, 2]-reps[, 1], 6); est <- round(lam*(mean(eT)-mean(eU))-(mean(cT)-mean(cU)), 6); G <- mean(nb < est); z0 <- if (G > 0 && G < 1) qnorm(G) else NA; bc <- if (is.na(z0)) c(NA, NA) else quantile(nb, pnorm(2*z0+c(qnorm(alpha), -qnorm(alpha))), type = 7, names = FALSE); list(INMB = est, limits = quantile(nb, c(alpha, 1-alpha), type = 7, names = FALSE), G = G, z0 = z0, BC = bc, P_pos = mean(nb > 0), no_ICER = sum(round(reps[, 1], 6)*round(reps[, 2], 9) <= 0)) }WithcT <- c(2600, 3100, 2900, 4200, 3300, 2800, 6900, 3400); eT <- c(0.82, 0.76, 0.88, 0.68, 0.81, 0.85, 0.60, 0.80); cU <- c(1900, 2300, 1700, 2600, 2100, 2400, 3200, 2200); eU <- c(0.70, 0.76, 0.81, 0.64, 0.73, 0.71, 0.62, 0.75),boot_two_arm(cT, eT, cU, eU, 30000)runs in base R. Its generator differs from Python's, so at seed 2026 it returns minus 2,650.63 and 3,212.5, P_pos 0.636 and no_ICER 101, a gap of simulation error. WithB = 100000andseed = 7it returns minus 2,775 and 3,250, and the Python code minus 2,762.5 and 3,237.5. With arms of one patient every replicate equals the estimate, soGis 0,z0is NA, the bias-corrected limits are NA and no error is raised.Python:
def boot_two_arm(cT, eT, cU, eU, lam, B=2000, alpha=0.025, seed=2026): random.seed(seed); nT, nU = len(cT), len(cU); draw = lambda n: [int(random.random()*n) for _ in range(n)]; reps = [(lambda a, b: (sum(cT[i] for i in a)/nT-sum(cU[i] for i in b)/nU, sum(eT[i] for i in a)/nT-sum(eU[i] for i in b)/nU))(draw(nT), draw(nU)) for _ in range(B)]; nb = sorted(round(lam*de-dc, 6) for dc, de in reps); pct = lambda p: (lambda pos, k: nb[k-1]+(nb[min(k, B-1)]-nb[k-1])*(pos-k))(1+(B-1)*p, int(1+(B-1)*p)); est = round(lam*(sum(eT)/nT-sum(eU)/nU)-(sum(cT)/nT-sum(cU)/nU), 6); G = sum(v < est for v in nb)/B; nd = statistics.NormalDist(); z0 = nd.inv_cdf(G) if 0 < G < 1 else None; zc = nd.inv_cdf(alpha); bc = (pct(nd.cdf(2*z0+zc)), pct(nd.cdf(2*z0-zc))) if z0 is not None else None; return {'INMB': est, 'L': pct(alpha), 'U': pct(1-alpha), 'G': G, 'z0': z0, 'BC': bc, 'P_pos': sum(v > 0 for v in nb)/B, 'no_ICER': sum(round(dc, 6)*round(de, 9) <= 0 for dc, de in reps)}Uses the random and statistics modules. On the article's data withlam = 30000it returns INMB 450, L minus 2,975, U 3,262.5, G 0.4935, z0 minus 0.0163, bias-corrected limits of about minus 2,996.4 and 3,200, P_pos 0.605 and no_ICER 127. With arms of one patient it returns z0 None and BC None without an error, andB=1returns the one replicate as both limits. Analphaof 0 raisesStatisticsErrorfrominv_cdf, whereas the R code returns the smallest and largest replicates.Test (Fixed draw table gives the article's replicate): Load the draws of the first example into DrawsT and DrawsU and read ReplicateINMB. Expected result TRUE. Doubling the cell to 3,450 or halving it to 862.5 gives FALSE, as does a cell that takes the QALY means from the undrawn arm columns (825). Excel check
=ABS(ReplicateINMB-1725)<0.5Test (Every patient once equals the observed net benefit): Load the second example's table, each patient once, and compare ReplicateINMB with net benefit computed from the arm columns without any draw table, 450. Expected result TRUE. Doubling the cell to 900 or halving it to 225 gives FALSE. Excel check
=ABS(ReplicateINMB-(ThresholdValue*(AVERAGE(QALYsT)-AVERAGE(QALYsU))-(AVERAGE(CostsT)-AVERAGE(CostsU))))<0.005Common error (Drawing costs and QALYs separately): Separate draws discard the correlation within each patient, which here is negative in both arms (about minus 0.90 in arm T and minus 0.82 in arm U, derived). Run with 2,000 replicates (Python random, seed 2026, four separate draw sets), the 95% percentile interval at 30,000 GBP per QALY narrows to minus 2,150.63 and 2,787.5, against minus 2,975 and 3,262.5 from paired draws. HE-ER-BSE-004 gives the same fault for the standard error.
Source: Briggs AH, Gray AM. Handling uncertainty when performing economic evaluation of healthcare interventions. Health Technology Assessment. 1999;3(2). Chapter 5 (page 53) sets out sampling cost and effect pairs with replacement within each arm and then calculating the statistic, and page 57 uses the replicates to estimate the joint distribution. Briggs AH, Wonderling DE, Mooney CZ. Pulling cost-effectiveness analysis up by its bootstraps: a non-parametric approach to confidence interval estimation. Health Economics. 1997;6(4):327-340. The abstract describes the construction of non-parametric bootstrap intervals from clinical trial data. Efron B. Bootstrap methods: another look at the jackknife. Annals of Statistics. 1979;7(1):1-26. Section 2 (page 3) places mass 1/n on each observation and draws a sample of size n from it.
C_T = (c_T1 + c_T2 + c_T3 + c_T4 + c_T5 + c_T6 + c_T7 + c_T8) / 8; E_T = (e_T1 + e_T2 + e_T3 + e_T4 + e_T5 + e_T6 + e_T7 + e_T8) / 8; C_U = (c_U1 + c_U2 + c_U3 + c_U4 + c_U5 + c_U6 + c_U7 + c_U8) / 8; E_U = (e_U1 + e_U2 + e_U3 + e_U4 + e_U5 + e_U6 + e_U7 + e_U8) / 8; Delta_C = C_T - C_U; Delta_E = E_T - E_U; INMB = lambda * Delta_E - Delta_C
Try this function
Implementations
Excel
Percentile limits from a replicate column by position
With the replicates in a range named Replicates and the cut levels in LevelLower and LevelUpper, the four formulas return, in order, cells named PositionLower, PositionUpper, LowerLimit and UpperLimit. SMALL returns the ordered replicate, and MIN stops the rank above from passing the end of the list when a level equals 1. COUNT and SMALL ignore blank and text cells. An empty range returns #NUM! from SMALL.
=1+(COUNT(Replicates)-1)*LevelLower; =1+(COUNT(Replicates)-1)*LevelUpper; =SMALL(Replicates,INT(PositionLower))+(PositionLower-INT(PositionLower))*(SMALL(Replicates,MIN(INT(PositionLower)+1,COUNT(Replicates)))-SMALL(Replicates,INT(PositionLower))); =SMALL(Replicates,INT(PositionUpper))+(PositionUpper-INT(PositionUpper))*(SMALL(Replicates,MIN(INT(PositionUpper)+1,COUNT(Replicates)))-SMALL(Replicates,INT(PositionUpper)))
Assumptions
Replicates copy the way the trial data arose
Each replicate comes from drawing patients with replacement within each arm at the original arm sizes, with each patient's cost and outcome kept together, as in HE-AS-BSE-001 and HE-AS-BSE-006. Clustered data need whole clusters drawn. The limits then describe sampling variation only, so unit costs not sampled, generalisability and extrapolation still need sensitivity analysis.
Enough replicates for a percentile limit
Efron and Tibshirani say B of about 250 can give a useful percentile interval. The smaller lists in the worked examples show the arithmetic only and carry no claim about coverage.
Statistic defined in every replicate
Reading percentiles needs a value in every replicate that orders in one consistent sense. Incremental net monetary benefit has this property in all four quadrants. The ICER does not, because a replicate with no change in QALYs has no ratio and a negative ratio has two opposite meanings.
Position rule for a cut that falls between two replicates
The method defines the limit as the alpha percentile of the replicate distribution. Interpolating on p = 1 + (B minus 1) times the level is the rule of Excel PERCENTILE.INC and of R quantile type 7, adopted here so that the three implementations agree. The level is at least 0 and at most 1.
Worked examples
Net benefit interval at 30,000 GBP per QALY from 2,000 replicates
The article's illustrative eight-patient trial with 2,000 replicates (Python random, seed 2026). Ranks 50 and 51 both hold minus 2,975, and ranks 1,950 and 1,951 both hold 3,262.5, so interpolation changes nothing here. The article prints the upper limit as 3,262. The interval spans zero around the observed net benefit of 450.
lev_L = 0.025; lev_U = 0.975; B = 2000; k_L = 50; k_U = 1950; th_kL = -2975; th_kL1 = -2975; th_kU = 3262.5; th_kU1 = 3262.5; p_L = 50.975; p_U = 1950.025; L = -2975; U = 3262.5
Five illustrative replicates with interpolated limits
The five invented replicates of HE-CF-BSE-001, ordered as minus 1,400, 100, 600, 1,100 and 2,600, with an 80% central interval. The lower cut falls 0.4 of the way from rank 1 to rank 2 and the upper cut 0.6 of the way from rank 4 to rank 5. Five replicates are far too few in practice.
lev_L = 0.1; lev_U = 0.9; B = 5; k_L = 1; k_U = 4; th_kL = -1400; th_kL1 = 100; th_kU = 1100; th_kU1 = 2600; p_L = 1.4; p_U = 4.6; L = -800; U = 2000
Bias-corrected limits at the cut levels of the strict count
The same 2,000 replicates read at the cut levels from the first worked example of HE-FM-BOO-002, 0.023153 and 0.973035, in place of 0.025 and 0.975. The limits become about minus 2,996 and 3,200. Inputs are the illustrative trial of the article.
lev_L = 0.023153; lev_U = 0.973035; B = 2000; k_L = 47; k_U = 1946; th_kL = -3000; th_kL1 = -2987.5; th_kU = 3200; th_kU1 = 3200; p_L = 47.2828; p_U = 1946.097; L = -2996.46; U = 3200
Identical replicates give a zero-width percentile interval
A limiting case. When every replicate equals 500, both limits equal 500 at any cut level, which checks the interpolation.
lev_L = 0.025; lev_U = 0.975; B = 3; k_L = 1; k_U = 2; th_kL = 500; th_kL1 = 500; th_kU = 500; th_kU1 = 500; p_L = 1.05; p_U = 2.95; L = 500; U = 500
Common errors
Percentiles of raw replicate ICERs mixed across quadrants
Ranking replicate ratios gives about minus 168,900 to 221,100 GBP per QALY in the article's example, where 121 of 2,000 replicates show a QALY loss and 6 show no change, so the ratio is undefined in those 6 and uninterpretable in the 121. The net benefit interval avoids this, and HE-FM-CEAC-001 gives the share at each threshold. Briggs and Gray report the ranking problem for negative ratios.
Reading alpha as the total of both tails
The central interval has coverage 1 minus 2 alpha, so a 95% interval uses alpha of 0.025 in each tail. Using 0.05 in each tail returns a 90% interval, minus 2,325.63 to 2,825.63 in the article's example against minus 2,975 to 3,262.5 at 95%.
Building net benefit limits from separate cost and effect intervals
Combining the separate percentile limits of the incremental cost (575 to 2,450) and effect (minus 0.02 to 0.12875) gives minus 3,050 and 3,287.5 at 30,000 GBP per QALY, against minus 2,975 and 3,262.5 from net benefit in each replicate, because the separate limits ignore the joint spread (derived). For the ratio, Briggs, Mooney and Wonderling found that simply combining separate intervals performed poorly.
Sources
Efron and Tibshirani percentile method for bootstrap intervals
Efron B, Tibshirani R. Bootstrap methods for standard errors, confidence intervals, and other measures of statistical accuracy. Statistical Science. 1986;1(1):54-75. Section 7, equation 7.1 defines the bootstrap cdf, stated for the parametric case with section 8 extending the methods to nonparametric models, and equation 7.2 with the text above it (page 68) defines the percentile interval as the interval between the 100 alpha and 100 (1 minus alpha) percentiles of that distribution, an approximate central interval of coverage 1 minus 2 alpha. Section 9 (page 72) says that B = 250 can give a useful percentile interval.
R quantile type 7 position rule for the ordered replicates
R Core Team. Sample Quantiles (quantile), R documentation for the stats package. Type 7 sets p_k = (k-1)/(n-1) and obtains the quantile by linear interpolation between the points (p_k, x_k), with x_k the k-th order statistic. Solving p_k for k gives the position used here (derived).
Microsoft PERCENTILE.INC interpolation
Microsoft Support. PERCENTILE.INC function. Returns the k-th percentile of the values in a range and interpolates when k is not a multiple of 1/(n-1).
Briggs and Gray on ranking negative bootstrap ICERs
Briggs AH, Gray AM. Handling uncertainty when performing economic evaluation of healthcare interventions. Health Technology Assessment. 1999;3(2). Chapter 5 (page 56, footnote) says that rank ordering bootstrapped ICERs for the percentile-based methods meets a problem because negative ICERs relating to negative costs cannot be distinguished from those relating to negative effects, and that this may undermine the validity of the approach. Page 58 says the ICER is appropriate only when incremental cost and effect are simultaneously positive or negative.
Briggs, Mooney and Wonderling simulation on cost-effectiveness intervals
Briggs AH, Mooney CZ, Wonderling DE. Constructing confidence intervals for cost-effectiveness ratios: an evaluation of parametric and non-parametric techniques using Monte Carlo simulation. Statistics in Medicine. 1999;18(23):3245-3262. The abstract reports that methods assuming a normal sampling distribution performed poorly, as did simply combining the separate intervals on costs and effects.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
