Solution (source code)

= Solution

The permitted transitions in the <continuous-time multi-state model> are
$$
1\xrightarrow{q_{12}}2,\quad
1\xrightarrow{q_{13}}3,\quad
1\xrightarrow{q_{15}}5,\quad
2\xrightarrow{q_{24}}4,\quad
2\xrightarrow{q_{25}}5,\quad
3\xrightarrow{q_{34}}4,\quad
3\xrightarrow{q_{35}}5,\quad
4\xrightarrow{q_{45}}5.
$$
State 5 is absorbing. The absence of arrows from dementia states 2 and 4 back to nondementia states expresses irreversibility; stroke likewise remains in the history after entry to states 3 or 4.