Solving ODE and Application to COVID 19

2021-5-11

Zhiyuan Chen

Examples of ODE

Let's solve the equation:

$$ \frac{du}{dt} = f(u,p,t) = \alpha u $$

We know the solution would be:

$$ u(t) = u_0\exp(\alpha t) $$

Example 2: Systems of Equations

Let's solve the following system of differential equations: \begin{align} \frac{dx}{dt} & = \sigma (y-x) \\ \frac{dy}{dx} & = x(\rho - z) - y \\ \frac{dz}{dt} & = xy - \beta z \end{align}

Defining Parameterized Functions

Example 3: Solving Nonhomogeneous Equations using Parameterized Functions

Consider the following non-homogeneous equations:

\begin{align} \frac{d\theta(t)}{dt} & = \omega(t) \\ \frac{d\omega(t)}{dt} & = -\frac{3}{2}\frac{g}{l} sin \theta(t) +\frac{3}{ml^2}M(t) \end{align}

Example 4: Using Other Types for Systems of Equations

Modeling COVID 19 with Differential Equations

The model is based on Andrew Atkeson (NBER w26876, 2020), Atkeson et al. (NBER w27335, 2020), Fernandez-Villaverde and Jones (NBER w27128, 2020)

The SEIR Model

In the version of the SEIR model, all individuals in the population are assumed to be in a finite number of states.

The states are: susceptible (S), exposed (E), infected (I) and removed (R).

This type of compartmentalized model has many extensions (e.g. SEIRS relaxes lifetime immunity and allow transitions from R→S).

Comments:

Those in state R have been infected and either recovered or died. Note that in some variations, R may refer only to recovered agents. Those who have recovered, and live, are assumed to have acquired immunity. Those in the exposed group are not yet infectious.

Changes in the Infected State

In the SEIR model, the flow across states follows the path $S-> E -> I -> R$ The number of individuals is of size $N$; we ignore birth and non-covid death. This means that

$$ S(t)+E(t)+I(t)+R(t) = N $$

for all $t$.

We assume that $N$ is large, so we use continuum approximation for the number of individuals for each state.

Parameters governing the transition rates:

The full SEIR model is characterized by following equations:

\begin{align} \frac{dS}{dt} &= -\beta S \frac{I}{N} \\ \tag{1} \frac{dE}{dt} &= \beta S \frac{I}{N} -\sigma E \\ \frac{dI}{dt} & = \sigma E -\gamma I \\ \frac{dR}{dt} & = \gamma I \end{align}

Basic Reproduction Number

We could define $R_0(t):=\beta (t)/\gamma$. This is the famous basic reproduction number for the SEIR model:

Prior to solving the model, we make a few changes:

\begin{align} \frac{ds}{dt} &= -\gamma R_0 s i \\ \frac{de}{dt} &= \gamma R_0 s i - \sigma e \\ \frac{di}{dt} &= \sigma e - \gamma i \\ \frac{dr}{dt} &= \gamma i \end{align}

The "removed" fraction of the population is $r = 1-s -e -i$

Implementation

We begin by implementing a simple version of this model with a constant $R_0$ and some baseline parameter values (which we discuss later).

Extension of the Model

Cumulative case load is defined as $c(t) = i(t) + r(t)$ and

$$ \frac{dc}{dt} = \sigma e $$

We assume that the transmission rate $R_0(t)$ follows:

$$ \frac{dR_0}{dt} = \eta (\bar{R}_0-R_0) $$

Define the cumulative number of deaths as $D(t)$ and the proportion of death is $d(t):=D(t)/N$

$$ \frac{d}{dt}d(t) = \delta \gamma i $$

The system of equations for the model can be re-written accordingly with 3 additional states.

Implementation

Experiments

While it may seem that 45 time intervals is extremely small for that range, for much of the t, the functions are very flat - and hence adaptive time-stepping algorithms can move quickly and interpolate accurately.

A few more comments:

If you want to ensure that there are specific points that the adaptive-time stepping must include (e.g. at known discontinuities) use tstops. The built-in plots for the solutions provide all of the attributes in Plots.jl. See here for details on analyzing the solution and extracting the output.

Experiment 1: Constant Reproduction Case

$\bar{R}_0(t) = R_{0n}$ is constant.

Experiment 2: Changing Mitigation

Let’s look at a scenario where mitigation (e.g., social distancing) is successively imposed, but the target (maintaining $R_{0n}$) is fixed.

We will examine the case where $R_0(0)=3$ and then it falls to $R_{0n}=1.6$ due to the progressive adoption of stricter mitigation measures.

Ending Lockdown

Consider these two mitigation scenarios:

For both of these, we will choose a large η to focus on the case where rapid changes in the lockdown policy remain feasible.