Skip to contents

The tbl_now class

Create one, check it, and move between the three data types.

tbl_now() experimental
Create a tbl_now object
as_tbl_now() experimental
Transform an object into a tbl_now
validate_tbl_now() is_tbl_now() experimental
Check that an object is a valid tbl_now
tbl_now_attributes() stable
List what a tbl_now was told about itself
to_count() stable
Convert between linelist and aggregated count data

Attributes

Read what the object was told about itself, and change it.

Reshaping

Put the data on the grid a model needs.

aggregate_time_units() experimental
Coarsen a tbl_now onto a bigger time unit
align_weeks() week_2_date() experimental
Put weekly data on a common weekday
complete_zeroes() experimental
Fill in the days when nothing was reported
censor_reporting_delays_above() censor_reports() censor_reporting_delays() censor_validations() censor_validation_delays() censor_validation_delays_above() experimental
Record a report or a delay as a bound rather than a fact
is_weekday() stable
Is a date a weekday or a weekend?

Temporal effects

Calendar structure, recorded lazily and materialised on demand.

temporal_effects() stable
Calendar effects to include in a nowcast
add_temporal_effects() compute_temporal_effects() stable
Attach calendar effects to a tbl_now, and turn them into columns

The validation process

The optional third date, and the outcomes it carries.

get_latest_validated_cases() get_initial_validated_cases() get_nth_validated_cases() experimental
Cases at a chosen point in the validation process
diagnose_validation_delay() plot_validation_delay() experimental
Compare validation delays between confirmed and retracted cases

Summarising

What is in the data. summary() returns a tibble, and every block of it is also a function of its own.

Diagnosing

What is wrong with the data. diagnose() is structural and deterministic; the statistical tests it signposts are listed after it.

diagnose() experimental
Diagnose a tbl_now
diagnose_declarations() diagnose_ordering() diagnose_missing() diagnose_duplicates() diagnose_units() diagnose_negatives() diagnose_now() diagnose_truncation() diagnose_strata() diagnose_signposts() experimental
Individual blocks of a tbl_now diagnosis
print(<tbl_now_diagnosis>) experimental
Print a tbl_now diagnosis
diagnose_drift() experimental
Test whether the reporting-delay distribution drifts over time
diagnose_changepoint() experimental
Detect an abrupt change point in the reporting-delay distribution
diagnose_batches() experimental
Screen the report axis for batched reporting
diagnose_batch_shape() experimental
Test whether one report date drew from unusually old event dates
transport_discriminant() experimental
The transport discriminant of a reporting series
simulate_batch() experimental
Inject a batch into a tbl_now by withholding and then releasing reports

Plots

One grid, or any panel of it on its own.

autoplot(<tbl_now>) experimental
Diagnostic autoplot for a tbl_now
diagnostic_plot() experimental
Diagnostic plots of the reporting process
plot_day_of_week_effects() plot_week_of_year_effects() plot_month_of_year_effects() plot_holiday_effects() plot_holiday_lag_effects() experimental
Calendar effects on the case counts or on the reporting delay
plot_validation_status() experimental
How much of each day has been resolved
plot_cycles() experimental
Periodogram of the case counts or of the reporting delay
plot_delay_distribution() experimental
Empirical distribution of the reporting delay
plot_delay_drift() experimental
Visualise whether the reporting-delay distribution drifts over time
plot_delay_profiles() experimental
Plot the per-date delay profiles
plot_reporting_process() plot_epidemic_process() experimental
The epidemic process and the reporting process
plot_observed_cases() experimental
Observed epidemic process with the incompleteness line
plot_reporting_hexamap() experimental
Plot the reporting triangle as an age-period-cohort hexamap
plot_reporting_triangle() experimental
Plot the reporting triangle
plot_scalogram() experimental
Plot the reporting or epidemic scalogram
plot_transport_discriminant() experimental
Plot the transport-discriminant plane

Fitting nowcasts

One interface over the modelling packages.

