The GEVr Distribution

Description

Random number generation (rgevr) and density (dgevr) functions for the GEVr distribution with parameters loc, scale, and shape. Also, quantile function (qgev) and cumulative distribution function (pgev) for the GEV1 distribution.

Usage

1
2
3
4
5
6
7
8
9
dgevr(x, loc = 0, scale = 1, shape = 0, log.d = FALSE)

rgevr(n, r, loc = 0, scale = 1, shape = 0)

qgev(p, loc = 0, scale = 1, shape = 0, lower.tail = TRUE,
  log.p = FALSE)

pgev(q, loc = 0, scale = 1, shape = 0, lower.tail = TRUE,
  log.p = FALSE)

Arguments

x

Vector or matrix of observations. If x is a matrix, each row is taken to be a new observation.

loc, scale, shape

Location, scale, and shape parameters. Can be vectors, but the lengths must be appropriate.

log.d

Logical: Whether or not to return the log density. (FALSE by default)

n

Number of observations

r

Number of order statistics for each observation.

p

Vector of probabilities.

lower.tail

Logical: If TRUE (default), probabilities are P[X <= x] otherwise, P[X > x].

log.p

Logical: If TRUE, probabilities p are given as log(p). (FALSE by default)

q

Vector of quantiles.

Details

GEVr data (in matrix x) should be of the form x[i,1] > x[i, 2] > \cdots > x[i, r] for each observation i = 1, …, n. Note that currently the quantile and cdf functions are only for the GEV1 distribution. The GEVr distribution is also known as the r-largest order statistics model and is a generalization of the block maxima model (GEV1). The density function is given by

f_r (x_1, x_2, ..., x_r | μ, σ, ξ) = σ^{-r} \exp\Big\{-(1+ξ z_r)^{-\frac{1}{ξ}} - ≤ft(\frac{1}{ξ}+1\right)∑_{j=1}^{r}\log(1+ξ z_j)\Big\}

for some location parameter μ, scale parameter σ > 0, and shape parameter ξ, where x_1 > \cdots > x_r, z_j = (x_j - μ) / σ, and 1 + ξ z_j > 0 for j=1, …, r. When r = 1, this distribution is exactly the GEV distribution.

References

Coles, S. (2001). An introduction to statistical modeling of extreme values (Vol. 208). London: Springer.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Plot the densities of the heavy and bounded upper tail forms of GEVr
set.seed(7)
dat1 <- rgevr(1000, 1, loc = 0, scale = 1, shape = 0.25)
dat2 <- rgevr(1000, 1, loc = 0, scale = 1, shape = -0.25)
hist(dat1, col = rgb(1, 0, 0, 0.5), xlim = c(-5, 10), ylim = c(0, 0.4),
     main = "Histogram of GEVr Densities", xlab = "Value", freq = FALSE)
hist(dat2, col = rgb(0, 0,1, 0.5), add = TRUE, freq = FALSE)
box()

## Generate sample with decreasing trend in location parameter
x <- rgevr(10, 2, loc = 10:1, scale = 1, shape = 0.1)
dgevr(x, loc = 10:1, scale = 10:1, shape = 0.1)

## Incorrect parameter specifications
# rgevr(10, 2, loc = 5:8, scale = 1, shape = 0.1)
# rgevr(1, 2, loc = 5:8, scale = 1:2, shape = 0.1)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.