GPD {Renext} | R Documentation |
Generalised Pareto Distribution
Description
Density function, distribution function, quantile function, random generation, hazard and cumulative hazard functions for the Generalised Pareto Distribution.
Usage
dGPD(x, loc = 0.0, scale = 1.0, shape = 0.0, log = FALSE)
pGPD(q, loc = 0.0, scale = 1.0, shape = 0.0, lower.tail = TRUE)
qGPD(p, loc = 0.0, scale = 1.0, shape = 0.0, lower.tail = TRUE)
rGPD(n, loc = 0.0, scale = 1.0, shape = 0.0)
hGPD(x, loc = 0.0, scale = 1.0, shape = 0.0)
HGPD(x, loc = 0.0, scale = 1.0, shape = 0.0)
Arguments
x , q |
Vector of quantiles. |
p |
Vector of probabilities. |
n |
Number of observations. |
loc |
Location parameter |
scale |
Scale parameter |
shape |
Shape parameter |
log |
Logical; if |
lower.tail |
Logical; if |
Details
Let ,
and
denote
loc
,
scale
and shape
. The distribution values
are
.
When , the survival function value for
is given by
where the upper end-point is
for
and
for
.
When , the distribution is exponential with survival
Value
dGPD
gives the density function, pGPD
gives the
distribution function, qGPD
gives the quantile function, and
rGPD
generates random deviates. The functions
hGPD
and HGPD
return the hazard rate and the cumulative
hazard.
Note
The functions are slight adaptations of the [r,d,p,q]gpd
functions in the evd package. The main difference is that
these functions return NaN
when shape
is negative, as
it might be needed in unconstrained optimisation. The quantile function
can be used with p=0
and p=1
, then returning the lower and
upper end-point.
See Also
fGPD
to fit such a distribution by Maximum Likelihood.
Examples
qGPD(p = c(0, 1), shape = -0.2)
shape <- -0.3
xlim <- qGPD(p = c(0, 1), shape = shape)
x <- seq(from = xlim[1], to = xlim[2], length.out = 100)
h <- hGPD(x, shape = shape)
plot(x, h, type = "o", main = "hazard rate for shape < 0")
shape <- 0.2
xlim <- qGPD(p = c(0, 1 - 1e-5), shape = shape)
x <- seq(from = xlim[1], to = xlim[2], length.out = 100)
h <- hGPD(x, shape = shape)
plot(x, h, type = "o", main = "hazard rate shape > 0 ")