run_nowcast() experimental
Nowcast a tbl_now with any supported modelling package
engine() experimental
Specify a nowcasting model and its arguments
engine_diseasenowcasting() engine_baselinenowcast() engine_epinowcast() engine_nobbs() engine_surveillance() engine_epinow2() experimental
Engines for the built-in nowcasting packages
example_engine() nowcast_fit(<example>) nowcast_tidy(<example>) experimental
A toy engine for examples
is_nowcast_engine() experimental
Is this an engine?
list_nowcast_methods() experimental
List the available nowcasting methods
nowcast_fit() experimental
Fit a nowcast with one modelling package
nowcast_tidy() experimental
Standardise a fitted nowcast
tbl_nowcast() experimental
A nowcast produced by run_nowcast()
is_tbl_nowcast() experimental
Is this object a tbl_nowcast?
nowcast_quantile_levels() experimental
Default quantile levels for a nowcast
autoplot.tbl_nowcast experimental
Plot a nowcast
as_tibble.tbl_nowcast as_tibble_tbl_nowcast experimental
Coerce a tbl_nowcast into a tibble

Ensembles, backtests and scoring

nowcast_ensemble() experimental
Combine several nowcasts into an ensemble
nowcast_weights() experimental
Ensemble weights from a backtest
nowcast_backtest() experimental
Refit several methods at past now dates and score them
score_nowcast() as_scoringutils() experimental
Score a nowcast against observed data

Converters

Out to the modelling packages, and back again.

tbl_now_to_EpiNow2() tbl_now_from_EpiNow2() experimental
Convert between tbl_now and EpiNow2
tbl_now_from_baselinenowcast() tbl_now_to_baselinenowcast() experimental
Convert between tbl_now and baselinenowcast
tbl_now_from_data_table() tbl_now_to_data_table() experimental
Convert between tbl_now and data.table
tbl_now_from_epidist() tbl_now_to_epidist() experimental
Convert between tbl_now and epidist
tbl_now_from_epinowcast() tbl_now_to_epinowcast() experimental
Convert between tbl_now and epinowcast
tbl_now_to_nobbs() experimental
Convert a tbl_now into the line list NobBS nowcasts from
tbl_now_to_surveillance() experimental
Convert a tbl_now into the line list surveillance nowcasts from
tbl_now_from_tsibble() tbl_now_to_tsibble() experimental
Convert between tbl_now and tsibble
as_epidist_linelist_data(<tbl_now>) as_epidist_aggregate_data(<tbl_now>) as_reporting_triangle(<tbl_now>) as_tsibble(<tbl_now>) as.data.table(<tbl_now>) experimental
Coerce a tbl_now with another package's generic
print(<tbl_now_epinow2_snapshots>) experimental
Snapshots of one series, as EpiNow2 estimates truncation from
print(<tbl_now_triangle_list>) experimental
One reporting triangle per stratum
print(<tbl_now_surveillance_list>) experimental
One surveillance line list per stratum
get_surveillance_when() get_surveillance_range() experimental
The date grids surveillance::nowcast() needs

Tidying model output

Every engine’s result, in one shape.

tidy() experimental
Tidy a fitted nowcast into one standard table
tidy.tbl_nowcast tidy_tbl_nowcast experimental
Tidy a nowcast produced by run_nowcast() or nowcast_ensemble()
tidy(<nowcast_backtest>) experimental
Tidy the scores of a nowcast_backtest()
tidy(<epidist_fit>) experimental
Tidy the delay distribution from an epidist fit
tidy(<estimate_dist>) experimental
Tidy the delay distribution from an EpiNow2 estimate_dist() fit

dplyr integration

The methods that keep the class alive inside a pipeline.

Datasets

covid_colombia
COVID-19 Notifications – Colombia 2020-2023
covid_us
covid_us: CDC COVID-19 Case Surveillance Public Use Data (2020)
denguedat
denguedat: Dengue fever individual-level reporting data from Puerto Rico
flusight
flusight: NHSN Weekly Hospital Respiratory Data from FluSight
hai_bucaramanga
Healthcare-Associated Infections – Bucaramanga, Colombia 2016-2023
mpoxdat
mpoxdat: Mpox reporting data from the 2022 New York City outbreak