Skip to content

Commit fa6930a

Browse files
jstacclaude
andcommitted
Expand the first-step analysis for mean first passage time
The derivation of the mean first passage recursion was too compressed, and it also pointed at markov_chains_I for expected unemployment durations, which that lecture poses as a question but never actually derives. The rewrite makes three hidden steps explicit: * the first step costs one period regardless of where it lands, which is where the leading 1 comes from * the k = j term is present but contributes m_ij * 0, so the sum over k != j omits it because it is zero, not because the case is impossible * writing T_kj for the remaining journey uses the Markov property, since the time from k must not depend on having arrived via i Adds an underbraced display separating the three contributions, a two-state sanity check where the recursion collapses to the geometric waiting time 1/alpha, and the matrix form (I - M_-j) t = 1 that the code actually solves. The diagonal convention now carries its justification: by ergodicity the chain spends a fraction psi*(j) of its time in j, so returns occur once every 1/psi*(j) periods. Verified numerically: T[0,1] = 1/alpha exactly for the two-state chain, diag(T) = 1/psi*, and the recursion residual is zero. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent f87f54b commit fa6930a

1 file changed

Lines changed: 48 additions & 5 deletions

File tree

lectures/mobility.md

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,64 @@ This measure has a further attraction: for a two-state chain, $|\lambda_2|$ is e
378378

379379
The final measure asks a question about waiting times: how long does it take a household to reach a given quantile?
380380

381-
Let $T$ be the matrix whose $(i,j)$-th element is the expected number of periods until a household starting in quantile $i$ first arrives in quantile $j$.
381+
Let $T_{ij}$ be the expected number of periods until a household starting in quantile $i$ first arrives in quantile $j$.
382382

383-
For $i \neq j$ we can compute $T_{ij}$ by conditioning on the first step, exactly as we computed expected unemployment durations in {doc}`markov_chains_I`.
383+
To compute it we use **first-step analysis**: we condition on where the chain goes next, and then use the fact that the problem starting from there looks just like the original one.
384384

385-
Either the chain jumps straight to $j$, or it moves to some $k \neq j$ and we start again, so
385+
Fix the target $j$ and take any starting quantile $i \neq j$.
386+
387+
The household takes one step, which uses up one period no matter where it lands.
388+
389+
That step takes it to quantile $k$ with probability $m_{ik}$, and there are two possibilities.
390+
391+
If $k = j$ the household has arrived, and no further time is needed.
392+
393+
If $k \neq j$ the household must still travel from $k$ to $j$, and the expected time for that remaining journey is $T_{kj}$.
394+
395+
The second case is where the Markov property earns its keep: how long the trip from $k$ takes depends only on $k$, and not on the fact that we reached $k$ by way of $i$.
396+
397+
Averaging over the possible first steps gives
398+
399+
$$
400+
T_{ij}
401+
= \underbrace{1}_{\text{the first step}}
402+
+ \underbrace{m_{ij} \times 0}_{\text{arrived at } j}
403+
+ \underbrace{\sum_{k \neq j} m_{ik} T_{kj}}_{\text{not yet arrived}}
404+
$$
405+
406+
The middle term is zero, so we are left with
386407

387408
```{math}
388409
:label: mfp_recursion
389410
390411
T_{ij} = 1 + \sum_{k \neq j} m_{ik} T_{kj}
391412
```
392413

393-
Holding $j$ fixed, this is a linear system in the $N-1$ unknowns $\{T_{ij}\}_{i \neq j}$ that we can solve directly.
414+
Notice that the sum omits $k = j$ not because that case cannot happen, but because it contributes nothing once the household has arrived.
415+
416+
Here is the simplest possible check.
417+
418+
Consider the two-state chain of {doc}`markov_chains_I`, where an unemployed worker finds a job with probability $\alpha$ each month, and let $i$ be the unemployed state and $j$ the employed one.
419+
420+
The only term in the sum is $k = i$, with $m_{ii} = 1 - \alpha$, so {eq}`mfp_recursion` reads $T_{ij} = 1 + (1 - \alpha) T_{ij}$, which gives $T_{ij} = 1/\alpha$.
421+
422+
This is exactly right, since the waiting time is geometric with success probability $\alpha$.
423+
424+
Now hold $j$ fixed and read {eq}`mfp_recursion` as a system of $N-1$ equations in the $N-1$ unknowns $\{T_{ij}\}_{i \neq j}$.
425+
426+
Writing $t$ for the vector of these unknowns and $M_{-j}$ for $M$ with its $j$-th row and $j$-th column deleted, the system is
427+
428+
$$
429+
t = \mathbb 1 + M_{-j} \, t
430+
\qquad \text{or} \qquad
431+
(I - M_{-j}) \, t = \mathbb 1
432+
$$
433+
434+
which is a linear solve, and is what the code below does for each $j$ in turn.
435+
436+
On the diagonal we use the mean *return* time to $j$.
394437

395-
On the diagonal we use the mean *return* time, which for an irreducible chain is $T_{jj} = 1/\psi^*(j)$.
438+
By the ergodicity result in {doc}`markov_chains_II`, an irreducible chain spends a fraction $\psi^*(j)$ of its time in quantile $j$, so visits to $j$ occur on average once every $1/\psi^*(j)$ periods, giving $T_{jj} = 1/\psi^*(j)$.
396439

397440
```{code-cell} ipython3
398441
def mean_first_passage(M):

0 commit comments

Comments
 (0)