Density, distribution function, quantile function and random generation for the Gumbel distribution with location parameter location and scale parameter scale.

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

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

number of observations. If length(n) > 1 then the length is taken to be the number required.

location

the location parameter \(\mu\). This is not the mean of the Gumbel distribution (see Details below).

scale

the scale parameter \(\sigma\). This is not the standard deviation of the Gumbel distribution (see Details below).

log

Logical. If log = TRUE then the logarithm of the density is returned.

lower.tail, log.p

Same meaning as in punif or qunif.

Details

The Gumbel distribution is a special case of the generalized extreme value (GEV) distribution where the shape parameter \(\xi\) = 0. The latter has 3 parameters, so the Gumbel distribution has two. The Gumbel distribution function is $$G(y) = \exp \left( - \exp \left[ - \frac{y-\mu}{\sigma} \right] \right) $$ where \(-\infty<y<\infty\), \(-\infty<\mu<\infty\) and \(\sigma>0\). Its mean is $$\mu - \sigma * \gamma$$ and its variance is $$\sigma^2 * \pi^2 / 6$$ where \(\gamma\) is Euler's constant (which can be obtained as -digamma(1)).

See gumbel, the VGAM family function for estimating the two parameters by maximum likelihood estimation, for formulae and other details. Apart from n, all the above arguments may be vectors and are recyled to the appropriate length if necessary.

Value

dgumbel gives the density, pgumbel gives the distribution function, qgumbel gives the quantile function, and rgumbel generates random deviates.

References

Coles, S. (2001). An Introduction to Statistical Modeling of Extreme Values. London: Springer-Verlag.

Author

T. W. Yee

Note

The VGAM family function gumbel can estimate the parameters of a Gumbel distribution using maximum likelihood estimation.

See also

Examples

mu <- 1; sigma <- 2;
y <- rgumbel(n = 100, loc = mu, scale = sigma)
c(mean(y), mu - sigma * digamma(1))  # Sample and population means
#> [1] 2.229122 2.154431
c(var(y), sigma^2 * pi^2 / 6)  # Sample and population variances
#> [1] 6.593450 6.579736

if (FALSE)  x <- seq(-2.5, 3.5, by = 0.01)
loc <- 0; sigma <- 1
plot(x, dgumbel(x, loc, sigma), type = "l", col = "blue",
     main = "Blue is density, red is the CDF", ylim = c(0, 1),
     sub = "Purple are 5,10,...,95 percentiles", ylab = "", las = 1)
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'x' in selecting a method for function 'plot': object 'x' not found
abline(h = 0, col = "blue", lty = 2)
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
lines(qgumbel(seq(0.05, 0.95, by = 0.05), loc, sigma),
  dgumbel(qgumbel(seq(0.05, 0.95, by = 0.05), loc, sigma), loc, sigma),
      col = "purple", lty = 3, type = "h")
#> Error in plot.xy(xy.coords(x, y), type = type, ...): plot.new has not been called yet
lines(x, pgumbel(x, loc, sigma), type = "l", col = "red")
#> Error: object 'x' not found
abline(h = 0, lty = 2)  # \dontrun{}
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet