Tutorials › Competing Risks and Multi-State Models › Comparing Markov And Semi-Markov Predictions

Semi-Markov and Non-Markov Models · Tutorial 343 of 699

Comparing Markov And Semi-Markov Predictions

Calculate future state probabilities under Markov and semi-Markov models, and see how elapsed time in the current state can change a prediction.

Advanced 11 min read

What You'll Learn

  • Distinguish Markov predictions from semi-Markov predictions conditional on time already spent in the current state.
  • Compute future occupancy probabilities from a continuous-time Markov transition-rate matrix.
  • Calculate residual survival and destination probabilities from duration-specific transition hazards.
  • Extend first-exit calculations to multi-step state paths using a semi-Markov renewal equation.
  • Identify assumptions, diagnostics, and limitations that matter when comparing predictions.

Why Time in the Current State Matters

A prediction for someone currently in state A may depend on more than the state label. If transition hazards change with time spent in A, two people who are both currently in A can have different probabilities of moving to another state over the next month because one entered A recently and the other has been there much longer. A Markov model that represents the current state as the full predictive state does not make that distinction; a semi-Markov model can.

The comparison here concerns predictions conditional on the same current state and different elapsed durations in that state. It does not by itself establish which model is preferable: that requires considering the scientific process, model assumptions, and predictive performance. The earlier material on duration dependence, semi-Markov models, and memory structures supplies useful context for this comparison.

Definition: A time-homogeneous continuous-time Markov model has transition rates \(q_{ij}\) that depend on the current state \(i\) and destination \(j\), but not on time already spent in \(i\) or earlier history. Its rate matrix \(Q\) has off-diagonal entries \(q_{ij}\geq 0\) and diagonal entries \(q_{ii}=-\sum_{j\ne i}q_{ij}\). A semi-Markov model allows the next-transition hazards to depend on the duration \(u\) already spent in the current state. Write \(\alpha_{ij}(u)\) for the hazard of moving from \(i\) to \(j\) at duration \(u\), conditional on still occupying \(i\) then.

For a Markov model, the probability of being in each possible state after horizon \(h\) is obtained from the transition matrix \(P(h)=\exp(Qh)\). In particular, the prediction depends on the current state and horizon, not on the time already spent in that state. A time-inhomogeneous Markov model may allow rates to vary with calendar time, but, conditional on the current state and calendar time, it still does not depend on elapsed state duration.

In a semi-Markov model, elapsed duration changes the residual time-to-exit distribution when hazards vary with duration. The destination can also matter: separate \(\alpha_{ij}(u)\) specify duration-specific hazards for different possible transitions. Unless stated otherwise, the calculations below assume a correctly specified state structure, known hazards, no additional unmodeled history needed for prediction, and duration measured from the most recent entry into the current state.

From Hazards to Future Probabilities

Suppose someone is in state \(i\), has already spent \(u\) time units there, and is predicted over the next \(h\) time units. The total exit hazard at duration \(v\) is \(\lambda_i(v)=\sum_{j\ne i}\alpha_{ij}(v)\). Conditional on remaining in \(i\) at duration \(u\), the probability of no exit during the next \(h\) time units is

$$ S_i(h\mid u)=\exp\left\{-\int_u^{u+h}\lambda_i(v)\,dv\right\}. $$

This is a residual survival probability: it conditions on having already remained in the state through duration \(u\). The probability density of first exiting to \(j\) at \(v\) time units from now is \(S_i(v\mid u)\alpha_{ij}(u+v)\). Thus the probability that the first exit by horizon \(h\) is to \(j\) is

$$ \int_0^h S_i(v\mid u)\alpha_{ij}(u+v)\,dv. $$

That first-exit probability is not always the probability of occupying \(j\) at the horizon: the person might enter \(j\) and then leave it before the horizon. For paths involving additional transitions, let \(p_{ij}(h\mid i,u)\) denote the probability of occupying \(j\) after \(h\), starting in \(i\) at duration \(u\). If durations reset on entry and the future depends only on the current state and its duration, the semi-Markov renewal equation is

$$ p_{ij}(h\mid i,u) = \mathbf{1}(i=j)S_i(h\mid u) + \sum_{k\ne i}\int_0^h S_i(v\mid u)\alpha_{ik}(u+v)\, p_{kj}(h-v\mid k,0)\,dv. $$

The first term accounts for no exit from \(i\); each integral accounts for a first transition to \(k\), followed by the prediction from \(k\) with its duration reset to zero. This equation also shows why a simple first-exit calculation is sufficient only when the destination states are absorbing or when the target is specifically the first transition.

