Occupation time at an interior state of a variable-rate symmetric walk (source code)

= Occupation time at an interior state of a variable-rate symmetric walk
{title2=$\mathbb E_iI=2i(N-i)/(N\lambda_i)$}

For a <continuous-time Markov chain> with absorbing endpoints $0,N$ and rates $q_{j,j\pm1}=\lambda_j/2$, the jump chain is a <simple symmetric random walk>. On leaving $i$, absorption before returning has probability $p_i=\tfrac12(1/i+1/(N-i))$, by <gambler's ruin> on each side. The <geometric return count before absorption> and independent rate-$\lambda_i$ <holding times> give $\mathbb E_iI=1/(p_i\lambda_i)$. The rates at other states affect elapsed excursion times but not their return probabilities.