Functions & Formulae

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

Prevalence estimation from a cross-sectional survey and its relation to incidence and duration

P_w = sum_(i=1)^n [w_i * y_i] / sum_(i=1)^n [w_i]; P / (1 - P) = I * D

Estimates the prevalence of a condition from a single survey round, weighting respondents for how the sample was drawn, and links point prevalence to incidence and mean duration in a steady state. The same link shows why averages taken over prevalent cases weight each form of a condition by incidence times duration, not by incidence alone. Notation follows the Cross-Sectional Design article and its prevalent-case utility example.

  • Survey-weighted prevalence from a cross-sectional health survey with three weighting classes

    P_w = (w_1 * d_1 + w_2 * d_2 + w_3 * d_3) / (w_1 * n_1 + w_2 * n_2 + w_3 * n_3)

    Each respondent counts in proportion to the survey weight, which corrects for unequal selection, non-response and the population profile, so the prevalence is the weighted share of respondents with the condition, the sum over respondents i of w_i y_i divided by the sum of w_i, with y_i equal to 1 for a respondent with the condition and 0 otherwise. When respondents in a weighting class share one weight, the sum reduces to the class form below; three classes are written out so that the calculator can run, and SUMPRODUCT in Excel takes any number. The formula gives the point estimate only: its standard error needs the strata and primary sampling units of the design.

  • Steady-state point prevalence from incidence and mean duration

    P = I * D / (1 + I * D); P_approx = I * D

    In a steady state, where incidence, duration and population size are stable and there is no net migration of cases, the prevalence odds equal the incidence rate in the population at risk times the mean duration, P / (1 minus P) = I times D. Solved for P this is I D / (1 + I D). When prevalence is small, (1 minus P) is close to 1 and P is approximately I times D, the form used in the article's worked example; the approximation overstates P by the factor 1 / (1 minus P).

  • Prevalence-weighted and incidence-weighted mean utility of a condition with two forms

    u_prev = (I_1 * D_1 * u_1 + I_2 * D_2 * u_2) / (I_1 * D_1 + I_2 * D_2); u_inc = (I_1 * u_1 + I_2 * u_2) / (I_1 + I_2)

    In a steady state the prevalent pool holds each form of a condition in proportion to its incidence times its mean duration, so a survey of everyone currently living with the condition averages utility with those weights. A model of newly diagnosed patients needs the mean at onset, weighted by incidence alone. The prevalent shares are exact under the steady state even without the small-prevalence approximation, because the common factor (1 minus P) cancels. Two forms are written out so that the calculator can run; SUMPRODUCT in Excel takes any number.