Functions & Formulae

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

Bayesian analysis function for a posterior and its decision summaries

b(p(theta), p(y | theta), y) = p(theta | y)

Takes a prior distribution for an unknown model input, a likelihood and the observed data and returns the posterior distribution with the summaries a health technology assessment reads, such as a posterior mean, an expected value of perfect information and a model comparison statistic. The posterior is proportional to likelihood times prior, and HE-FN-BAD-001 gives the normalised form. Live records already hold the common conjugate updates, the beta for a probability in HE-FM-BETA-002, the normal for a treatment effect in HE-FM-BAD-001 and the Dirichlet for a transition row in HE-FM-DIRI-002. The posterior mean of HE-FM-BETA-002 is also the average of the prior mean and the trial proportion weighted by alpha_0 + beta_0 and n (derived). Posterior draws feed the acceptability curve HE-FM-CEAC-001 and EVPI from draws HE-FM-EVPI-002. This package adds the gamma update for an event rate, exact EVPI when incremental net benefit is linear in a beta probability, and the deviance information criterion. Notation follows the Bayesian Analysis article.

  • Gamma posterior for an event rate from a Poisson count and its exposure

    alpha = alpha_0 + D; beta = beta_0 + T; E_r = alpha / beta; SD_r = sqrt(alpha) / beta

    Updates a gamma prior for an event rate with D events observed in exposure T, such as patient-years. Because the gamma is the conjugate prior for a Poisson rate, the posterior is again a gamma, with the events added to the shape and the exposure added to the rate parameter. Unlike the beta update HE-FM-BETA-002, the second parameter takes exposure and the mean is alpha / beta. The mean and standard deviation are the gamma moments in the form that HE-FM-BETA-004 fits for a utility decrement, with shape k = alpha and scale theta = 1 / beta. A model with fixed cycles converts each sampled rate with HE-FM-TP-001.

  • Exact two-option EVPI when incremental net benefit is linear in a beta probability

    k = lambda * q; p_star = c / k; E_p = alpha / (alpha + beta); INB_bar = k * E_p - c; E_pos = k * E_p * G_1 - c * G_0; EVPI_B = E_pos - max(INB_bar, 0)

    Gives per-person EVPI without draws or numerical integration when a response probability with a beta distribution is the only uncertain input and each responder gains q QALYs at a fixed extra cost c. Incremental net benefit is HE-FM-NMB-002 with Delta_E = q p and Delta_C = c, so k = lambda q is its slope, p_star is the response probability where it is zero, and INB_bar is its value at the mean E_p of HE-FM-BETA-001. G_0 is the upper tail of Beta(alpha, beta) at p_star, the probability of cost-effectiveness that HE-FM-CEAC-001 estimates by counting draws. G_1 is the same tail with shape alpha + 1. E_pos is the expected positive part of incremental net benefit, from the printed limited expected value of a beta (derived), and subtracting the positive part of the mean gives EVPI as defined in HE-FM-EVPI-002. HE-FM-EVPI-004 is the matching closed form for a normal incremental net benefit.

  • Deviance information criterion from posterior mean residual deviance and effective parameters

    p_D = D_res - D_fit; DIC = D_res + p_D

    Compares models fitted to the same data and likelihood by adding a penalty for complexity to the fit. D_res is the posterior mean of the residual deviance, and D_fit is the residual deviance at the posterior means of the fitted values. Their difference is p_D, the effective number of parameters, which is the sum over data points of each point's posterior mean deviance less its deviance at the mean fitted value. The sum of D_res and p_D is the criterion, and lower values suggest a more parsimonious model. HE-FM-AIC-001 charges 2 for each estimated parameter at one maximised likelihood, whereas p_D comes from the posterior and need not be a whole number.

This set of formulae is licensed under Creative Commons Attribution 4.0 International (CC BY 4.0).

Author: Dr Darrin Baines · Publisher: Intelligent Parameters Ltd · Identifier: https://healtheconomics.wiki/concept/bayesian-analysis/formulae