gp {revdbayes} | R Documentation |
The Generalised Pareto Distribution
Description
Density function, distribution function, quantile function and random generation for the generalised Pareto (GP) distribution.
Usage
dgp(x, loc = 0, scale = 1, shape = 0, log = FALSE)
pgp(q, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE)
qgp(p, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, log.p = FALSE)
rgp(n, loc = 0, scale = 1, shape = 0)
Arguments
x , q |
Numeric vectors of quantiles. All elements of |
loc , scale , shape |
Numeric vectors.
Location, scale and shape parameters.
All elements of |
log , log.p |
A logical scalar; if TRUE, probabilities p are given as log(p). |
lower.tail |
A logical scalar. If TRUE (default), probabilities
are |
p |
A numeric vector of probabilities in [0,1]. |
n |
Numeric scalar. The number of observations to be simulated.
If |
Details
The distribution function of a GP distribution with parameters
location
= \mu
, scale
= \sigma (> 0)
and
shape
= \xi
is
F(x) = 1 - [1 + \xi (x - \mu) / \sigma] ^ {-1/\xi}
for 1 + \xi (x - \mu) / \sigma > 0
. If \xi = 0
the
distribution function is defined as the limit as \xi
tends to zero.
The support of the distribution depends on \xi
: it is
x \geq \mu
for \xi \geq 0
; and
\mu \leq x \leq \mu - \sigma / \xi
for \xi < 0
. Note that if \xi < -1
the GP density function
becomes infinite as x
approaches \mu - \sigma/\xi
.
If lower.tail = TRUE
then if p = 0
(p = 1
) then
the lower (upper) limit of the distribution is returned.
The upper limit is Inf
if shape
is non-negative.
Similarly, but reversed, if lower.tail = FALSE
.
See https://en.wikipedia.org/wiki/Generalized_Pareto_distribution for further information.
Value
dgp
gives the density function, pgp
gives the
distribution function, qgp
gives the quantile function,
and rgp
generates random deviates.
References
Pickands, J. (1975) Statistical inference using extreme order statistics. Annals of Statistics, 3, 119-131. doi:10.1214/aos/1176343003
Coles, S. G. (2001) An Introduction to Statistical Modeling of Extreme Values, Springer-Verlag, London. Chapter 4: doi:10.1007/978-1-4471-3675-0_4
Examples
dgp(0:4, scale = 0.5, shape = 0.8)
dgp(1:6, scale = 0.5, shape = -0.2, log = TRUE)
dgp(1, scale = 1, shape = c(-0.2, 0.4))
pgp(0:4, scale = 0.5, shape = 0.8)
pgp(1:6, scale = 0.5, shape = -0.2)
pgp(1, scale = c(1, 2), shape = c(-0.2, 0.4))
pgp(7, scale = 1, shape = c(-0.2, 0.4))
qgp((0:9)/10, scale = 0.5, shape = 0.8)
qgp(0.5, scale = c(0.5, 1), shape = c(-0.5, 0.5))
p <- (1:9)/10
pgp(qgp(p, scale = 2, shape = 0.8), scale = 2, shape = 0.8)
rgp(6, scale = 0.5, shape = 0.8)