Worked Predictions

Worked Example: Markov Predictions Do Not Depend on Elapsed Duration

Hypothetical model. A person in state A can move to absorbing states B or C. The constant transition rates are \(q_{AB}=0.20\) per month and \(q_{AC}=0.10\) per month. Find the state probabilities three months from now, both for someone who entered A today and someone who has already spent six months in A.

The model assumes constant rates and treats B and C as absorbing. The total exit rate from A is \(0.30\) per month. Over three months the probability of no exit is \(\exp(-0.30\times3)=\exp(-0.90)=0.4066\). The probability of exiting A by then is \(1-\exp(-0.90)=0.5934\).

With constant competing rates, the proportions of exits going to B and C are \(0.20/0.30\) and \(0.10/0.30\). Therefore,

$$ P(B\text{ at 3 months})= \frac{0.20}{0.30}\left(1-e^{-0.90}\right)=0.3956, \qquad P(C\text{ at 3 months})= \frac{0.10}{0.30}\left(1-e^{-0.90}\right)=0.1978. $$

The three probabilities are 0.4066 in A, 0.3956 in B, and 0.1978 in C; they sum to 1.0000 up to rounding. Since these rates do not depend on duration in A, the same predictions apply at elapsed durations zero and six months. This is the Markov prediction, not evidence that elapsed duration never matters in the underlying process.

Worked Example: Duration-Dependent Competing Risks

Hypothetical model. From A, transitions to absorbing B and C have hazards \(\alpha_{AB}(v)=0.6(0.10+0.05v)\) and \(\alpha_{AC}(v)=0.4(0.10+0.05v)\) per month, where \(v\) is time since entry into A, in months. Compare the probabilities over the next three months for people currently in A at durations zero and six months.

The total hazard is \(\lambda_A(v)=0.10+0.05v\), and the fixed 0.6 and 0.4 shares specify the destination given an exit. For current duration \(u\), the cumulative hazard over the prediction window is

$$ \int_u^{u+3}(0.10+0.05v)\,dv. $$

For \(u=0\), this is \(0.10(3)+0.025(3^2-0^2)=0.525\). The probability of remaining in A is \(e^{-0.525}=0.5916\), and the exit probability is \(1-e^{-0.525}=0.4084\). Splitting that exit probability by destination gives

$$ P(B\text{ in 3 months})=0.6(1-e^{-0.525})=0.2451, \qquad P(C\text{ in 3 months})=0.4(1-e^{-0.525})=0.1634. $$

For \(u=6\), the cumulative hazard is \(0.10(3)+0.025(9^2-6^2)=1.425\). Hence the probability of remaining in A is \(e^{-1.425}=0.2405\), and the probability of an exit is \(1-e^{-1.425}=0.7595\). The destination probabilities are

$$ P(B\text{ in 3 months})=0.6(1-e^{-1.425})=0.4557, \qquad P(C\text{ in 3 months})=0.4(1-e^{-1.425})=0.3038. $$

For each duration, the probabilities for A, B, and C sum to 1, allowing for rounding. The longer-duration individual has larger predicted exit probabilities because the specified hazard increases with duration. The comparison is conditional on already being in A at the stated duration; it is not an unconditional comparison of groups who entered A at different times.

Worked Example: A Later Transition Changes Horizon Occupancy

Hypothetical Markov model. A starts with transition rates \(q_{AB}=0.20\) and \(q_{AC}=0.10\) per month; B has rate \(q_{BC}=0.15\) per month; C is absorbing. Starting in A, calculate the state probabilities after three months. This checks why first-exit probabilities alone cannot generally give the final occupancy probabilities.

The probability of still occupying A is \(e^{-0.30(3)}=e^{-0.90}=0.4066\). To occupy B at month three, a transition from A to B must occur at some time \(s\) between 0 and 3, and the person must then remain in B until month three. The density of being in A up to \(s\) and moving to B then is \(e^{-0.30s}(0.20)\); survival in B for the remaining \(3-s\) months is \(e^{-0.15(3-s)}\). Therefore,

$$ P(B\text{ at 3}) =\int_0^3 e^{-0.30s}(0.20)e^{-0.15(3-s)}\,ds =\frac{0.20}{0.30-0.15}\left(e^{-0.15(3)}-e^{-0.30(3)}\right) =0.3081. $$

