convert2prob: Convert to Probability / Category Forecast

View source: R/convert2prob.R

convert2probR Documentation

Convert to Probability / Category Forecast

Description

convert2prob Converts the continuous ensemble forecast to counts of ensemble members per category. The categories can be defined relative to the ensemble distribution (using prob) or relative to absolute values for the category thresholds (using threshold, see details). prob2thresh converts the relative threshold to absolute thresholds for later processing. expandthresh expands the vector or matrix of thresholds to fit the input data.

Usage

convert2prob(
  x,
  prob = NULL,
  threshold = NULL,
  ref.ind = NULL,
  multi.model = FALSE
)

prob2thresh(x, prob, ref.ind = NULL, multi.model = FALSE)

expandthresh(threshold, x)

Arguments

x

input vector or matrix

prob

thresholds for categorical forecasts (defaults to NULL)

threshold

absolute thresholds for categorical forecasts (defaults to NULL)

ref.ind

list of forecast/obs instances to be used to estimate percentile thresholds

multi.model

logical, are we dealing with initial condition (the default) or multi-model ensembles (see details)?

Details

In case both prob and threshold are set to NULL, the function returns the input x without modification. If prob is set, a matrix with the number of occurrences per class for a given quantile of the full distribution (e.g. temperature above/below the median). If threshold is set, the classes are defined based on the absolute value (e.g. temperature above/below 13 deg. C). Multiple classes are

Only certain formats of threshold and prob are supported. prob has to be a vector with percentile thresholds separating the different classes. threshold can be a vector, matrix or array with the first entry corresponding to the different classes, and the last to the different ensemble members (if present). Thereby, time/forecast varying thresholds can potentially be supplied (although I am not sure this is useful or needed).

If ref.ind is specified, only the specified indices of the input variables are used to estimate the percentile thresholds (prob). If used with threshold, or without anything, ref.ind has no effect.

If multi.model = TRUE, the relative thresholds supplied by prob are ensemble member specific, i.e. are estimated for each ensemble member separately. This is in particular applicable for multi-model ensembles with model dependent biases.

Value

Matrix of occurences per class (i.e. the number of ensemble members per class, or an indicator for the observations)

See Also

veriApply

Examples

tm <- toymodel()

## convert to tercile forecasts (only display first forecast and obs)
convert2prob(tm$fcst, prob = 1:2 / 3)[1, ]
convert2prob(tm$obs, prob = 1:2 / 3)[1, ]

## convert to category forecasts (smaller and larger than 1)
convert2prob(tm$fcst, threshold = 1)[1, ]
convert2prob(tm$obs, threshold = 1)[1, ]


easyVerification documentation built on Aug. 15, 2023, 9:06 a.m.