Skip to contents

[Deprecated]

This function is deprecated in favour of using as_forecast_sample.epinowcast() with scoringutils::score(). See the documentation for the scoringutils package for more details on on forecast scoring.

Usage

enw_score_nowcast(
  nowcast,
  latest_obs,
  log = FALSE,
  check = FALSE,
  round_to = 3,
  ...
)

Arguments

nowcast

A posterior nowcast or posterior prediction as returned by summary.epinowcast(), when used on the output of epinowcast().

latest_obs

A data.frame of the latest available observations as produced by enw_latest_data() or otherwise.

log

Logical, defaults to FALSE. Should scores be calculated on the log scale (with a 0.01 shift) for both observations and nowcasts. Scoring in this way can be thought of as a relative score vs the more usual absolute measure. It may be useful when targets are on very different scales or when the forecaster is more interested in good all round performance versus good performance for targets with large values.

check

Logical, defaults to FALSE. Should input nowcasts be checked for consistency with the scoringutils package.

round_to

Integer defaults to 3. Number of digits to round scoring output to.

...

Arguments passed on to scoringutils::score

forecast

A forecast object (a validated data.table with predicted and observed values).

metrics

A named list of scoring functions. Names will be used as column names in the output. See get_metrics() for more information on the default metrics used. See the Customising metrics section below for information on how to pass custom arguments to scoring functions.

Value

A data.table as returned by scoringutils::score().

See also

Other modelvalidation: as_forecast_sample.epinowcast()

Examples

if (FALSE) { # interactive()
library(data.table)
library(scoringutils)

# Summarise example nowcast
nowcast <- enw_example("nowcast")
summarised_nowcast <- summary(nowcast)

# Load latest available observations
obs <- enw_example("observations")

# Keep the last 7 days of data
obs <- obs[reference_date > (max(reference_date) - 7)]

# score on the absolute scale
scores <- enw_score_nowcast(summarised_nowcast, obs)
summarise_scores(scores, by = "location")

# score overall on a log scale
log_scores <- enw_score_nowcast(summarised_nowcast, obs, log = TRUE)
summarise_scores(log_scores, by = "location")
}