Learn R Programming

easyVerification (version 0.1.8)

convert2prob: Convert to probability / categorical forecast

Description

Convert to probability / categorical forecast

Usage

convert2prob(x, prob = NULL, threshold = NULL)

Arguments

x
input vector or matrix
prob
thresholds for categorical forecasts (defaults to NULL)
threshold
absolute thresholds for categorical forecasts (defaults to NULL)

Value

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

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 occurences 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 supported.

See Also

veriApply

Examples

Run this code
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,]

Run the code above in your browser using DataLab