Learn R Programming

R0 (version 1.2-10)

est.R0.SB: Estimate the time dependent reproduction number using a Bayesian approach

Description

Estimate the time dependent reproduction number using a Bayesian approach. All known data are used as a prior for next iteration (see Details).

Usage

est.R0.SB(epid, GT, t = NULL, 
    begin = NULL, end = NULL, 
    date.first.obs = NULL, 
    time.step = 1, force.prior = FALSE, 
    checked = FALSE, 
    ...)

Value

A list with components:

R

vector of R values.

conf.int

95% confidence interval for estimates.

proba.Rt

A list with successive distribution for R throughout the outbreak.

GT

Generation time distribution used in the computation.

epid

Original epidemic data.

begin

Begin date for the fit.

begin.nb

Index of begin date for the fit.

end

End date for the fit.

end.nb

Index of end date for the fit.

pred

Predictive curve based on most-likely R value.

data.name

Name of the data used in the fit.

call

Complete call used to generate results.

method

Method for estimation.

method.code

Internal code used to designate method.

Arguments

epid

the epidemic curve

GT

generation time distribution

t

Time at which epidemic was observed

begin

At what time estimation begins. Just there for "plot" purposes, not actually used

end

At what time estimation ends. Just there for "plot" purposes, not actually used

date.first.obs

Optional date of first observation, if t not specified

time.step

Optional. If date of first observation is specified, number of day between each incidence observation

force.prior

Set to any custom value to force the initial prior as a uniform distribution on [0;value]

checked

Internal flag used to check whether integrity checks were ran or not.

...

parameters passed to inner functions

Author

Pierre-Yves Boelle, Thomas Obadia

Details

For internal use. Called by est.R0.

Initial prior is an unbiased uniform distribution for R, between 0 and the maximum of incid(t+1) - incid(t). For each subsequent iteration, a new distribution is computed for R, using the previous output as new prior.

CI is achieved by a cumulated sum of the R posterior distribution, and corresponds to the 2.5% and 97.5% thresholds

References

Bettencourt, L.M.A., and R.M. Ribeiro. "Real Time Bayesian Estimation of the Epidemic Potential of Emerging Infectious Diseases." PLoS One 3, no. 5 (2008): e2185.

Examples

Run this code
#Loading package
library(R0)

## Data is taken from the paper by Nishiura for key transmission parameters of an institutional
## outbreak during 1918 influenza pandemic in Germany)

data(Germany.1918)
mGT <- generation.time("gamma", c(3,1.5))
SB <- est.R0.SB(Germany.1918, mGT)

## Results will include "most likely R(t)" (ie. the R(t) value for which the computed probability 
## is the highest), along with 95% CI, in a data.frame object
SB
# Reproduction number estimate using  Real Time Bayesian  method.
# 0 0 2.02 0.71 1.17 1.7 1.36 1.53 1.28 1.43 ...

SB$Rt.quant
# Date R.t. CI.lower. CI.upper.
# 1  1918-09-29 0.00      0.01      1.44
# 2  1918-09-30 0.00      0.01      1.42
# 3  1918-10-01 2.02      0.97      2.88
# 4  1918-10-02 0.71      0.07      1.51
# 5  1918-10-03 1.17      0.40      1.84
# 6  1918-10-04 1.70      1.09      2.24
# 7  1918-10-05 1.36      0.84      1.83
# 8  1918-10-06 1.53      1.08      1.94
# 9  1918-10-07 1.28      0.88      1.66
# 10 1918-10-08 1.43      1.08      1.77
# ...

## "Plot" will provide the most-likely R value at each time unit, along with 95CI
plot(SB)
## "Plotfit" will show the complete distribution of R for 9 time unit throughout the outbreak
plotfit(SB)

Run the code above in your browser using DataLab