Functions & Formulae

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

Welfare change measurement and aggregation function

W(u_1,...,u_n) = W

Converts each person's gain or loss from a change into money, with the compensating or equivalent variation or the consumer surplus approximation, and then ranks the change for society: by adding the money measures, as the Kaldor-Hicks potential compensation test does, or by combining individual outcomes with an explicit social welfare function that states how gains to one person are set against losses to another.

  • Compensating and equivalent variation from the expenditure function

    CV = e0_u0 - e1_u0; EV = e0_u1 - e1_u1

    For a change in prices with income unchanged, the compensating variation is the income that could be taken away after the change while leaving the person at the original utility level u0; the equivalent variation is the income that would have to be given before the change to reach the new utility level u1. Each is a difference in the minimum expenditure needed to reach a utility level at old and new prices: CV = e(p0,u0) minus e(p1,u0) and EV = e(p0,u1) minus e(p1,u1). The formula takes the four expenditure values as inputs.

  • Change in consumer surplus from a price change on a linear demand curve

    Delta_CS = (P_0 - P_1) * (Q_0 + Q_1) / 2

    When demand is linear between the old and new prices, the change in consumer surplus is the trapezoid between the two prices out to the demand curve: the price change multiplied by the average of the quantities bought before and after. The result is positive for a price fall and negative for a rise. It is the Marshallian approximation to CV and EV and lies between them for a single price change.

  • Kaldor-Hicks aggregate net gain across groups

    NG = sum_(i=1)^n [N_i * CV_i]

    Adds the money measure of each group's gain or loss, weighted by the number of people in the group. A change passes the Kaldor potential compensation test when the total is greater than zero, because the gainers could then compensate the losers and still be better off, whether or not compensation is paid. The sum is the welfare-economic basis of net benefit in cost-benefit analysis, where the programme's resource cost enters as a loss.

  • Weighted two-group social welfare and the switching weight

    W_X = QA_X + w * QB_X; W_Y = QA_Y + w * QB_Y; w_s = (QA_X - QA_Y) / (QB_Y - QB_X)

    Scores each option as total QALYs of group A plus a weight w times total QALYs of group B, where w is the value placed on a QALY accruing to the worse-off group relative to group A. A weight of 1 gives the utilitarian sum. The switching weight is the value of w at which two options X and Y score the same, found by setting their weighted totals equal; above it the option that does more for group B is preferred.