# gev: The Generalised Extreme Value Distribution In revdbayes: Ratio-of-Uniforms Sampling for Bayesian Extreme Value Analysis

## Description

Density function, distribution function, quantile function and random generation for the generalised extreme value (GEV) distribution.

## Usage

 ```1 2 3 4 5 6 7 8 9``` ```dgev(x, loc = 0, scale = 1, shape = 0, log = FALSE, m = 1) pgev(q, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE, m = 1) qgev(p, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE, m = 1) rgev(n, loc = 0, scale = 1, shape = 0, m = 1) ```

## Arguments

 `x, q` Numeric vectors of quantiles. `loc, scale, shape` Numeric vectors. Location, scale and shape parameters. All elements of `scale` must be positive. `log, log.p` A logical scalar; if TRUE, probabilities p are given as log(p). `m` A numeric scalar. The distribution is reparameterised by working with the GEV(`loc, scale, shape`) distribution function raised to the power `m`. See Details. `lower.tail` A logical scalar. If TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. `p` A numeric vector of probabilities in [0,1]. `n` Numeric scalar. The number of observations to be simulated. If `length(n) > 1` then `length(n)` is taken to be the number required.

## Details

The distribution function of a GEV distribution with parameters `loc` = μ, `scale` = σ (>0) and `shape` = ξ is

F(x) = exp { - [1 + ξ (x - μ) / σ] ^ (-1/ξ)}

for 1 + ξ (x - μ) / σ > 0. If ξ = 0 the distribution function is defined as the limit as ξ tends to zero. The support of the distribution depends on ξ: it is x <= μ - σ / ξ for ξ < 0; x >= μ - σ / ξ for ξ > 0; and x is unbounded for ξ = 0. Note that if ξ < -1 the GEV density function becomes infinite as x approaches μ -σ / ξ from below.

If `lower.tail = TRUE` then if `p = 0` (`p = 1`) then the lower (upper) limit of the distribution is returned, which is `-Inf` or `Inf` in some cases. Similarly, but reversed, if `lower.tail = FALSE`.

See https://en.wikipedia.org/wiki/Generalized_extreme_value_distribution for further information.

The effect of `m` is to change the location, scale and shape parameters to (μ + σ log m, σ, ξ) if ξ = 0 and (μ + σ (m ^ ξ - 1) / ξ, σ m ^ ξ, ξ). For integer `m` we can think of this as working with the maximum of `m` independent copies of the original GEV(`loc, scale, shape`) variable.

## Value

`dgev` gives the density function, `pgev` gives the distribution function, `qgev` gives the quantile function, and `rgev` generates random deviates.

The length of the result is determined by `n` for `rgev`, and is the maximum of the lengths of the numerical arguments for the other functions.

The numerical arguments other than `n` are recycled to the length of the result.

## References

Jenkinson, A. F. (1955) The frequency distribution of the annual maximum (or minimum) of meteorological elements. Quart. J. R. Met. Soc., 81, 158-171. Chapter 3: http://dx.doi.org/10.1002/qj.49708134804

Coles, S. G. (2001) An Introduction to Statistical Modeling of Extreme Values, Springer-Verlag, London. http://dx.doi.org/10.1007/978-1-4471-3675-0_3

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17``` ```dgev(-1:4, 1, 0.5, 0.8) dgev(1:6, 1, 0.5, -0.2, log = TRUE) dgev(1, shape = c(-0.2, 0.4)) pgev(-1:4, 1, 0.5, 0.8) pgev(1:6, 1, 0.5, -0.2) pgev(1, c(1, 2), c(1, 2), c(-0.2, 0.4)) pgev(-3, c(1, 2), c(1, 2), c(-0.2, 0.4)) pgev(7, 1, 1, c(-0.2, 0.4)) qgev((1:9)/10, 2, 0.5, 0.8) qgev(0.5, c(1,2), c(0.5, 1), c(-0.5, 0.5)) p <- (1:9)/10 pgev(qgev(p, 1, 2, 0.8), 1, 2, 0.8) rgev(6, 1, 0.5, 0.8) ```

revdbayes documentation built on Feb. 13, 2018, 1:04 a.m.