Discrete-time multi-state diagnosis model (source code)

= Discrete-time multi-state diagnosis model
{title2=$e_k=ah_{k-1}$}

The <Discrete-time multi-state diagnosis model> tracks the delay between infection and diagnosis. Let $h_i$ be the expected number of new infections at step $i$, with $h_i=0$ for $i<0$. An infection at step $i$ has one early opportunity for diagnosis at step $i+1$, with <Probability> $a$. If not diagnosed early, it has a diagnosis opportunity with <Probability> $b$ at each step $i+2,i+3,\ldots$, conditional on still being undiagnosed. Assume $0\leq a\leq1$ and $0<b\leq1$, with the same <transition probabilities> for all cohorts.

The expected early and late diagnosis counts at step $k$ are
$$
e_k=ah_{k-1},\qquad
n_k=b(1-a)\sum_{i=0}^{k-2}h_i(1-b)^{k-i-2},
$$
where an empty sum is zero. Each term in the second expression is a cohort size multiplied by its <Probability> of avoiding early diagnosis, surviving the earlier late opportunities, and being diagnosed now. The waiting time in the late state therefore has a positive-support <geometric distribution>.

For a single cohort with $h_0=100$, $a=0.2$, $b=0.5$, and no later infections, the expected counts are $e_1=20$, $n_2=40$, $n_3=20$, and $n_4=10$. The ratio $e_k/(e_k+n_k)$, when its denominator is positive, is the early fraction of the expected diagnosis intensity. It is not generally the <expected value> of the observed random fraction: taking a ratio and taking an <expected value> do not commute. Initial infections before step zero require additional cohort terms, so the time origin must be stated.