Thursday, July 16, 2020

Time Series Methods for Modelling the Spread of Epidemics

Authors and guest post by Eren Ocakverdi

This blog piece intends to introduce two new add-ins (i.e. SEIRMODEL and TSEPIGROWTH) to EViews users’ toolbox and help close the gap between epidemiological models and time series methods from a practitioner’s point of view.

Table of Contents

  1. Introduction
  2. Susceptible-Exposed-Infected-Recovered (SEIR) model
  3. Observational Models
  4. Application to COVID-19 Data from Turkey
  5. Files
  6. References

Introduction

Spread of infectious diseases are usually described through compartmental models in mathematical epidemiology instead of observational time series models since analytical derivation of their dynamics are quite straightforward. These are merely structural models that divide the population into several states and then define the equations that govern the transition behavior from one state to another. In other words, state space models.

Susceptible-Exposed-Infected-Recovered (SEIR) model

I have written an add-in (SEIRMODEL) for interested EViews users, who would want to carry out their own analyses and gain basic insights into the systemic nature of an epidemic. The add-in implements a deterministic version of the SEIR model, which does not take into account vital dynamics like birth and death. Still, it offers a simplified framework for those who are not familiar with these concepts.

In order to run simulations, users need to provide required inputs (e.g. population size, calibration parameters, initial conditions etc.), details of which can be found in the documentation file that comes with the add-in:


Figure 1: SEIR Add-In Dialog

The default output is a chart showing the evolution of compartments/states during the spread of the epidemic. You can also save these series for further analysis.


Figure 2: SEIR Add-In Output

Observational Models

Structural modelling of epidemics becomes increasingly complex when the heterogeneity in the population, mobility issues, interactions, etc. are considered in the computations. Functions fitted to observed data for calibration purposes are mostly nonlinear, which can further complicate the estimation process. Harvey and Kuttman (2020) recently proposed useful observational time series methods particularly for generalized logistic and Gompertz growth curves. I have written an add-in (TSEPIGROWTH) that implements those methods outlined in the paper.

Suppose we wanted to fit these nonlinear curves to the number of infected individuals from the simulation of our earlier SEIR model:



Figure 3a: SEIR: Generalized Logistic Fit
Figure 3b: SEIR: Gompertz Growth Curve Fit

Above, c(4) denotes the growth rate parameter. At this point I would also suggest EViews users to try the GBASS add-in, which incorporates the generalized BASS model developed for modelling how new products (or new viruses for that matter!) get adopted into a population.

If we wanted to take the other venue offered by Harvey and Kuttman (2020) and estimate these parameters via observational methods, then we could simply run the add-in:


Figure 4: TSEPIGROWTH Add-In Dialog

Output from the state space specification of these models are as follows:



Figure 5a: TSEPIGROWTH: Generalized Logistic SS Model
Figure 5b: TSEPIGROWTH: Gompertz Growth Curve SS Model

Here, the final value of the state variable CHANGE, corresponds to the growth rate parameter and is more or less close to that of fitted nonlinear curves.

Application to COVID-19 Data From Turkey

Examples above may be important or useful from a pedagogical point of view, but we need to try these models on actual data to gain more insight from a practical perspective. Naturally, COVID-19 data would be the most recent and most appropriate place to start. Users can visit the previous blog post to learn how to fetch COVID-19 data from various sources. Here, I’ll use another data source provided by the WHO.

First, we fit a Gompertz curve to the level and make forecasts until the end of year. Next, we do the same exercise with the observational counterparts of the Gompertz model that focus on estimation of the growth rate.

The chart below visually compares the fitted values of growth:


Figure 6: Gompertz Fit Curves

The next plot displays the forecasted values for the level:

Figure 7: Gompertz Forecast Curves

These forecasts indicate different saturation levels, of which the nonlinear curve is the lowest. This is mainly because the inflection point of the fitted nonlinear curve implies levelling off at an earlier date. The first observational model has a deterministic trend, but performs better since it focuses on the growth rate. There is an obvious change in trend at the beginning of June as Turkey then announced the first phase of COVID-19 restriction easing and marked the start of the normalization process. Observational models allow us to model this change explicitly as a slope intervention:

Figure 8: Policy Intervention SS Model

The coefficient C(3) verifies that the growth rate has risen significantly as of June. Dynamic versions of the observational model of Gompertz fits a flexible trend to data so it adapts to changes in growth rates without any need for explicit modelling of the intervention. It also allows the analysis of the impact of policy/intervention from a counterfactual perspective. The plot below compares the out-of-sample forecasts of the dynamic model before and after the normalization period. The shift in the forecasted level of total cases is obvious!

Figure 9: Policy Intervention Out of Sample Forecast

Files




References

  1. Harvey, A. C. and Kattuman, P.: Time Series Models Based on Growth Curves with Applications to Forecasting Coronavirus Covid Economics: Vetted and Real-Time Papers, 24(1) 126–157, 2020.

3 comments:

  1. Thanks for your professional analysis and charts.

    ReplyDelete
  2. Policy intervention options not working, there seems to be some issue with the command like : tsepigrowth(ser="total_cases", growth="1", model="2", sample="3/12/2020 12/31/2020", policy="6/1/2020 7/12/2020") 'for Gompertz with slope intervention

    ReplyDelete
  3. It seems to work fine. You can see the built model in the workfile. There has to be a variable named "policy" in the workfile as well and c(3) is the estimated impact.

    ReplyDelete