mrnk: Multivariate Ranks

View source: R/mrnk.R

mrnkR Documentation

Multivariate Ranks

Description

This function calculates the ranks given observations of a multivariate variable and samples of a predictive distribution.

Usage

mrnk(y, x, method = "mv", na.rm = FALSE)

Arguments

y

matrix of observations (see details)

x

3-dimensional array of samples of a predictive distribution (depending on y; see details)

method

character; "mv", "avg", "mst", "bd"; default: "mv" (see details)

na.rm

logical; if TRUE NA are stripped before the rank computation proceeds; if FALSE NA are used in the rank computation; default: FALSE

Details

The observations are given in the matrix y with n rows, where each column belongs to an univariate observation variable. The i-th row of matrix y belongs to the i-th third dimension entry of the array x. The i-th third dimension entry must be a matrix with n rows, having the same structure as y, filled with the samples of a multivariate predictive distribution.

For the calculation of the ranks, different methods are available, where "mv" stands for "multivariate ranks", "avg" stands for "average ranks", "mst" stands for "minimum-spanning-tree ranks" and "bd" stands for "band-depth ranks". These methods are implemented as described in e.g. Thorarinsdottir et al. (2016).

Value

Vector of ranks.

Author(s)

David Jobst

References

Gneiting, T., Stanberry, L., Grimit, E., Held, L. and Johnson, N. (2008). Assessing probabilistic forecasts of multivariate quantities, with an application to ensemble predictions of surface winds. Test, 17, 211-264.

Smith, L. and Hansen, J. (2004). Extending the limits of ensemble forecast verification with the minimum spanning tree. Monthly Weather Review, 132, 1522-1528.

Thorarinsdottir, T., Scheurer, M. and Heinz, C. (2016). Assessing the calibration of high-dimensional ensemble forecasts using rank histograms. Journal of Computational and Graphical Statistics, 25, 105-122.

Wilks, D. (2004). The minimum spanning tree histogram as verification tool for multidimensional ensemble forecasts. Monthly Weather Review, 132, 1329-1340.

Examples

# simulated data
n <- 30
m <- 50
y <- cbind(rnorm(n), rgamma(n, shape = 1))
x <- array(NA, dim = c(m, 2, n))
x[, 1, ] <- rnorm(n*m)
x[, 2, ] <- rgamma(n*m, shape = 1)

# mrnk calculation
mrnk(y = y, x = x, method = "mv")
mrnk(y = y, x = x, method = "avg")
mrnk(y = y, x = x, method = "mst")
mrnk(y = y, x = x, method = "bd")


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