Functions & Formulae

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

Cohort simulation of a state-transition model

m_(t+1) = m_t P_t; Y = sum_(t=0)^T w_t delta_t m_t r

Maps a starting distribution of the cohort across health states, the transition matrix for each cycle, the reward per cycle in each state, the discount factors and a within-cycle counting rule to the expected total cost, life years or QALYs per person. The cycle-by-cycle trace m_(t+1) = m_t P_t is the cohort state update of the Markov Model page, which gives it in its time-homogeneous form s_(t+1) = s_t P (HE-FM-MM-001); here P_t may vary from cycle to cycle, and the update is not restated. Because each state is homogeneous, the proportion in a state equals the probability that one member of the cohort is in it, so the accumulated rewards are expected values per person. Two existing formulae check a run: the area under an exponential survival curve over one interval (HE-FM-BTH-001) gives a continuous-time benchmark for counting rules, and the fundamental matrix (HE-FM-ABS-001) gives the totals of a run to absorption counted at the start of each cycle.

  • Expected outcome per person from a cohort simulation trace with counting weights and discounting

    Y = sum_(t=0)^T [w_t * delta_t * m_t * r]

    Sums the reward earned by the cohort in each recorded cycle, m_t r, after multiplying it by a within-cycle counting weight w_t and a discount factor delta_t. Here m_t is the row of the cohort trace at cycle t and r the column of rewards per cycle in each state, so m_t r is the reward per person at cycle t; where only one state carries a reward, m_t r is that state's proportion times its reward, the form used in the worked examples. The counting weights for the common rules are: end of cycle 0 at t = 0 and 1 afterwards; start of cycle 1 up to T minus 1 and 0 at T; half-cycle correction (trapezoidal rule) one half at t = 0 and t = T and 1 in between; Simpson's 1/3 rule, for T even, one third at t = 0 and t = T, four thirds at odd t and two thirds at even t. The half-cycle and Simpson weights appear here only as counting options; the Half-Cycle Correction page covers the correction itself.