# Generalized Pareto Distribution

##### The Generalized Pareto Distribution

Density, distribution function, quantile function and random generation for the GP distribution with location equal to 'loc', scale equal to 'scale' and shape equal to 'shape'.

- Keywords
- distribution

##### Usage

```
rgpd(n, loc = 0, scale = 1, shape = 0)
pgpd(q, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, lambda = 0)
qgpd(p, loc = 0, scale = 1, shape = 0, lower.tail = TRUE, lambda = 0)
dgpd(x, loc = 0, scale = 1, shape = 0, log = FALSE)
```

##### Arguments

- x, q
vector of quantiles.

- p
vector of probabilities.

- n
number of observations.

- loc
vector of the location parameters.

- scale
vector of the scale parameters.

- shape
a numeric of the shape parameter.

- lower.tail
logical; if TRUE (default), probabilities are \(\Pr[ X \le x]\), otherwise, \(\Pr[X > x]\).

- log
logical; if TRUE, probabilities p are given as log(p).

- lambda
a single probability - see the "value" section.

##### Value

If 'loc', 'scale' and 'shape' are not specified they assume the default values of '0', '1' and '0', respectively.

The GP distribution function for loc = \(u\), scale = \(\sigma\) and shape = \(\xi\) is

$$G(x) = 1 - \left[ 1 + \frac{\xi (x - u )}{ \sigma } \right] ^ { - 1 / \xi}$$

for \(1 + \xi ( x - u ) / \sigma > 0\) and \(x > u\), where \(\sigma > 0\). If \(\xi = 0\), the distribution is defined by continuity corresponding to the exponential distribution.

By definition, the GP distribution models exceedances above a threshold. In particular, the \(G\) function is a suited candidate to model

$$\Pr\left[ X \geq x | X > u \right] = 1 - G(x)$$ for \(u\) large enough.

However, it may be usefull to model the "non conditional" quantiles, that is the ones related to \(\Pr[ X \leq x]\). Using the conditional probability definition, one have :

$$\Pr\left[ X \geq x \right] = \left(1 - \lambda\right) \left( 1 + \xi \frac{x - u}{\sigma}\right)^{-1/\xi}$$ where \(\lambda = \Pr[ X \leq u]\).

When \(\lambda = 0\), the "conditional" distribution is equivalent to the "non conditional" distribution.

##### Examples

```
# NOT RUN {
dgpd(0.1)
rgpd(100, 1, 2, 0.2)
qgpd(seq(0.1, 0.9, 0.1), 1, 0.5, -0.2)
pgpd(12.6, 2, 0.5, 0.1)
##for non conditional quantiles
qgpd(seq(0.9, 0.99, 0.01), 1, 0.5, -0.2, lambda = 0.9)
pgpd(2.6, 2, 2.5, 0.25, lambda = 0.5)
# }
```

*Documentation reproduced from package SpatialExtremes, version 2.0-7, License: GPL (>= 2)*