Functions & Formulae

Each applied formula has its own function page, with a signature, implementations, and tests.

Discounting of yearly cost and QALY streams to present-value totals

D(X_t, r, T) = PV

Maps a stream of yearly costs or QALYs, an annual discount rate, a time horizon and a timing convention to one discounted total, by multiplying each year's amount by its discount factor and adding the results. Totals for costs and for QALYs are formed separately and then compared across options, for example as an incremental cost per QALY. The present value of a single amount, the general sum over a stream and separate rates for costs and health are on the Discount Rate page (HE-FM-DR-001 to HE-FM-DR-003), and unequal rates on the Differential Discounting page (HE-FN-DDIS-001). This package adds the totals of a level yearly stream counted at the end of each year, at the start of each year and continuously, and the discounted cost per QALY of a one-off treatment with a lasting gain, as in the article's worked example.

  • Discounted total of a level yearly amount counted at the end of each year

    Q = q * (1 - (1 + r)^(-T)) / r

    Gives the present value of the same amount q in each of T years when each year's amount is counted at the end of that year, so the first year carries the factor 1/(1 + r) and the last 1/(1 + r)^T. The fraction (1 minus (1 + r) to the power minus T) divided by r is the sum of the T yearly discount factors, the annuity form in the article's worked example. It tends to T as r falls towards zero, where the closed form itself cannot be evaluated.

  • Discounted total of a level yearly amount counted at the start of each year

    Q_s = q * (1 + r) * (1 - (1 + r)^(-T)) / r

    Credits each year's amount at the start of the year, so the T amounts fall in years 0 to T minus 1 and the first is not discounted. Every factor is one period earlier than under end-of-year counting, so the total is (1 + r) times the total in HE-FM-DISC-001. Larson describes this convention as the same as a stream of payments each made at the beginning of the year.

  • Continuously discounted total of an even yearly flow over a time horizon

    rho = log(1 + r); Q_c = q * (1 - exp(-rho * T)) / rho

    Treats the amount q as arising evenly through each year instead of at one point, and integrates it against the continuous discount factor exp(minus rho t) from 0 to T. Larson gives the same integral, with an amount of 1, for years of life lost. The continuous rate rho, the natural log of (1 + r), gives the same factor at every whole year as the annual rate r, so the result lies between the end-of-year and start-of-year totals of HE-FM-DISC-001 and HE-FM-DISC-002. The function log is the natural logarithm.

  • Discounted cost per QALY of a one-off treatment cost with a level yearly QALY gain

    ICER = C_0 * r / (q * (1 - (1 + r)^(-T)))

    Divides an incremental cost paid entirely at the start (year 0), which discounting leaves unchanged, by the discounted total of a level yearly QALY gain counted at the end of each year, as in HE-FM-DISC-001. Only the QALYs shrink, so the ratio rises with the rate. This is the calculation behind the article's worked example.