
tbl.now: Tidy Extension for Nowcasting
tbl.now-package.RdProvides a 'tbl_now' class for temporal data for performing nowcasts. The 'tbl_now' allows for easy manipulation of event dates, report dates, strata and covariates for implementing different nowcasting models while at the same time permitting ease of use with 'dplyr' functions.
Details
Surveillance data arrives late. A case that happened on Monday may not reach the system until Thursday, so the most recent counts always look lower than they will turn out to be. Nowcasting corrects that: it estimates how many cases have already happened but have not been reported yet.
tbl.now is the tidy scaffolding around that problem. You declare which
columns hold the event date, the report date and anything else that matters
once, and everything else – describing, diagnosing, plotting, fitting,
scoring – follows from that declaration.
The workflow
Declare.
tbl_now()turns adata.frameinto atbl_now, oras_tbl_now()converts an object from another nowcasting package. The result is still atibble, sodplyrkeeps working.Describe. summary() says what is in the data; autoplot() draws it.
Diagnose.
diagnose()says what is wrong with it, and points at the statistical tests worth running –diagnose_drift()for delays that are getting longer,diagnose_batches()for backlog releases,diagnostic_plot()for the reporting process as a picture.Reshape.
to_count(),complete_zeroes(),aggregate_time_units(),align_weeks()and censor_reports() put the data on the grid a model needs.Fit.
run_nowcast()takes the data and anengine()– one interface over epinowcast, baselinenowcast, NobBS, EpiNow2, surveillance and diseasenowcasting. Write your own withnowcast_fit()andnowcast_tidy().Check.
score_nowcast()andnowcast_backtest()say whether the nowcast was any good;nowcast_ensemble()combines several.
vignette("tbl.now") walks through this end to end. The
package website carries longer
articles on the modelling packages, batch reporting, ensembles and writing
your own backend.
Datasets
Six surveillance datasets ship with the package for experimenting: denguedat, mpoxdat, flusight, covid_colombia, covid_us and hai_bucaramanga – the last deliberately messy, for the diagnostics.
Author
Maintainer: Rodrigo Zepeda-Tello rzepeda17@gmail.com (ORCID)
Authors:
Rodrigo Zepeda-Tello rzepeda17@gmail.com (ORCID)
Rami Yaari (ORCID)
Matteo Perini (ORCID)
Other contributors:
Teresa Yamana (ORCID) [contributor]
Jeffrey Shaman [contributor]
Columbia University in the City of New York [copyright holder, funder]