SIR Model For the Spread of Disease
A simple differential equations model that we can plot using multivariable Euler estimation.
This post is part of the book Introduction to Algorithms and Machine Learning: from Sorting to Strategic Agents. Suggested citation: Skycak, J. (2021). SIR Model For the Spread of Disease. In Introduction to Algorithms and Machine Learning: from Sorting to Strategic Agents. https://justinmath.com/sir-model-for-the-spread-of-disease/
Want to get notified about new posts? Join the mailing list.
One of the simplest ways to model the spread of disease using differential equations is the SIR model. Let’s construct a SIR model and use our multivariable Euler estimator to plot the solution curves.
The SIR model assumes three sub-populations: susceptible, infected, and recovered.
- The number of susceptible people $(S)$ decreases at a rate proportional to the rate of meeting between susceptible and infected people (because susceptible people have a chance of catching the disease when they come in contact with infected people).
- The number of infected people $(I)$ increases at a rate proportional to the rate of meeting between susceptible and infected people (because susceptible people become infected after catching the disease), and decreases at a rate proportional to the number of infected people (as the diseased people recover).
- The number of recovered people $(R)$ increases at a rate proportional to the number of infected people (as the diseased people recover).
Exercise: SIR Model Equations and Initial Conditions
First, write a system of differential equations using the following assumptions:
- There are initially $1000$ susceptible people and $1$ infected person.
- The number of meetings between susceptible and infected people each day is proportional to the product of the numbers of susceptible and infected people, by a factor of $0.01.$ The transmission rate of the disease is $3\%.$ (In other words, $3\%$ of meetings result in transmission.)
- Each day, $2\%$ of infected people recover.
If you’ve written the system correctly, then at $t=0$ you should have
Exercise: SIR Model Simulation
Then use your multivariable Euler estimator to simulate the solution curve, and plot the result.
- Be sure to choose the step size small enough that the simulation doesn't blow up, but large enough that it doesn't take long to run.
- Likewise, choose an interval that displays all the main features of the differential equation, i.e. an interval that shows the behavior of the curves until they start to asymtpote off.
If your plot is correct, then you should be able to easily describe what is happening in the plot and why it is happening.
This post is part of the book Introduction to Algorithms and Machine Learning: from Sorting to Strategic Agents. Suggested citation: Skycak, J. (2021). SIR Model For the Spread of Disease. In Introduction to Algorithms and Machine Learning: from Sorting to Strategic Agents. https://justinmath.com/sir-model-for-the-spread-of-disease/
Want to get notified about new posts? Join the mailing list.