# 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 a series.

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.
\begin{align*} \begin{cases} \dfrac{\textrm{d}S}{\textrm{d}t} &= \_\_\_, \quad S(0) = \_\_\_ \\[5pt] \dfrac{\textrm{d}I}{\textrm{d}t} &= \_\_\_, \quad I(0) = \_\_\_ \\[5pt] \dfrac{\textrm{d}R}{\textrm{d}t} &= \_\_\_, \quad R(0) = \_\_\_ \end{cases} \end{align*}

If you’ve written the system correctly, then at $t=0$ you should have

\begin{align*} \dfrac{\textrm{d}S}{\textrm{d}t} = -0.3, \quad \dfrac{\textrm{d}I}{\textrm{d}t} = 0.28, \quad \dfrac{\textrm{d}R}{\textrm{d}t} = 0.02 \, . \end{align*}

## 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 a series.

Tags: