The Generalized Extreme Value Distribution
gevUC.RdDensity, distribution function, quantile function and random
generation for the generalized extreme value distribution
(GEV) with location parameter location, scale parameter
scale and shape parameter shape.
Usage
dgev(x, location = 0, scale = 1, shape = 0, log = FALSE,
tolshape0 = sqrt(.Machine$double.eps))
pgev(q, location = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE)
qgev(p, location = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE)
rgev(n, location = 0, scale = 1, shape = 0)Arguments
- x, q
vector of quantiles.
- p
vector of probabilities.
- n
number of observations. If
length(n) > 1then the length is taken to be the number required.- location
the location parameter \(\mu\).
- scale
the (positive) scale parameter \(\sigma\). Must consist of positive values.
- shape
the shape parameter \(\xi\).
- log
Logical. If
log = TRUEthen the logarithm of the density is returned.- lower.tail, log.p
- tolshape0
Positive numeric. Threshold/tolerance value for resting whether \(\xi\) is zero. If the absolute value of the estimate of \(\xi\) is less than this value then it will be assumed zero and a Gumbel distribution will be used.
Value
dgev gives the density,
pgev gives the distribution function,
qgev gives the quantile function, and
rgev generates random deviates.
References
Coles, S. (2001). An Introduction to Statistical Modeling of Extreme Values. London: Springer-Verlag.
Details
See gev, the VGAM family function
for estimating the 3 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.
Note
The default value of \(\xi = 0\) means the default distribution is the Gumbel.
Currently, these functions have different argument names compared with those in the evd package.
See also
gev,
gevff,
vglm.control.
Examples
loc <- 2; sigma <- 1; xi <- -0.4
pgev(qgev(seq(0.05, 0.95, by = 0.05), loc, sigma, xi), loc, sigma, xi)
#> [1] 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75
#> [16] 0.80 0.85 0.90 0.95
if (FALSE) x <- seq(loc - 3, loc + 3, by = 0.01)
plot(x, dgev(x, loc, sigma, xi), type = "l", col = "blue", ylim = c(0, 1),
main = "Blue is density, orange is the CDF",
sub = "Purple are 10,...,90 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(qgev(seq(0.1, 0.9, by = 0.1), loc, sigma, xi),
dgev(qgev(seq(0.1, 0.9, by = 0.1), loc, sigma, xi), loc, sigma, xi),
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, pgev(x, loc, sigma, xi), type = "l", col = "orange")
#> Error: object 'x' not found
abline(h = (0:10)/10, lty = 2, col = "gray50")
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
# \dontrun{}