qs: Quantile Score

View source: R/qs.R

qsR Documentation

Quantile Score

Description

This function calculates the Quantile Score (QS) given observations of an univariate variable, probabilities and corresponding quantiles of a predictive distribution.

Usage

qs(y, q, p, na.action = na.omit, aggregate = FALSE, ...)

Arguments

y

vector of observations

q

vector of quantile values (depending on p; see details)

p

vector of probabilities in (0,1)

na.action

function to handle the NA's. Default: na.omit.

aggregate

logical or function for aggregating the single scores, e.g. sum, mean, weighted.mean, .... Default: FALSE, i.e. no aggregation function.

...

further arguments passed to the aggregate function.

Details

For a vector y of length n, the i-th entry of y belongs to the i-th entry of q and p. For given probabilities p the quantile values are obtained by q=F^-1(p) for a predictive distribution F.

A lower QS indicates a better forecast.

Value

Vector of score value(s).

Author(s)

David Jobst

References

Gneiting, T. (2011). Making and Evaluating Point Forecasts. Journal of the American Statistical Association, 106(494), 746-762.

Examples

# simulated data
n <- 30
y <- rnorm(n)
p <- runif(n)
q <- qnorm(p)

# qs calculation
qs(y = y, q = q, p = p)
qs(y = y, q = q, p = p, aggregate = mean)


jobstdavid/eppverification documentation built on May 13, 2024, 5:20 p.m.