[Stable]

The GEV distribution is widely used in extreme value theory to model the distribution of maxima (or minima) of samples. The parametric form encompasses the Gumbel, Frechet, and reverse Weibull distributions.

dist_gev(location, scale, shape)

Arguments

location

the location parameter \(\mu\) of the GEV distribution.

scale

the scale parameter \(\sigma\) of the GEV distribution. Must be strictly positive.

shape

the shape parameter \(\xi\) of the GEV distribution. Determines the tail behavior: \(\xi = 0\) gives Gumbel, \(\xi > 0\) gives Frechet, \(\xi < 0\) gives reverse Weibull.

Details

We recommend reading this documentation on pkgdown which renders math nicely. https://pkg.mitchelloharawild.com/distributional/reference/dist_gev.html

In the following, let \(X\) be a GEV random variable with parameters location = \(\mu\), scale = \(\sigma\), and shape = \(\xi\).

Support:

  • \(x \in \mathbb{R}\) (all real numbers) if \(\xi = 0\)

  • \(x \geq \mu - \sigma/\xi\) if \(\xi > 0\)

  • \(x \leq \mu - \sigma/\xi\) if \(\xi < 0\)

Mean: $$ E(X) = \begin{cases} \mu + \sigma \gamma & \text{if } \xi = 0 \\ \mu + \sigma \frac{\Gamma(1-\xi) - 1}{\xi} & \text{if } \xi < 1 \\ \infty & \text{if } \xi \geq 1 \end{cases} $$ where \(\gamma \approx 0.5772\) is the Euler-Mascheroni constant and \(\Gamma(\cdot)\) is the gamma function.

Median: $$ \text{Median}(X) = \begin{cases} \mu - \sigma \log(\log 2) & \text{if } \xi = 0 \\ \mu + \sigma \frac{(\log 2)^{-\xi} - 1}{\xi} & \text{if } \xi \neq 0 \end{cases} $$

Variance: $$ \text{Var}(X) = \begin{cases} \frac{\pi^2 \sigma^2}{6} & \text{if } \xi = 0 \\ \frac{\sigma^2}{\xi^2} [\Gamma(1-2\xi) - \Gamma(1-\xi)^2] & \text{if } \xi < 0.5 \\ \infty & \text{if } \xi \geq 0.5 \end{cases} $$

Probability density function (p.d.f):

For \(\xi = 0\) (Gumbel): $$ f(x) = \frac{1}{\sigma} \exp\left(-\frac{x-\mu}{\sigma}\right) \exp\left[-\exp\left(-\frac{x-\mu}{\sigma}\right)\right] $$

For \(\xi \neq 0\): $$ f(x) = \frac{1}{\sigma} \left[1 + \xi\left(\frac{x-\mu}{\sigma}\right)\right]^{-1/\xi-1} \exp\left\{-\left[1 + \xi\left(\frac{x-\mu}{\sigma}\right)\right]^{-1/\xi}\right\} $$ where \(1 + \xi(x-\mu)/\sigma > 0\).

Cumulative distribution function (c.d.f):

For \(\xi = 0\) (Gumbel): $$ F(x) = \exp\left[-\exp\left(-\frac{x-\mu}{\sigma}\right)\right] $$

For \(\xi \neq 0\): $$ F(x) = \exp\left\{-\left[1+\xi\left(\frac{x-\mu}{\sigma}\right)\right]^{-1/\xi}\right\} $$ where \(1 + \xi(x-\mu)/\sigma > 0\).

Quantile function:

For \(\xi = 0\) (Gumbel): $$ Q(p) = \mu - \sigma \log(-\log p) $$

For \(\xi \neq 0\): $$ Q(p) = \mu + \frac{\sigma}{\xi}\left[(-\log p)^{-\xi} - 1\right] $$

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.

See also

Examples

# Create GEV distributions with different shape parameters

# Gumbel distribution (shape = 0)
gumbel <- dist_gev(location = 0, scale = 1, shape = 0)

# Frechet distribution (shape > 0, heavy-tailed)
frechet <- dist_gev(location = 0, scale = 1, shape = 0.3)

# Reverse Weibull distribution (shape < 0, bounded above)
weibull <- dist_gev(location = 0, scale = 1, shape = -0.2)

dist <- c(gumbel, frechet, weibull)
dist
#> <distribution[3]>
#> [1] GEV(0, 1, 0)    GEV(0, 1, 0.3)  GEV(0, 1, -0.2)

# Statistical properties
mean(dist)
#> [1] 0.5772157 0.9935178 0.4091563
median(dist)
#> [1] 0.3665129 0.3874219 0.3534020
variance(dist)
#> [1] 1.644934 5.924577 1.105749

# Generate random samples
generate(dist, 10)
#> [[1]]
#>  [1]  0.5058653  1.1524913  1.1903704 -0.5236831  0.1621965  1.2903686
#>  [7]  0.2859436 -0.2136754  1.4338559  2.4846327
#> 
#> [[2]]
#>  [1]  0.1294876  0.8711422 -0.3575116 -1.0080009  1.0311405 -0.4185430
#>  [7]  0.6805879 -0.5375249 -0.8495577  2.6498048
#> 
#> [[3]]
#>  [1]  0.9281486 -1.0097471  0.5305002 -0.4209475 -0.6207204 -0.7273885
#>  [7] -0.1178996 -0.6466380  1.7156609  1.0235020
#> 

# Evaluate density
density(dist, 2)
#> [1] 0.1182050 0.1058831 0.1199042
density(dist, 2, log = TRUE)
#> [1] -2.135335 -2.245420 -2.121062

# Evaluate cumulative distribution
cdf(dist, 4)
#> [1] 0.9818511 0.9303365 0.9996801

# Calculate quantiles
quantile(dist, 0.95)
#> [1] 2.970195 4.792363 2.239536