nowcaster provides statistical models for correcting notification delays in epidemiological data. It estimates the number of events, such as cases or deaths, that have already happened but have not been reported yet, using the empirical delay distribution between the date of onset and the date of report.
Every notification system has a delay between the date of onset of an event and its date of report. nowcaster fits a negative binomial model to the delay triangle, with smooth effects for the time of onset and for the reporting delay, following Bastos et al. (2019). The package was built during the Covid-19 pandemic for the Brazilian Severe Acute Respiratory Illness (SARI) surveillance system, SIVEP-Gripe, and works with any line list that has a date of onset and a date of report.
Installation
Install the released version from CRAN:
install.packages("nowcaster")Or the development version from GitHub:
# install.packages("remotes")
remotes::install_github("covid19br/nowcaster")Dependencies
nowcaster has two workhorse functions:
-
nowcasting_inla()fits the model in a fully Bayesian way withINLA, which is not on CRAN and has to be installed separately:
install.packages("INLA",
repos = c(getOption("repos"),
INLA = "https://inla.r-inla-download.org/R/stable"),
dep = TRUE)-
nowcasting_mgcv()fits the model as a GAM withmgcv, installed together withnowcaster.
Example
library(nowcaster)
# SARI cases from Belo Horizonte, Brazil, shipped with the package
data(sragBH)
nowcast <- nowcasting_inla(dataset = sragBH,
date_onset = DT_SIN_PRI,
date_report = DT_DIGITA)
# Median and 50% / 95% intervals of the number of cases per week of onset
head(nowcast$total)See Get Started for a full walk-through, Nowcasting with mgcv for the mgcv version and the articles on age-structured nowcasting and forecasting.