All remaining probability is in absorbing C, so \(P(C\text{ at 3})=0.2854\), calculated from the unrounded A and B probabilities. The resulting probabilities sum to 1.0001 because the displayed components are rounded. The integral includes paths that first enter B and remain there until month three; paths that subsequently move to C are excluded from B occupancy and contribute to C occupancy.

Justification, Diagnostics, and Model Choice

The residual-survival formula follows from the definition of a hazard. Over a short interval of length \(dv\) at duration \(v\), conditional on still being in A, the probability of exit is approximately \(\lambda_A(v)dv\). Thus survival over that interval is approximately \(1-\lambda_A(v)dv\). Multiplying these conditional survival factors over small intervals from \(u\) to \(u+h\), taking logarithms, and letting the maximum interval width approach zero gives

$$ S_i(h\mid u) =\lim_{\max dv\to0}\prod_v(1-\lambda_i(v)dv) =\exp\left\{-\int_u^{u+h}\lambda_i(v)\,dv\right\}. $$

This derivation requires a well-defined hazard and an appropriate duration clock. In the Markov special case, \(\lambda_i(v)\) and each destination-specific hazard are constant within the state. Then the integral depends on the prediction horizon but not on \(u\), giving the same residual predictions for all elapsed durations.

A useful comparison is to compute predictions at clinically meaningful durations and horizons under each specification, as in the examples. Differences are expected when hazards vary with duration, but differences alone do not show that the semi-Markov model is better. Check whether duration is measured from the right entry time, whether repeated visits reset or retain the clock according to the intended model, and whether calendar-time effects or omitted history could explain apparent duration patterns. Compare predictions with suitable observed outcomes and assess calibration at the horizons and states relevant to the application. Sparse observations at long durations can make those predictions especially uncertain.

FeatureMarkov specificationSemi-Markov specification
Conditioning for predictionCurrent state (and calendar time, if rates vary with calendar time)Current state and elapsed duration, under the stated memory structure
Prediction for same state, different durationsIdentical when calendar time and other conditioning information are the sameMay differ when transition hazards depend on duration
Practical advantageSimple transition-matrix calculations and compact state descriptionRepresents duration-related changes in transition risk directly
Practical limitationCan miss duration dependence and give poorly calibrated predictionsRequires duration-specific information and more detailed assumptions

A common mistake is to use the cumulative hazard from entry into A when predicting someone who has already survived there for \(u\) months. That computes an unconditional probability from entry, not a probability conditional on still being in A now. The required residual cumulative hazard is \(\int_u^{u+h}\lambda_A(v)\,dv\), not \(\int_0^{u+h}\lambda_A(v)\,dv\). Another error is to treat a first-exit probability as final occupancy when the destination can be left again. Use the renewal equation or an equivalent path calculation when further transitions are possible.

Neither model automatically handles unmeasured history, changing covariates, or misspecified state definitions. A semi-Markov prediction is only as useful as its duration clock and hazard structure; a Markov prediction can still be appropriate if duration adds little predictive information or if the simpler model is better supported. These are predictive comparisons, not causal effects.

Key takeaway: For a Markov model, future state probabilities do not change with elapsed time in the current state when current state and calendar time are fixed. For a semi-Markov model, calculate residual hazards from the current duration, then account for subsequent transitions if the target is horizon occupancy.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A time-homogeneous Markov model has a person in state A now. What information besides the prediction horizon is needed to calculate future state probabilities?
  2. A semi-Markov model has total hazard \(\lambda(v)=0.2\) per month for every duration \(v\). Does elapsed duration change the probability of remaining in the state for the next two months? Calculate it.
  3. For a duration-dependent hazard, why is \(\int_u^{u+h}\lambda(v)\,dv\) used for a prediction conditional on current duration \(u\), rather than \(\int_0^{u+h}\lambda(v)\,dv\)?
  4. In the third worked example, why is the probability of occupying B at month three smaller than the probability of having made an A-to-B transition by month three?

Solutions. (1) The current state and horizon are sufficient for a time-homogeneous Markov model with specified rates; elapsed time in A does not affect the prediction. (2) No. The probability of remaining for two more months is \(e^{-0.2(2)}=e^{-0.4}=0.6703\), regardless of elapsed duration. (3) The prediction is conditional on having survived in the state through duration \(u\), so only hazard after \(u\) contributes to future residual risk. Integrating from zero would include hazard before the prediction origin. (4) Some people who transition from A to B before month three subsequently move from B to absorbing C; occupancy in B at month three excludes those paths, while the first-transition probability includes them.

Clinical Biostats