Signature
k_1 = (B + c_1) / a_1; k_2 = (B + c_2) / a_2; k_12 = (B + c_1 + c_2) / (a_1 + a_2); k = min(min(k_1, k_2), k_12); x_1 = max(0, a_1 * k - c_1); x_2 = max(0, a_2 * k - c_2); lambda = 1 / k; H = a_1 * log(1 + x_1 / c_1) + a_2 * log(1 + x_2 / c_2)
| Inputs | Definition | Unit |
|---|---|---|
B | Fixed budget to divide between the two programmes; at least zero | pounds |
c_1 | Spending on programme 1 at which its margin has fallen to half that of its first pound; above zero | pounds |
a_1 | Scale of the health curve of programme 1, the QALYs added each time 1 + x_1 / c_1 rises by a factor of e; above zero | QALYs |
c_2 | Spending on programme 2 at which its margin has fallen to half that of its first pound; above zero | pounds |
a_2 | Scale of the health curve of programme 2, the QALYs added each time 1 + x_2 / c_2 rises by a factor of e; above zero | QALYs |
k_1 | Cost per QALY at the margin if programme 1 takes the whole budget | pounds per QALY |
|---|---|---|
k_2 | Cost per QALY at the margin if programme 2 takes the whole budget | pounds per QALY |
k_12 | Cost per QALY at the margin if both programmes are funded with equal margins and the budget is used exactly | pounds per QALY |
k | Smallest of k_1, k_2 and k_12, the cost of one more QALY at the optimum and the inverse of lambda | pounds per QALY |
x_1 | Spending on programme 1 in the allocation that gives the most health; at least zero | pounds |
x_2 | Spending on programme 2 in the allocation that gives the most health; at least zero | pounds |
lambda | Health produced by the last pound of budget, the margin of every funded programme | QALYs per pound |
H | Health from both programmes at the optimum, measured against spending nothing | QALYs |
Function
Equal-margins allocation of a fixed health budget across programmes with diminishing returns
Takes a health curve for each of J programmes, written here with the parameters a_j and c_j, and a budget B, and returns the spending x_j on each programme that gives the most total health, the health lambda bought by the last pound of budget, its inverse k and the total health H. This is the article's constrained maximisation with smooth curves, where every funded programme stops at the same marginal health per pound. HE-FM-ALLE-001 solves it for two programmes on a stated curve and HE-CF-ALLE-001 for any number. When each extra pound buys the same health within a programme the allocation is the league-table fill of HE-FN-CELT-001. The article's worked example runs on that record although its tranches are not independent programmes, because tranches with falling yields enter HE-CF-CELT-001 as rows in rising ICER order, so each is reached after the one before it, giving 164 QALYs and the critical ratio of HE-FM-CELT-002, about 16,667 pounds per QALY (derived). Whole programmes are HE-FN-IPH-001. The article's other displayed and worked quantities are live and not restated here. The threshold as spending over health at the margin is HE-FM-CET-001, net health benefit is HE-FM-CET-002, a gain from moving one tranche is HE-FM-CET-002 with k set by the health given up, the average cost per QALY is HE-FM-ACER-001, the input-side ratios TE and AE are HE-FM-EFF-002, whose score HE-ER-EFF-002 warns against reading as programme allocation, and the welfare loss of insurance-induced care is HE-FM-MH-001. Notation follows the Allocative Efficiency article.
Computational function
Computational function for the equal-margins allocation of a budget across any number of programmes
Takes the curve scales and half-margin spends of any number of programmes and a budget, sorts the programmes by first-pound margin, finds the level k that uses the budget exactly across the funded programmes and returns each programme's spending, lambda, k and the total health of HE-FM-ALLE-001. Given a current split it also returns each programme's margin there and the health the split leaves unbought, a difference of the same form as G_rule in HE-FM-IPH-001. The search is the water-filling method of Boyd and Vandenberghe with scales added (derived). The inputs are lists of programmes, not the scalars of the formula. The Math / Code line shows three programmes in full, checking all seven funded sets, and the Excel, R and Python versions take any number and need only the sets at the top of the sorted order (derived, and checked here against the seven-set line on 240 cases with no mismatch).
Inputs and outputs:
ais the curve scale of each programme, above zero, in QALYs;cis its half-margin spending, above zero, in pounds;Bis the budget, at least zero, in pounds;currentis an optional list of spends at the current split. In the Math / Code linea_1toa_3andc_1toc_3are three programmes,k_1tok_123the level for each funded set,kthe smallest of them,x_1tox_3the spends,lambdathe health from the last pound andHthe total health. The R and Python versions return the spends,k,lambda,Hand, withcurrent, the margins and the shortfall.Assumption: The conditions of HE-AS-ALLE-001, HE-AS-ALLE-002 and HE-AS-ALLE-004 apply. Programmes with equal first-pound margins may be in either order and the result is unchanged (derived). A curve of another shape with falling margins keeps the equal-margins condition, and one whose margins do not solve in closed form needs a numerical search on lambda (derived).
Worked example (Third programme left unfunded): An illustrative third programme whose first pound buys 0.000025 QALYs is added to HE-EX-ALLE-001. At 1,000,000 pounds its first pound buys less than the last pound elsewhere, so it receives nothing and the first two allocations are unchanged.
a_1 = 60; a_2 = 50; a_3 = 10; c_1 = 200000; c_2 = 200000; c_3 = 400000; B = 1000000; k_1 = 20000; k_2 = 24000; k_3 = 140000; k_12 = 12727.27; k_13 = 22857.14; k_23 = 26666.67; k_123 = 15000; k = 12727.27; x_1 = 563636.36; x_2 = 436363.64; x_3 = 0; lambda = 0.00007857; H = 138.26Worked example (Budget large enough to fund all three): At an illustrative 6,000,000 pounds the third programme enters with a small share and the level k is 56,667 pounds per QALY.
a_1 = 60; a_2 = 50; a_3 = 10; c_1 = 200000; c_2 = 200000; c_3 = 400000; B = 6000000; k_1 = 103333.33; k_2 = 124000; k_3 = 640000; k_12 = 58181.82; k_13 = 94285.71; k_23 = 110000; k_123 = 56666.67; k = 56666.67; x_1 = 3200000; x_2 = 2633333.33; x_3 = 166666.67; lambda = 0.00001765; H = 306.02Worked example (Current split, for the R and Python code): With the curves of HE-EX-ALLE-001 and an illustrative current split of 700,000 and 300,000 pounds, the margins are 0.00006667 and 0.0001 QALYs per pound, so money should move to programme 2, and the split leaves 2.20 QALYs unbought. The Math / Code line has no current split, so this example is for reading against the R and Python versions.
equal_margins(c(60, 50), c(200000, 200000), 1000000, current = c(700000, 300000))returns a shortfall of 2.2.Excel: With one row per programme from row 2, sorted with Data, Sort by first-pound margin
=B2/C2in column D in descending order, scales in column B and half-margin spends in column C, enter=(Budget+SUM(C$2:C2))/SUM(B$2:B2)in E2 and fill down, enter=MIN(E2:E4)for three programmes in a cell named LevelK,=MAX(0,B2*LevelK-C2)in F2 for the spend and=B2*LN(1+F2/C2)in G2 for the health, and fill down.=SUM(G2:G4)returns the total health. A blank scale cell in the first row returns #DIV/0! in E2, and a blank half-margin cell returns #DIV/0! in D2 and G2.R:
equal_margins <- function(a, c, B, current = NULL) { stopifnot(length(a) > 0, length(a) == length(c), all(a > 0), all(c > 0), B >= 0); o <- order(-a/c); k <- min((B+cumsum(c[o]))/cumsum(a[o])); x <- pmax(0, a*k-c); H <- sum(a*log(1+x/c)); out <- list(x = x, k = k, lambda = 1/k, H = H); if (!is.null(current)) { out$margins <- a/(c+current); out$shortfall <- H-sum(a*log(1+current/c)) }; out }At a budget of zero all spends are zero and lambda is the largest first-pound margin. One programme takes the whole budget and identical programmes share it equally. Empty inputs, a scale or half-margin spend at or below zero and a negative budget stop with an error.Python:
from math import logthendef equal_margins(a, c, B, current=None): assert len(a) > 0 and len(a) == len(c) and min(a) > 0 and min(c) > 0 and B >= 0, "a and c above zero, B at least zero"; J = range(len(a)); o = sorted(J, key=lambda j: -a[j]/c[j]); k = min((B+sum(c[j] for j in o[:m]))/sum(a[j] for j in o[:m]) for m in range(1, len(a)+1)); x = [max(0.0, a[j]*k-c[j]) for j in J]; H = sum(a[j]*log(1+x[j]/c[j]) for j in J); gap = None if current is None else ([a[j]/(c[j]+current[j]) for j in J], H-sum(a[j]*log(1+current[j]/c[j]) for j in J)); return x, k, 1/k, H, gapReturns the same edge results as the R version, and invalid inputs raise AssertionError.Test (Spending equals the budget): With the spends in F2 to F4 and the budget in Budget, the spends add up to the budget. Expected result TRUE. FALSE shows E4, the level for all three programmes, read in place of the smallest level, which at 1,000,000 pounds gives spends of 700,000, 550,000 and 0 pounds, 1,250,000 in all, and FALSE also follows when the rows are left unsorted with the third programme first, which gives the same 1,250,000 pounds. Excel check
=ABS(SUM(F2:F4)-Budget)<0.01Test (Hand values with all three funded): With the inputs of the second worked example, LevelK and the total health are compared with the hand values 56,666.67 pounds per QALY and 306.02 QALYs. Expected result TRUE. FALSE shows a doubled or halved LevelK or total health. Excel check
=AND(ABS(LevelK-56666.67)<0.01,ABS(SUM(G2:G4)-306.02)<0.01)Common error (Leaving the rows unsorted): The helper column checks only the sets at the top of the order, so the rows must be sorted by first-pound margin. With the third programme of the first worked example placed first, the levels are 140,000, 22,857 and 15,000 pounds, the smallest is 15,000 where the right level is 12,727, and spending overshoots the budget by 250,000 pounds (derived, illustrative).
Source: Boyd S, Vandenberghe L. Convex Optimization. Cambridge: Cambridge University Press; 2004. Section 5.5.3, Example 5.2 Water-filling, pages 245 to 246, on the solution, x_i as the larger of 0 and 1 / nu minus alpha_i, and the flooding method that finds the level using the whole budget.
k_1 = (B + c_1) / a_1; k_2 = (B + c_2) / a_2; k_3 = (B + c_3) / a_3; k_12 = (B + c_1 + c_2) / (a_1 + a_2); k_13 = (B + c_1 + c_3) / (a_1 + a_3); k_23 = (B + c_2 + c_3) / (a_2 + a_3); k_123 = (B + c_1 + c_2 + c_3) / (a_1 + a_2 + a_3); k = min(min(min(k_1, k_2), k_3), min(min(k_12, k_13), min(k_23, k_123))); x_1 = max(0, a_1 * k - c_1); x_2 = max(0, a_2 * k - c_2); x_3 = max(0, a_3 * k - c_3); lambda = 1 / k; H = a_1 * log(1 + x_1 / c_1) + a_2 * log(1 + x_2 / c_2) + a_3 * log(1 + x_3 / c_3)
Try this function
Implementations
Excel
Equal-margins allocation of a budget from named curve cells
With the curve inputs in cells named ScaleProgrammeOne, ScaleProgrammeTwo, HalfPointProgrammeOne and HalfPointProgrammeTwo and the budget in BudgetTotal, the five formulas return k in MarginalCostQALY, the two spends in SpendProgrammeOne and SpendProgrammeTwo, lambda in ShadowHealth and total health in TotalHealth. A blank scale cell is treated as 0, and arithmetic on it returns #DIV/0! in the first formula. A blank half-point cell is treated as 0, so the first formula returns a number and TotalHealth returns #DIV/0!.
=MIN((BudgetTotal+HalfPointProgrammeOne)/ScaleProgrammeOne,(BudgetTotal+HalfPointProgrammeTwo)/ScaleProgrammeTwo,(BudgetTotal+HalfPointProgrammeOne+HalfPointProgrammeTwo)/(ScaleProgrammeOne+ScaleProgrammeTwo)); =MAX(0,ScaleProgrammeOne*MarginalCostQALY-HalfPointProgrammeOne); =MAX(0,ScaleProgrammeTwo*MarginalCostQALY-HalfPointProgrammeTwo); =1/MarginalCostQALY; =ScaleProgrammeOne*LN(1+SpendProgrammeOne/HalfPointProgrammeOne)+ScaleProgrammeTwo*LN(1+SpendProgrammeTwo/HalfPointProgrammeTwo)
Assumptions
Independent programmes whose health adds up in the equal-margins allocation
Health adds across programmes, and spending on one leaves the curve of the other unchanged. The article names indivisible services, fixed capacity and links between programmes as reasons the margins can fail to equalise. Stinnett and Paltiel state that a general mathematical programming framework can accommodate returns to scale, indivisibility and programme interdependence, and whole programmes are HE-FN-IPH-001.
Logarithmic curve as an illustrative shape of diminishing returns
The curve is a shape chosen here because its margins solve in closed form (derived), so a and c are illustrative until estimated for a programme. Zaric and Brandeau estimate a production function relating the amount invested to the change in risky behaviour for each HIV prevention programme. Any health curve with falling margins keeps the equal-margins condition, and a shape whose margins do not solve in closed form needs a numerical search on lambda (derived). The margin falls from the first pound, so a set-up cost or a stretch of rising returns is outside the formula.
Unweighted health as the objective of the equal-margins allocation
The objective is the sum of QALYs, whoever receives them. In a footnote to society maximising utility from health outcomes, Thomas and Chalkidou note that this assumes the value of a health outcome is the same irrespective of who receives it. As the article notes, equity weights change which allocation counts as efficient.
Inputs above zero with a budget that is fully spent, including boundary cases
Each a_j and c_j is above zero and B is at least zero, on one perspective, time horizon and price year. Every margin stays above zero, so the whole budget is spent (derived). When k_12 ties with k_1 or k_2, the programme left out would receive exactly zero, so x_1 and x_2 are unchanged whichever k is read (derived). At B = 0 both spends are zero and lambda is the larger first-pound margin (derived).
Marginal reading of k for a small change in budget
k describes one more or one fewer pound at this budget. HE-AS-CET-001 requires the change to be small relative to the budget, and k rises with B on these curves, so a large change is valued by comparing H at the two budgets (derived).
Worked examples
Illustrative falls prevention and cardiac rehabilitation budget of one million pounds at equal margins
A commissioner divides 1,000,000 pounds between falls prevention (programme 1) and cardiac rehabilitation (programme 2), the programmes of the article's example, with illustrative curves whose first pounds buy 0.0003 and 0.00025 QALYs. Both are funded, with 563,636 and 436,364 pounds, and both last pounds cost 12,727 pounds per QALY, while total health is 138.26 QALYs. These curves are not the article's tranche table, so the figures differ from its 164 QALYs.
a_1 = 60; a_2 = 50; c_1 = 200000; c_2 = 200000; B = 1000000; k_1 = 20000; k_2 = 24000; k_12 = 12727.27; k = 12727.27; x_1 = 563636.36; x_2 = 436363.64; lambda = 0.00007857; H = 138.26
Illustrative small budget that funds only one programme at equal margins
With the same illustrative curves and only 20,000 pounds, k_1 is the smallest level, so programme 1 takes the whole budget and programme 2 gets nothing. The last pound buys 0.00027273 QALYs, more than the 0.00025 that programme 2's first pound would buy, so no transfer helps although the two margins differ.
a_1 = 60; a_2 = 50; c_1 = 200000; c_2 = 200000; B = 20000; k_1 = 3666.67; k_2 = 4400; k_12 = 3818.18; k = 3666.67; x_1 = 20000; x_2 = 0; lambda = 0.00027273; H = 5.72
Limiting case of two identical programmes at equal margins
Two programmes with identical illustrative curves share the budget equally, each receiving 500,000 pounds, the check that an implementation does not favour one by position. The case tests symmetry and has no empirical content.
a_1 = 50; a_2 = 50; c_1 = 200000; c_2 = 200000; B = 1000000; k_1 = 24000; k_2 = 24000; k_12 = 14000; k = 14000; x_1 = 500000; x_2 = 500000; lambda = 0.00007143; H = 125.28
Limiting case with unit scales matching the printed water-filling solution
With a_1 = a_2 = 1 and a budget of 1 the problem is Boyd and Vandenberghe's Example 5.2 with alpha values, chosen here, of 0.2 and 0.5. Their x_i, the larger of 0 and 1 / nu minus alpha_i, gives 0.65 and 0.35 at 1 / nu = 0.85, so lambda is their nu (derived). H here is measured against zero spending, which differs from their sum of log(alpha_i + x_i) by a constant and leaves the solution unchanged (derived). The inputs are illustrative numbers without units, for checking.
a_1 = 1; a_2 = 1; c_1 = 0.2; c_2 = 0.5; B = 1; k_1 = 1.2; k_2 = 1.5; k_12 = 0.85; k = 0.85; x_1 = 0.65; x_2 = 0.35; lambda = 1.176471; H = 1.98
Illustrative budget rise of one hundred thousand pounds at equal margins
Adding 100,000 pounds to the first example raises k by about 909 pounds and H by 7.59 QALYs. The finite change read through HE-FM-CET-001 costs about 13,177 pounds per QALY, which lies between k before the rise, 12,727 pounds, and k after it, 13,636 pounds (derived). The figures are illustrative.
a_1 = 60; a_2 = 50; c_1 = 200000; c_2 = 200000; B = 1100000; k_1 = 21666.67; k_2 = 26000; k_12 = 13636.36; k = 13636.36; x_1 = 618181.82; x_2 = 481818.18; lambda = 0.00007333; H = 145.85
Common errors
Equating average cost per QALY across programmes in place of the margin
The article's condition concerns the last unit of each programme, not its average. In the first worked example, equal averages of about 7,243 pounds per QALY (HE-FM-ACER-001) need spends of 605,397 and 394,603 pounds. The last pounds then cost 13,423 and 11,892 pounds per QALY, so money should still move, and H is 138.06 QALYs, 0.20 below the optimum (derived, illustrative).
Giving the whole budget to the programme with the best first pound
Ranking the two curves by their first-pound margins and funding only the top one treats health per pound as constant, the condition of HE-AS-CELT-003. In the first worked example it gives H of 107.51 QALYs, 30.75 below the optimum, and leaves the first pound of programme 2 buying five times what the last pound of programme 1 buys (derived, illustrative).
Reading the average budget per QALY as the marginal threshold
B / H in the first worked example is 7,233 pounds per QALY, while k is 12,727 pounds, about 1.76 times as high. Using the average as the threshold rejects a new technology at 10,000 pounds per QALY that buys more health than the spending it displaces, as HE-FM-CET-002 shows at k (derived, illustrative).
Valuing a large budget change with k at the current budget
Cutting 500,000 pounds from the first worked example costs 500,000 / 12,727 = 39.29 QALYs when valued at k, but H falls by 48.60 QALYs because k falls to 8,182 pounds as spending retreats up the curves. This is the point of HE-AS-CET-001, that a large budget impact displaces more than marginal activity (derived, illustrative).
Reading k_12 alone so that a programme receives negative spending
The level k_12 assumes that both programmes are funded. At a budget of 20,000 pounds it gives 29,091 pounds for programme 1 and minus 9,091 pounds for programme 2, and flooring the second at zero then overspends the budget by 9,091 pounds. Taking the smallest of k_1, k_2 and k_12 gives 20,000 and 0 pounds (derived, illustrative).
Sources
Boyd and Vandenberghe on the water-filling solution behind the equal-margins allocation
Boyd S, Vandenberghe L. Convex Optimization. Cambridge: Cambridge University Press; 2004. Section 5.5.3, KKT optimality conditions, Example 5.2 Water-filling, pages 245 to 246. The example minimises the negative sum of log(alpha_i + x_i) with x at least zero and the x_i adding up to 1, derives x_i as the larger of 0 and 1 / nu minus alpha_i from the KKT conditions and notes that the budget equation has a unique solution that is readily determined. The source's application is allocating power across communication channels. The scales a_j, the budget B and the reading as health programmes are derived here.
Mitton and Donaldson on no further reallocation raising total benefit
Mitton C, Donaldson C. Health care priority setting: principles, practice and challenges. Cost Effectiveness and Resource Allocation. 2004;2:3. Section Economic principles, which states that with a focus on health gain the goal is reached when no further reallocation of resources between services increases total benefit, and that in theory this is the point where the ratio of marginal costs to marginal benefits across services is equal.
Thomas and Chalkidou on resources reallocated until marginal utilities are equal
Thomas R, Chalkidou K. Cost-effectiveness analysis. In: Cylus J, Papanicolas I, Smith PC, editors. Health System Efficiency: How to Make Measurement Matter for Policy and Management. Copenhagen: European Observatory on Health Systems and Policies; 2016. Section 6.2, page 116, which states that resources are reallocated between services up to the point at which the marginal (social) utilities are equal, with a footnote to the societal maximisation on the same page stating that it assumes the value of a health outcome is the same irrespective of who receives it.
Crown and colleagues on the threshold as the inverse of the budget shadow price
Crown W, Buyukkaramikli N, Sir MY, Thokala P, Morton A, Marshall DA, Tosh JC, Ijzerman MJ, Padula WV, Pasupathy KS. Application of constrained optimization methods in health services research: report 2 of the ISPOR Optimization Methods Emerging Good Practices Task Force. Value in Health. 2018;21(9):1019-1028. Section 2, Overview of applications of constrained optimization in health care, as numbered in the accepted manuscript read (White Rose Research Online eprint 136712, published version not seen), which states that under a strict set of assumptions the threshold represents the inverse of the shadow price of the budget constraint, and defines the shadow price as how much the objective in QALYs would increase for a one-unit increase in the budget.
Stinnett and Paltiel on returns to scale in budget allocation by mathematical programming
Stinnett AA, Paltiel AD. Mathematical programming for the efficient allocation of health care resources. Journal of Health Economics. 1996;15(5):641-653. Abstract, which states that a general mathematical programming framework can accommodate much more complex information regarding returns to scale, partial and complete indivisibility and programme interdependence than earlier methods, which relied on unnecessarily restrictive assumptions.
Zaric and Brandeau on production functions for allocating prevention funds
Zaric GS, Brandeau ML. Optimal investment in a portfolio of HIV prevention programs. Medical Decision Making. 2001;21(5):391-408. Abstract, which states that the authors determine the allocation of funds that maximises QALYs or infections averted among three types of programme and estimate for each a production function relating the amount invested to the associated change in risky behaviour.
Canonical Identity
Stable URI · Machine-readable · Resolvable · CC BY 4.0
