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))$}

Let $i$ be a state outside an absorbing set $A$ of a <Markov chain>. Write $T_A$ for its first <hitting time> of $A$ and $T_i^+=\inf\{n\geq1:X_n=i\}$. Assume each excursion ends: $\mathbb P_i(T_A\wedge T_i^+<\infty)=1$, and put $p=\mathbb P_i(T_A<T_i^+)>0$. Then the number $K$ of visits to $i$ before absorption, including the initial visit, has the positive-support <geometric distribution>
$$
\mathbb P(K=k)=(1-p)^{k-1}p,\qquad k\geq1.
$$
After a return, the <Strong Markov property> restarts the same experiment. Thus $\mathbb P(K\geq k)=(1-p)^{k-1}$ and $\mathbb EK=1/p$.

The excursion-ending assumption matters: on an infinite <state space>, an excursion may escape forever without either absorption or return. In that case the geometric parameter for the number of visits is $\mathbb P_i(T_i^+=\infty)$, which need not equal the absorption-before-return <probability>.

For a <continuous-time Markov chain>, use the embedded jump chain and assume <independent> holding times at $i$ with <exponential distribution> of rate $\lambda_i>0$, <independent> of the jump destinations. The total <occupation time> before absorption is a <geometric sum of exponential variables>, with <exponential distribution> of rate $p\lambda_i$ and <expected value> $1/(p\lambda_i)$.