This project uses Bayesian methods and probabilistic programming to analyze the COVID-19 pandemic. It estimates effective reproduction rate and daily new cases for Hong Kong. The data is obtained from DATA.GOV.HK.
The main idea is based on rtlive and k-sys/covid-19 by Thomas Wiecki and Kevin Systrom. The model is a State Space Model with Gaussian random walk prior, implemented in PyMC.
A few plots are generated to visualize the results. Note that time series plots are mostly in aspect ratio 21:9 for better visualization.[1][2]

Ideas
- Used state space model and Bayesian model to provide a generalized framework to model the COVID-19 pandemic with building blocks. i.e. The combination allows me to encode any prior knowledge and assumptions into the model iteratively.
- Model infection delay by using generation time distribution
- Model onset to confirmation delay by applying 1d convolution with n days pmf
- Model variance >> mean due to breakouts and settlements in epidemic waves by using negative binomial distribution instead of Poisson to avoid over-dispersion
- Model unpredictable human behavior by using Gaussian random walk prior
- Model excess zeros to avoid downward bias on parameter estimates by using zero-inflated negative binomial distribution
Acknowledgements
Implementations and Tutorials
- rtlive
- uses State Space Model with Gaussian random walk prior
- Youtube@The Bayesian Workflow: Building a COVID-19 Model by Thomas Wiecki
- generative-rtlive.ipynb — Thomas Wiecki
- rtcovidlive/covid-model/generative.py — Thomas Wiecki
- rtcovidlive/rtlive-global/Tutorial_model.ipynb — Kevin Systrom
- k-sys/covid-19 — Kevin Systrom, founder of Instagram
- k-sys/covid-19/Realtime R0.ipynb — Kevin Systrom
- no probabilistic library, uses max-likelihood estimation
- uses Gaussian Processes
- alternatives:
- farr/covid-19/Stan R0.ipynb — Will M. Farr
- based on
k-sys/covid-19/Realtime R0.ipynb
, but using Bayesian posterior - similar to
k-sys/covid-19/Realtime Rt mcmc.ipynb
, but estimating of confirmation instead.
- based on
- discussion on github issue: binomial distribution instead of a Poisson
- discussion on github issue: smoothing
- farr/covid-19/Stan R0.ipynb — Will M. Farr
- k-sys/covid-19/Realtime Rt mcmc.ipynb — Kevin Systrom
- Ideas
- attempt to account for delays between infection, onset, and confirmation
- Translate Confirmation Dates to Onset Dates
- Adjust for Right-Censoring
- Implemented Gaussian random walk prior model and Gaussian process prior model
- Sample the Posterior with PyMC3
- inspired by Thomas Vladdeck’s work
- helped by Thomas Wiecki
- Ideas
- k-sys/covid-19/Realtime R0.ipynb — Kevin Systrom
- tvladeck/covid-rt — Thomas P. Vladeck
- uses State Space Model
- implemented in Stan
- Blog: Using State Space Models to Estimate Rt — Thomas P. Vladeck
- background on this is
k-sys/covid-19/Realtime R0.ipynb
- update: Extending the State Space Approach with Mixed Effects
- background on this is
- luisroque/bayesian_time_series | Forecasting new COVID19 cases in Portugal using Gaussian Processes.ipynb
- uses Gaussian Processes
- Blog: Reflections on two years estimating effective reproduction numbers
- twiecki/covid19 bunch of ipynb — Thomas Wiecki
- Compartmental model
- dsheldon/covid — Bayesian SEIRD model
- Youtube@SIR model — Thomas Wiecki
- Priesemann-Group implementations
- uses SIR/SEIR models
- Priesemann-Group/covid19_inference
- Priesemann-Group/covid19_inference_forecast
- Research Article published in Science: Inferring change points in the spread of COVID-19 reveals the effectiveness of interventions
- Talk: Inferring the spread of SARS-CoV-2 --- and measures to mitigate it (Viola Priesemann)
- Discussion: SIR ODE model with Sunode
- tensorflow/probability/Estimating_COVID_19_in_11_European_countries.ipynb
- fine tuned bijectors to solve problem of heaviness of tails of lognormal distribution and make inference fast and numerically more stable
- broadinstitute/pyro-cov | Pyro models for SARS-CoV-2 analysis
- implemented in Pyro
- Research Article published in Science: Analysis of 6.4 million SARS-CoV-2 genomes identifies mutations associated with fitness
- epidemics/COVIDNPIs
- Causal inference on excess deaths due to COVID-19
- it is a tutorial on causal inference based on Google’s CausalImpact using PyMC3