← Discrete-Time Markov Chains

02

Transition probabilities and their conditions

A transition probability quantifies uncertainty about the next state, conditional on the current state. Before probabilities can drive a simulation, they must form a complete and mathematically valid distribution.

Biological scenario

A five-person SIR system is currently in state \(x=(4,1,0)\). For the next one-day step, suppose a model has already supplied three possible next states and their probabilities.

Our task is not yet to derive or randomly select these probabilities. We first check whether they form a valid next-state distribution.

Conditional transition notation

\[P(x,y)=\Pr(X_{n+1}=y\mid X_n=x).\]

Read this as:

“The probability that the next state is \(y\), given that the current state is \(x\).”

\(X_n\)

The random state at the current step.

\(x\)

The particular current-state value being conditioned on.

\(y\)

One possible value of the next state.

A supplied next-state distribution

From \(x=(4,1,0)\), suppose the model supplies:

Possible next state \(y\)Probability \(P(x,y)\)Percentage
\((3,2,0)\)0.2525%
\((4,0,1)\)0.1515%
\((4,1,0)\)0.6060%
Total1.00100%

A probability of 0.25 means a 25% chance under the model for that one-day transition. It does not mean the outcome must occur once in every four consecutive steps.

Three essential probability conditions

Non-negative\[P(x,y)\geq0\]
At most one\[P(x,y)\leq1\]
Complete total\[\sum_yP(x,y)=1\]

The sum is taken over every allowed next state from the current state \(x\).

Why must the probabilities sum to one?

The listed next-state outcomes must be:

If the probabilities total 0.85, then 0.15 of the probability has not been assigned to any outcome. If they total 1.12, the outcomes overlap or the model has assigned too much probability.

Probabilities depend on the current state

Current state \((4,1,0)\)

Several next states may be possible because susceptible and infectious people are present.

Current state \((4,0,1)\)

With no infectious people, transitions requiring current infection may be impossible in a closed epidemic model.

Therefore, one probability list cannot normally be reused for every state. The transition distribution is conditional on \(X_n=x\).

Impossible transitions

A transition that the model does not permit must receive probability zero:

\[P(x,y)=0.\]

For example, from an SIR extinction state with \(I=0\) and no importation, a new infection cannot arise because no infectious source is present.

Probability zero is a modelling statement. It means the event is impossible under the specified model assumptions, not necessarily impossible in the real biological world.

Absorbing states

A state \(a\) is absorbing when the process remains there with probability one:

\[P(a,a)=1.\]

All transitions from \(a\) to different states have probability zero.

In a closed epidemic model without imported infection, a state with no infectious or exposed individuals may be absorbing because the epidemic cannot restart.

The fixed step belongs to the probability definition

A one-day transition probability and a one-week transition probability are different quantities:

\[\Pr(X_{n+1}=y\mid X_n=x,\Delta t=1\text{ day})\]

is not generally equal to

\[\Pr(X_{n+1}=y\mid X_n=x,\Delta t=7\text{ days}).\]

Changing \(\Delta t\) changes the stochastic transition model, not merely the resolution of a graph.

Time-step validity

Some DTMC probabilities are constructed from event rates multiplied by \(\Delta t\). In that situation, the combined probability assigned to changing state must not exceed one.

\[p_1(x)+p_2(x)+\cdots+p_k(x)\leq1.\]

The remaining probability can then be assigned to staying in the current state:

\[p_{\mathrm{stay}}(x)=1-\sum_{j=1}^{k}p_j(x).\]

If the event-probability sum exceeds one, the time step or probability construction is invalid. Lesson 3 will connect this rule to infection and recovery mechanisms.

Validate supplied probabilities in Python

Store probabilities in a dictionary

probabilities = {
    "(3, 2, 0)": 0.25,
    "(4, 0, 1)": 0.15,
    "(4, 1, 0)": 0.60
}

Each dictionary key names a possible next state and each value stores its probability.

Check bounds and total

for probability in probabilities.values():
    if probability < 0 or probability > 1:
        raise ValueError("Probability outside [0, 1].")

total = sum(probabilities.values())
tolerance = 1e-12

if abs(total - 1) > tolerance:
    raise ValueError("Probabilities do not sum to 1.")

values() returns the stored dictionary values. A tolerance allows for tiny floating-point rounding differences.

Run the probability validator

Interactive PythonTransition-probability validation

Output

Run the code to see the result.

Understand the new code

CodeMeaning
probabilities.items()Returns each dictionary key and value together.
probabilities.values()Returns the probability values without their keys.
sum(...)Adds the probability values.
list(probabilities.keys())Creates a list of next-state labels for the graph.
abs(total_probability - 1)Measures the numerical distance between the total and one.
plt.ylim(0, 1)Uses the natural probability scale from zero to one.

Try invalid distributions

Test each modification separately:

  1. Change 0.60 to 0.50, making the total 0.90.
  2. Change 0.60 to 0.80, making the total 1.20.
  3. Change 0.15 to −0.15.
  4. Restore the valid distribution after each test.

Read the resulting error and identify which mathematical condition failed.

Boundary of this lesson

The probabilities were supplied rather than derived. We have not used a random number and have not selected or applied a transition. Lesson 3 derives biological event probabilities; Lesson 4 maps probabilities to random-number intervals.