07
Constructing a stochastic SIR model
The stochastic SIR model has two independent event channels, but their noise contributions must be shared between the compartments changed by each event.
Start from two event channels
| Event | State-change vector \((S,I,R)\) | Rate |
|---|---|---|
| Infection | \((-1,+1,0)\) | \(a_1=\beta SI/N\) |
| Recovery | \((0,-1,+1)\) | \(a_2=\gamma I\) |
Each event produces both a mean contribution and a random contribution in its own state-change direction.
The stochastic SIR equations
\(W_1\) and \(W_2\) are independent Brownian motions representing infection and recovery fluctuations.
Why the same increment must be shared
An infection removes exactly what it adds: the term \(-\sqrt{a_1}dW_1\) in \(S\) is paired with \(+\sqrt{a_1}dW_1\) in \(I\). Likewise, recovery noise leaves \(I\) and enters \(R\). Therefore
Using separate random numbers for the two sides of one event would destroy population conservation.
Interactive Python laboratory
Output
Run the code to see the result.
Matrix viewpoint
With state-change matrix \(V\) and rate vector \(a(X)\), the event-derived diffusion can be written
This compact form becomes especially useful when SEIR adds a third event channel.
Conditions and interpretation
- Rates must be non-negative in the biological state space.
- The two Brownian increments are independent, but each increment is shared across compartments affected by its event.
- Continuous SDE states are approximations to integer counts.
- The displayed non-negativity projection is declared and counted; it is not part of the original SDE.
What this lesson adds
You can now construct a multivariable SIR diffusion from event vectors, preserve population through shared noise, and distinguish independent event channels from independent compartment noise.