gumbel: The Gumbel Distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

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

1
2
3
4
5
6
7
8
9
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)

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 <= 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.

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.

See the 'Primer' vignette for the definition of the Gumbel distribution and its relation to the log-log and complementary-log-log link used in cumulative link models. See the examples for numerical relations between the max and min variants.

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.

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.

Author(s)

Rune Haubo B Christensen

References

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## 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

ordinal documentation built on May 2, 2019, 5:47 p.m.