Functions & Formulae

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

Tunnel-state expansion of a cohort state-transition model

m_(t+1) = m_t P_tunnels

Maps a clinical state whose risks, costs or utilities depend on time since entry into a chain of K one-cycle tunnel states followed by a long-term state, so that a cohort model carries time in the state as well as the state itself. The expanded matrix P_tunnels is run with the cohort update s_(t+1) = s_t P of the Markov Model page (HE-FM-MM-001), which is not restated. Three existing records complete the method: tunnel probabilities from a survival curve for time since entry come from the rise in cumulative hazard across each cycle (HE-FM-CUMH-002), with the clock restarting on entry as HE-AS-CUMH-004 notes; the constant probability of a memoryless comparator calibrated to the same three-year survival is the rescaling formula HE-FM-TP-003 (p_old = 0.29344, Delta_old = 3 and Delta_new = 1 give 0.10933, as in the article); and life years from the expanded trace under a counting rule are HE-FM-CSIM-001 and HE-CF-CSIM-001. Notation follows the Tunnel State article.

  • Cohort recursion through a chain of one-cycle tunnel states and a long-term state

    m_(T_1,t+1) = sum_(i=1)^n_S_tunnels [m_(i,t) * p_(i,T_1)]; m_(T_(k+1),t+1) = m_(T_k,t) * s_k; m_(L,t+1) = m_(T_K,t) * s_K + m_(L,t) * s_L

    Moves the cohort one cycle through a tunnel of K one-cycle states T_1 to T_K feeding a long-term state L. New entrants from every state with a route into the tunnel collect in T_1; everyone in T_k who neither dies nor leaves by another route moves to T_(k+1), so no one stays in a tunnel state for a second cycle; survivors of T_K join those who stay in L. These are the tunnel rows of the expanded transition matrix written out, with a zero on each tunnel diagonal. Summing T_1 to L gives the clinical state for reporting, while each column keeps its own cost and utility.

  • Number of states in a cohort model after splitting one state into a tunnel

    n_S_tunnels = n_S + n_tunnels - 1

    Gives the size of the expanded model when one state is replaced by a chain of tunnel states. Following Alarid-Escudero and colleagues, n_tunnels counts every state the original state is split into, including the long-term state, so with K one-cycle tunnel states n_tunnels is K+1. One is subtracted because the tunnel replaces the original state. The expanded transition matrix has n_S_tunnels rows and columns.

  • Average per-cycle death probability across three tunnel states and a long-term state

    q_bar = (m_T1 * q_1 + m_T2 * q_2 + m_T3 * q_3 + m_L * q_L) / (m_T1 + m_T2 + m_T3 + m_L)

    Gives the share of people in a tunnelled clinical state who die in the next cycle, as the occupancy-weighted mean of the probabilities in T1, T2, T3 and L. Here m_T1 to m_L are the values m_(T_k,t) and m_(L,t) of HE-FM-TUN-001 at one cycle, and q_k equals 1 minus s_k when death is the only exit. The average depends on when people entered, which is why a single memoryless state with a cycle-specific probability cannot reproduce a tunnel once entry is staggered. Longer tunnels add one term to each sum for each extra state.