rkhist: Return the rank histogram of an observation in an ensemble...

Description Usage Arguments Details Value Examples

View source: R/rkhist.R

Description

This S3 generic function is intended to compute the rank of each observation when pooled with its associated ensemble forecast and return the count in each rank (i.e. the rank histogram).

Usage

1
rkhist(fcst, obs, ...)

Arguments

fcst

an object containing the ensemble forecasts.

obs

an object containing the observation associated to the forecast in fcst.

...

additional arguments.

Details

For new methods, the output should be an object of class c("rkhist", "matrix"), with one rank histogram in each row. Rows may be named.

Value

An S3 object of class rkhist (indeed a matrix containing the count for each rank, with class "rkhist"). Each row of the matrix contains the counts for one rank histogram.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
set.seed(42)
N <- 1000
M <- 20
fcst <- matrix(rnorm(N*M), ncol = M)
fcst2 <- matrix(rnorm(N*M), ncol = M)
obs <- rnorm(N)
## Computation of one rank histogram
# Named
rkh <- rkhist(fcst, obs, names = "a")
print(rkh)
plot(rkh)
# Unnamed
rkh2 <- rkhist(fcst2, obs)
print(rkh2)
plot(rkh2)

## Computation of two rank histograms, from a list of forecasts, with the
## same observation vector
fcstsl <- list(fcst, fcst2)
rkhsl <- rkhist(fcstsl, obs, names = c("a", NA))
print(rkhsl)
plot(rkhsl)

## Concatenation of two rank histograms, with different names
rkhs <- rbind_rkhists(rkh, rkh2, names = letters[3:4])
rownames(rkhs)
print(rkhs)
plot(rkhs)

flatness documentation built on June 29, 2021, 9:08 a.m.