ordinal (version 2019.12-10)

gumbel: The Gumbel Distribution

Description

Density, distribution function, quantile function, random generation, and gradient of density of the extreme value (maximum and minimum) distributions. The Gumbel distribution is also known as the extreme value maximum distribution, the double-exponential distribution and the log-Weibull distribution.

Usage

dgumbel(x, location = 0, scale = 1, log = FALSE, max = TRUE)

pgumbel(q, location = 0, scale = 1, lower.tail = TRUE, max = TRUE)

qgumbel(p, location = 0, scale = 1, lower.tail = TRUE, max = TRUE)

rgumbel(n, location = 0, scale = 1, max = TRUE)

ggumbel(x, max = TRUE)

Value

pgumbel gives the distribution function, dgumbel

gives the density, ggumbel gives the gradient of the density, qgumbel is the quantile function, and

rgumbel generates random deviates.

Arguments

x,q

numeric vector of quantiles.

p

vector of probabilities.

n

number of observations.

location

numeric scalar.

scale

numeric scalar.

lower.tail

logical; if TRUE (default), probabilities are \(P[X \leq x]\) otherwise, \(P[X > x]\).

log

logical; if TRUE, probabilities p are given as log(p).

max

distribution for extreme maxima (default) or minima? The default corresponds to the standard right-skew Gumbel distribution.

Author

Rune Haubo B Christensen

Details

dgumbel, pgumbel and ggumbel are implemented in C for speed and care is taken that 'correct' results are provided for values of NA, NaN, Inf, -Inf or just extremely small or large.

The distribution functions, densities and gradients are used in the Newton-Raphson algorithms in fitting cumulative link models with clm and cumulative link mixed models with clmm.

References

https://en.wikipedia.org/wiki/Gumbel_distribution

See Also

Gradients of densities are also implemented for the normal, logistic, cauchy, cf. gfun and the log-gamma distribution, cf. lgamma.

Examples

Run this code

## Illustrating the symmetry of the distribution functions:
pgumbel(5) == 1 - pgumbel(-5, max=FALSE) ## TRUE
dgumbel(5) == dgumbel(-5, max=FALSE) ## TRUE
ggumbel(5) == -ggumbel(-5, max=FALSE) ## TRUE

## More examples:
x <- -5:5

(pp <- pgumbel(x))
qgumbel(pp)
dgumbel(x)
ggumbel(x)

(ppp <- pgumbel(x, max=FALSE))
## Observe that probabilities close to 0 are more accurately determined than 
## probabilities close to 1:
qgumbel(ppp, max=FALSE)
dgumbel(x, max=FALSE)
ggumbel(x, max=FALSE)

## random deviates:
set.seed(1)
(r1 <- rgumbel(10))
set.seed(1)
r2 <- -rgumbel(10, max = FALSE)
all(r1 == r2) ## TRUE

Run the code above in your browser using DataLab