estimRmcmc: Estimation of the reproduction number with...

View source: R/estimRmcmc.R

estimRmcmcR Documentation

Estimation of the reproduction number with Laplacian-P-splines via MCMC

Description

This routine estimates the instantaneous reproduction number R_t; the mean number of secondary infections generated by an infected individual at time t (White et al. 2020); by using Bayesian P-splines and Laplace approximations (Gressani et al. 2022). The inference approach is fully stochastic with a Metropolis-adjusted Langevin algorithm. The estimRmcmc() routine estimates R_t based on a time series of incidence counts and a (discretized) serial interval distribution. The negative binomial distribution is used to model incidence count data and P-splines (Eilers and Marx, 1996) are used to smooth the epidemic curve. The link between the epidemic curve and the reproduction number is established via the renewal equation.

Usage

estimRmcmc(incidence, si, K = 30, dates = NULL, niter = 5000, burnin = 2000,
 CoriR = FALSE, WTR = FALSE, priors = Rmodelpriors(), progressbar = TRUE)

Arguments

incidence

A vector containing the incidence time series. If incidence contains NA values at certain time points, these are replaced by the average of the left- and right neighbor counts. If the right neighbor is NA, the left neighbor is used as a replacement value.

si

The (discrete) serial interval distribution.

K

Number of B-splines in the basis.

dates

A vector of dates in format "YYYY-MM-DD" (optional).

niter

The number of MCMC samples.

burnin

The burn-in size.

CoriR

Should the R_t estimate of Cori (2013) be also computed?

WTR

Should the R_t estimate of Wallinga-Teunis (2004) be also computed?

priors

A list containing the prior specification of the model hyperparameters as set in Rmodelpriors. See ?Rmodelpriors.

progressbar

Should a progression bar indicating status of MCMC algorithm be shown? Default is TRUE.

Value

A list with the following components:

  • incidence: The incidence time series.

  • si: The serial interval distribution.

  • RLPS: A data frame containing estimates of the reproduction number obtained with the Laplacian-P-splines methodology.

  • thetahat: The estimated vector of B-spline coefficients.

  • Sighat: The estimated variance-covariance matrix of the Laplace approximation to the conditional posterior distribution of the B-spline coefficients.

  • RCori: A data frame containing the estimates of the reproduction obtained with the method of Cori (2013).

  • RWT: A data frame containing the estimates of the reproduction obtained with the method of Wallinga-Teunis (2004).

  • LPS_elapsed: The routine real elapsed time (in seconds) when estimation of the reproduction number is carried out with Laplacian-P-splines.

  • penparam: The estimated penalty parameter related to the P-spline model.

  • K: The number of B-splines used in the basis.

  • NegBinoverdisp: The estimated overdispersion parameter of the negative binomial distribution for the incidence time series.

  • optimconverged: Indicates whether the algorithm to maximize the posterior distribution of the hyperparameters has converged.

  • method: The method to estimate the reproduction number with Laplacian-P-splines.

  • optim_method: The chosen method to to maximize the posterior distribution of the hyperparameters.

  • HPD90_Rt: The 90\% HPD interval for Rt obtained with the LPS methodology.

  • HPD95_Rt: The 95\% HPD interval for Rt obtained with the LPS methodology.

Author(s)

Oswaldo Gressani oswaldo_gressani@hotmail.fr

References

Gressani, O., Wallinga, J., Althaus, C. L., Hens, N. and Faes, C. (2022). EpiLPS: A fast and flexible Bayesian tool for estimation of the time-varying reproduction number. Plos Computational Biology, 18(10): e1010618.

Cori, A., Ferguson, N.M., Fraser, C., Cauchemez, S. (2013). A new framework and software to estimate time-varying reproduction numbers during epidemics. American Journal of Epidemiology, 178(9):1505–1512.

Wallinga, J., & Teunis, P. (2004). Different epidemic curves for severe acute respiratory syndrome reveal similar impacts of control measures. American Journal of Epidemiology, 160(6), 509-516.

White, L.F., Moser, C.B., Thompson, R.N., Pagano, M. (2021). Statistical estimation of the reproductive number from case notification data. American Journal of Epidemiology, 190(4):611-620.

Eilers, P.H.C. and Marx, B.D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science, 11(2):89-121.

Examples

# Illustration on the 2009 influenza pandemic in Pennsylvania.
data(influenza2009)
epifit_flu <- estimRmcmc(incidence = influenza2009$incidence, dates = influenza2009$dates,
                         si = influenza2009$si[-1], niter = 2500,
                         burnin = 1500, progressbar = FALSE)
tail(epifit_flu$RLPS)
summary(epifit_flu)
plot(epifit_flu)


EpiLPS documentation built on May 29, 2024, 9:40 a.m.