skip to content
Ben Lau statistics . machine learning . programming . optimization . research
Effective Reproduction Rate

Covid Bayesian Analysis

3 min read Updated: Code

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]

Daily New Cases trace plot

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