Geometric return count before absorption (source code)

= Geometric return count before absorption
{title2=$K\sim\operatorname{Geom}(\mathbb P_i(\text{absorption before return to }i))$}

Start a <Markov chain> at a nonabsorbing state $i$. If each departure from $i$ has probability $p>0$ of absorption before the next return, the <Strong Markov property> makes the number of visits to $i$, including the initial one, a positive-integer <geometric random variable> of parameter $p$. For a <continuous-time Markov chain> whose <holding times> at $i$ are independent rate-$\lambda_i$ exponentials, independently of the embedded jump chain, the total <occupation time> at $i$ is a sum of $K$ such holding times and has <expected value> $1/(p\lambda_i)$.