
Standardise a fitted nowcast
nowcast_tidy.RdThe second extension point of the nowcasting framework (see nowcast_fit()).
It receives the object the modelling package returned and must express its
predictions in the tidy format tbl.now uses everywhere else.
Usage
# S3 method for class 'diseasenowcasting'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# S3 method for class 'baselinenowcast'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# S3 method for class 'epinowcast'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# S3 method for class 'NobBS'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# S3 method for class 'surveillance'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# S3 method for class 'EpiNow2'
nowcast_tidy(engine, fit, x, ..., quantile_levels)
nowcast_tidy(engine, fit, x, ..., quantile_levels)
# Default S3 method
nowcast_tidy(engine, fit, x, ..., quantile_levels)Arguments
- engine
An
engine()object; seenowcast_fit().- fit
The object returned by
nowcast_fit().- x
The
tbl_nowthe nowcast was produced from.- ...
Not forwarded by
run_nowcast(), which passes the user's...tonowcast_fit()only. Anything the tidying step needs – a number of draws, a tuning parameter, a lookup table – must therefore travel inside the objectnowcast_fit()returned.- quantile_levels
Numeric vector of probabilities the predictions should be summarised at.
Value
A list with two elements:
- predictions
A data frame with one row per (event date, stratum, quantile level) and the columns
<event_date>, the strata columns,.quantile_leveland.value.- draws
Either
NULL, or a data frame with one row per (event date, stratum, draw) and the columns<event_date>, the strata columns,.drawand.value.
When draws is supplied and predictions is NULL, run_nowcast()
derives the quantiles from the draws for you.
Examples
# See `?nowcast_fit` for a complete two-method backend.
methods(nowcast_tidy)
#> [1] nowcast_tidy.EpiNow2* nowcast_tidy.NobBS*
#> [3] nowcast_tidy.baselinenowcast* nowcast_tidy.default*
#> [5] nowcast_tidy.diseasenowcasting* nowcast_tidy.epinowcast*
#> [7] nowcast_tidy.example* nowcast_tidy.surveillance*
#> see '?methods' for accessing help and source code