Learn R Programming

scoringutils (version 2.3.0)

get_duplicate_forecasts: Find duplicate forecasts

Description

Identify duplicate forecasts, i.e. instances where there is more than one forecast for the same prediction target.

Uses get_forecast_type_ids() to determine the type-specific columns (beyond the forecast unit) that identify a unique row. For forecast objects the type is detected automatically. For plain data.frames you should pass type (e.g. "quantile", "sample") so that the correct columns are used. Calling on a plain data.frame without type is deprecated; it falls back to column-name detection but this behaviour will be removed in a future version.

Usage

get_duplicate_forecasts(
  data,
  forecast_unit = NULL,
  type = NULL,
  counts = FALSE
)

Value

A data.frame with all rows for which a duplicate forecast was found

Arguments

data

A data.frame (or similar) with predicted and observed values. See the "Target format" section in Details for additional information on the required input format.

forecast_unit

(optional) Name of the columns in data (after any renaming of columns) that denote the unit of a single forecast. See get_forecast_unit() for details. If NULL (the default), all columns that are not required columns are assumed to form the unit of a single forecast. If specified, all columns that are not part of the forecast unit (or required columns) will be removed.

type

Character string naming the forecast type, corresponding to the class suffix after forecast_ (e.g. "quantile" for class forecast_quantile, "sample" for forecast_sample). Used to determine type-specific ID columns when data is not already a forecast object. Ignored when data already inherits from forecast.

counts

Should the output show the number of duplicates per forecast unit instead of the individual duplicated rows? Default is FALSE.

Examples

Run this code
example <- rbind(example_quantile, example_quantile[1000:1010])
get_duplicate_forecasts(example, type = "quantile")

Run the code above in your browser using DataLab