Description Usage Arguments Details Value References Examples
View source: R/estimate_R_Bayes.R
estimate_R_Bayes
estimates the effective reproduction number (R_e)
using the method of Cori et al, but in a Bayesian framework allowing
(a) uncertainty in the serial interval distribution,
(b) imputation of missing symptom onset dates,
(c) extrapolation of infection dates, and (d) adjusting for
delays between diagnosis, symptom onset and infection ("nowcasting")
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
donset |
A vector of symptom onset dates (of class |
ddiag |
A vector of diagnosis dates (of class |
local |
A logical vector, of equal length to |
t_from |
Date (of class |
SI_mean |
Mean for the serial interval distribution, either a single value or two values defining a range; see 'Details' section. |
SI_std |
Standard Deviation for the serial interval distribution, either a single value or two values defining a range; see 'Details' section. |
t_window |
Window length for estimating a rolling instantaneous effective reproduction number, see 'Details' section. |
t_breaks |
Dates defining specific time windows for estimating the
effective reproduction number, or |
maxDate |
Maximum date for which to estimate the effective
reproduction number; if |
weights |
An optional vector of weights for the cases. If |
withInfectTimes |
Extrapolate infection times and use those for
estimating the effective reproduction number. If |
delayAdjust |
Adjust for delays in case ascertainment, using the distribution of times from symptom onset to diagnosis; see 'Details' section |
incub_mean |
Mean incubation period, used for extrapolating infection times from symptom onset dates. |
incub_std |
Standard deviation of the incubation period distribution, used for extrapolating infection times from symptom onset dates. |
date0 |
"Date zero" from which to start counting when converting the provided Date vectors to integers for MCMC fitting. Also, imputation of symptom onset and infection dates will start after this date. |
burn |
Number of burn-in MCMC iterations |
iter |
Number of sampling MCMC iterations |
estimate_R_Bayes()
allows flexibility in how to estimate
the effective reproduction number R_e, using different function arguments.
At the most basic, a vector of symptom onset dates must be provided
(argument donset
) and on this basis the R_e will be estimated, if
withInfectTimes = FALSE
. If withInfectTimes = TRUE
(the
default), the R_e is estimated on the basis of the infection times
imputed using a Gamma distribution with mean incub_mean
and
standard deviation incub_std
.
If a vector of diagnosis dates is also provided (argument ddiag
),
then donset
can have missing values, and these will be imputed
using the distribution of the time between symptom onset and diagnosis
(assumed to be Gamma, with parameters estimated from the data).
In addition, if diagnosis dates are provided, it is possible to use this
distribution (of the time between symptom onset and diagnosis) to
"nowcast" the epidemic, if the argument delayAdjust
is set to
TRUE
: the number of cases with symptom onset at each time is
divided by the probability of ascertainment by date maxDate
.
If argument t_breaks
is NULL
(the default), the function
estimates the instantaneous effective reproduction number, using rolling
weekly windows between dates t_start
and maxDate
. The size
of the window is adjusted by the argument t_window
.
Alternatively, t_breaks
can contain a vector of dates that define
(together with t_breaks
and maxDate
) specific periods for
which the effective reproduction number will be estimated.
Arguments SI_mean
and SI_std
can receive either one or two
values. If one value is provided, the parameter is assumed fixed.
If two values are provided, these define a range from which the parameter
is randomly sampled (using a uniform distribution). This allows
to incorporate uncertainty in estimating the serial interval
distribution parameters.
An object of class 'bayEStim'. This is a list containing the following elements:
The fitted model; an object of class rjags
An object of class coda
containing the MCMC samples for
the various model parameters.
A list of all configuration parameters used in the model.
Objects of class 'bayEStim' can be summarized and plotted, see the respective methods for details.
Cori A, Ferguson NM, Fraser C, Cauchemez S. A new framework and software to estimate time-varying reproduction numbers during epidemics. Am J Epidemiol 2013;178(9):1505–12 (PubMed)
Thompson RN, Stockwin JE, van Gaalen RD, et al. Improved inference of time-varying reproduction numbers during infectious disease outbreaks. Epidemics 2019;29:100356 (PubMed)
1 | # We'll eventually put some examples here
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.