Learn R Programming

extraDistr (version 1.8.1)

Gumbel: Gumbel distribution

Description

Density, distribution function, quantile function and random generation for the Gumbel distribution.

Usage

dgumbel(x, mu = 0, sigma = 1, log = FALSE)
pgumbel(q, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
qgumbel(p, mu = 0, sigma = 1, lower.tail = TRUE, log.p = FALSE)
rgumbel(n, mu = 0, sigma = 1)

Arguments

x, q
vector of quantiles.
mu, sigma
location and scale parameters. Scale must be positive.
log, log.p
logical; if TRUE, probabilities p are given as log(p).
lower.tail
logical; if TRUE (default), probabilities are $P[X \le x]$ otherwise, $P[X > x]$.
p
vector of probabilities.
n
number of observations. If length(n) > 1, the length is taken to be the number required.

Details

Probability density function $$ f(x) = \frac{1}{\sigma} \exp\left(-\left(\frac{x-\mu}{\sigma} + \exp\left(-\frac{x-\mu}{\sigma}\right)\right)\right) $$

Cumulative distribution function $$ F(x) = \exp\left(-\exp\left(-\frac{x-\mu}{\sigma}\right)\right) $$

Quantile function $$ F^{-1}(p) = \mu - \sigma \log(-\log(p)) $$

References

Bury, K. (1999). Statistical Distributions in Engineering. Cambridge University Press.

Examples

Run this code

x <- rgumbel(1e5, 5, 2)
xx <- seq(0, 1000, by = 0.1)
hist(x, 100, freq = FALSE)
lines(xx, dgumbel(xx, 5, 2), col = "red")
hist(pgumbel(x, 5, 2))
plot(ecdf(x))
lines(xx, pgumbel(xx, 5, 2), col = "red", lwd = 2)

Run the code above in your browser using DataLab