← Python Programming

Part 2: Discrete-Time Markov Chains

This pathway separates the DTMC ideas carefully. First define states and valid probabilities, then learn random selection and trajectory construction, apply the method to SIS, SIR and SEIR, and finally study distributions, repeated simulations and outbreak outcomes.

Stage A: Define the stochastic model

Understand what the system records, what probabilities must satisfy and how biological events determine possible transitions.

Stage B: Generate one stochastic trajectory

Move from probabilities to random event selection, then apply one transition repeatedly while storing a valid path.

Stage C: Build epidemic DTMC models

Apply the common simulation mechanism to three biologically distinct compartment structures.

Stage D: Calculate state distributions

Study the matrix approach, which evolves an entire probability distribution rather than selecting one random trajectory.

Stage E: Estimate outcomes and communicate uncertainty

Use independent simulations to estimate distributions and probabilities, then select visual and tabular summaries appropriate to discrete stochastic data.

Coverage and non-duplication rule

Lessons 1–6 teach the generic DTMC mechanism once. Lessons 7–9 apply that mechanism to different biological models. Lessons 10–11 calculate probability distributions without random sampling. Lessons 12–14 use Monte Carlo simulation to estimate outcomes and communicate uncertainty. Each later lesson may reuse earlier code, but should explain only its genuinely new modelling or programming idea.