validate_forecast: Re-validate an existing forecast object

View source: R/forecast.R

validate_forecastR Documentation

Re-validate an existing forecast object

Description

The function re-validates an existing forecast object. It is similar to assert_forecast(), but returns the input data instead of an invisible NULL. See as_forecast() for details on the expected input formats.

Usage

validate_forecast(forecast, forecast_type = NULL, verbose = TRUE)

Arguments

forecast

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

forecast_type

(optional) The forecast type you expect the forecasts to have. If the forecast type as determined by scoringutils based on the input does not match this, an error will be thrown. If NULL (the default), the forecast type will be inferred from the data.

verbose

Logical. If FALSE (default is TRUE), no messages and warnings will be created.

Value

Depending on the forecast type, an object of class forecast_binary, forecast_point, forecast_sample or forecast_quantile.

Examples

forecast <- as_forecast(example_binary)
assert_forecast(forecast)

epiforecasts/scoringutils documentation built on April 23, 2024, 4:56 p.m.