
tbl.now: Tidy Data and Workflow Layer for Epidemic Nowcasting
Source:R/tbl.now-package.R
tbl.now-package.RdDefines tidy data structures and package-agnostic workflows for epidemiological nowcasting. The 'tbl_now' class records event, report, and revision dates alongside strata, covariates, censoring, and reporting-delay metadata while remaining compatible with 'dplyr'. Tools support validation, manipulation, diagnostics, visualization, format conversion, retrospective evaluation, and multiple modelling engines. The 'tbl_nowcast' class standardizes probabilistic predictions for plotting, scoring, comparison, and ensembling.
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 this end to end, from a raw line list to a scored
nowcast, and marks the point where you choose between a modelling package's
native fitting API and the common cross-engine one. The
package website carries longer
articles on the class itself, the modelling packages, batch reporting,
ensembles and writing your own backend.
Datasets
Seven surveillance datasets ship with the package for experimenting: denguedat, mpoxdat, flusight, covid_colombia, covid_us, sari_bh 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: