tbl.now provides an
extension of the tibble() for
storing, validating, and manipulating epidemiological nowcasting data.
It standardizes the representation of event dates, report dates, strata,
temporal covariates, etc and in a way that is compatible with many
frameworks including diseasenowcasting, epinowcast, NobBS, surveillance,
EpiNow2, and more.
Specifically a tbl_now is a data structure that keeps track of the
following attributes relevant for a nowcasting excercise so that all
dplyr transformations (i.e. the ones from tidyverse) keep track of the
relevant nowcasting variables:
You can specify an object as a tbl.now with the tbl_now command:
library(dplyr)
library(tbl.now)
data(denguedat)
#Here we use just a few dates for the example
denguedat <- denguedat |>
filter(onset_week >= as.Date("2005/01/01")) |>
filter(onset_week <= as.Date("2005/10/01") & report_week <= as.Date("2005/10/01")) |>
tbl_now(
report_date = report_week,
event_date = onset_week,
strata = gender
) Once transformed, it can help you diagnose data problems or modeling requirements with your database:
autoplot(denguedat)And it can be used to run any of multiple nowcast libraries through the
engine() and run_nowcast specifications. For example,
baselinenowcast:
dengue_nowcast_1 <- denguedat |>
run_nowcast(engine = engine_baselinenowcast())autoplot(dengue_nowcast_1)or diseasenowcasting:
dengue_nowcast_2 <- denguedat |>
run_nowcast(engine = engine_diseasenowcasting())autoplot(dengue_nowcast_2)It can also generate ensemble nowcasts combining multiple engines or multiple realizations from the same engine:
dengue_ensemble <- nowcast_ensemble(
baselinenowcast = dengue_nowcast_1,
diseasenowcasting = dengue_nowcast_2
)autoplot(dengue_ensemble)If this seems exciting to you, install the development version from GitHub:
# install.packages("pak") # <- uncomment if you do not have `pak`
pak::pkg_install("RodrigoZepeda/tbl.now")and checkout our articles starting with the Introduction:
- Introduction vignette:
https://rodrigozepeda.github.io/tbl.now/articles/tbl.now.html for
the full anatomy of a
tbl_now, data types, and temporal effects. - End-to-end tutorial on real, messy surveillance data — cleaning, diagnostics and nowcasting: https://rodrigozepeda.github.io/tbl.now/articles/example.html
- Tutorial on diagnosing your dataset — what is in it, what is structurally wrong with it, and detecting batches and other reporting-delay artifacts: https://rodrigozepeda.github.io/tbl.now/articles/diagnosing-a-tbl-now.html
- Using different nowcasting engines for the same dataset: https://rodrigozepeda.github.io/tbl.now/articles/nowcasting-models.html
- Ensemble nowcasting across different engines https://rodrigozepeda.github.io/tbl.now/articles/ensemble-nowcasting.html
- Adding your own nowcasting model https://rodrigozepeda.github.io/tbl.now/articles/custom-nowcast-models.html
- Package reference: https://rodrigozepeda.github.io/tbl.now/reference/




