Skip to main content

effective reproduction number

Project description

Reff: effective reproduction number

Reff(data, si_mean, si_sd, tau=7, conf=0.95, mu=5):
input:
  data = daily number of incidence
  si_mean = mean of serial interval
  si_sd = standard deviation of serial interval
  tau = length of time window (integer in days)
  conf = confidence level of estimated Reff
  mu = mean of prior ditribution of Reff
return:
  R = daily Reff of shape (3,len(data))
  R[0:3] = median, min, max
reference:
  A. Cori et al
    American Journal of Epidemiology 178 (2013) 1505
      Web Appendix 1

example code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from Reff import Reff

# data from:
# https://github.com/nychealth/coronavirus-data
data = pd.read_csv('case-hosp-death.csv')
t = np.array(pd.to_datetime(data['DATE_OF_INTEREST']))
c = np.array(data['CASE_COUNT'])
R = Reff(c, 6.3, 4.2)
plt.semilogy(t, R.T)
plt.show()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Reff-0.0.2.tar.gz (2.1 kB view hashes)

Uploaded Source

Built Distribution

Reff-0.0.2-py3-none-any.whl (3.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page