Skip to content

From continuous to discrete time (and back)

The closed form solution of linear time-invariant systems allows us to gracefully transition from continuous time to discrete time and back. This is important because many disease models are implemented in discrete time, meaning that the state is updated at regular time intervals (for example, daily or weekly) instead of continuously. But often the input parameters are defined in continuous time, like the rate \(\lambda\).

Discrete time

Whereas a continuous time system is described by a differential equation, a discrete time system is described by a difference equation. Something like this:

\[x_{t+dt} = \gamma x_t\]

For this trivial example, the state at time \(t\), denoted \(x_t\), is multiplied by a constant factor of \(\gamma\) at each time step of duration \(dt\).

There is a strong connection between continuous time and discrete time systems. In fact, we can derive the discrete time system from the continuous time system! Recalling the solution to the continuous time system, we can set \(x(0)=x_t\) and \(t=dt\) to get:

\[x_{t+dt} = e^{-\lambda dt} x_t\]

Thus, if we set

\[\gamma = e^{-\lambda dt}\]

we have a discrete time system that is equivalent to the continuous time system with rate \(\lambda\).

Notice that if \(\lambda\) is positive, then \(\gamma\) will be less than 1.0, meaning that the state \(x\) will decrease over time.

Continuous time

To convert from discrete time back to continuous time, we can invert the relationship to get:

\[\lambda = -\frac{1}{dt} \ln(\gamma)\]

Here \(\ln(\cdot)\) is the base \(e\) "natural" logarithm, the inverse of the exponential function.

These relationships allow us to convert from continuous time to discrete time, or even from discrete time with one step size \(dt_1\) to discrete time with a different step size \(dt_2\). This discrete-to-discrete conversion is done by first converting discrete to continuous time to identify the underlying rate, and then using that rate with the new \(dt_2\) to get the new discrete time system.

Example: Disease recovery

Consider a closed population of a large number of individuals that have just been infected with a disease. The state of this system at any point in time is two numbers representing 1. the number of individuals that are still infectious and 2. the number of individuals that have recovered, denoted by \(I\) and \(R\), respectively. The system can be described by the following ordinary differential equations (ODEs):

\[ \begin{align} \frac{dI}{dt} &= -\lambda I \\ \frac{dR}{dt} &= \lambda I \end{align} \]

The solution to this differential equation is:

\[I(t) = e^{-\lambda t} I(0) \]
\[R(t) = \left(1 - e^{-\lambda t}\right) I(0) \]

assuming that no individuals were recovered at time \(t=0\).

We can use this solution to write a discrete time difference equation for this system denoting by \(dt\) the time step:

\[I_{t+dt} = \left(1 - p\right) I_t \]
\[R_{t+dt} = p I_t\]

Importantly,

\[p=1-e^{-\lambda dt}\]

is fraction of individuals that recover during the time step of length \(dt\).

Finally, note these equations treat both \(I\) and \(R\) as continuous variables, meaning we might have fractional numbers of individuals in each state. In the next section, we will see how to extend these dynamics to states that are discrete in the number of individuals.