Functions & Formulae

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

Dirichlet distribution for one row of a transition matrix: moments, conjugate update from transition counts and beta marginals

E_j = alpha_j / alpha_0; V_j = alpha_j * (alpha_0 - alpha_j) / (alpha_0^2 * (alpha_0 + 1)); C_ij = -alpha_i * alpha_j / (alpha_0^2 * (alpha_0 + 1)); alpha_j = a_j + n_j; p_j ~ Beta(alpha_j, alpha_0 - alpha_j)

Treats the probabilities of moving from one health state to each of K destinations as a single uncertain vector that always adds to one, with one positive parameter per destination. The ratios of the parameters fix the means and their sum fixes the precision; observed transition counts add to a Dirichlet prior to give a Dirichlet posterior, and each component on its own follows a beta distribution. Sampling a row from normalised gamma draws is HE-FM-BETA-005 on the beta distribution page. Notation follows the Dirichlet Distribution article.

  • Mean, variance, covariance and correlation of two components of a three-destination Dirichlet row

    alpha_0 = alpha_1 + alpha_2 + alpha_3; E_2 = alpha_2 / alpha_0; V_2 = alpha_2 * (alpha_0 - alpha_2) / (alpha_0^2 * (alpha_0 + 1)); V_1 = alpha_1 * (alpha_0 - alpha_1) / (alpha_0^2 * (alpha_0 + 1)); C_12 = -alpha_1 * alpha_2 / (alpha_0^2 * (alpha_0 + 1)); R_12 = C_12 / sqrt(V_1 * V_2)

    For a row with parameters alpha_1, alpha_2 and alpha_3, the mean of each component is its parameter over the sum alpha_0, the variances and covariances shrink as alpha_0 grows, and every covariance is negative, so a sampled row that sends more of the cohort to one destination sends less to the others. The correlation depends only on the means, while alpha_0 sets the precision.

  • Dirichlet posterior parameter, mean and beta marginal for one destination from transition counts and a Dirichlet prior

    alpha_j = a_j + n_j; b_j = A_0 + N - alpha_j; E_j = alpha_j / (A_0 + N)

    A Dirichlet prior combined with multinomial counts gives a Dirichlet posterior in which each parameter is its prior parameter plus its count. The posterior mean of one destination is that parameter over the prior total plus the number of patients, and the destination's probability on its own follows Beta(alpha_j, alpha_0 minus alpha_j), whose second parameter is written b_j here. A zero prior reproduces the observed proportions; a prior of one per destination is uniform over all valid rows.

Dirichlet Distribution — Functions & Formulae | HealthEconomics.wiki