# dgpd: Density, cumulative density, quantiles and random number... In texmex: Threshold exceedences and multivariate extremes

## Description

Density, cumulative density, quantiles and random number generation for the generalized Pareto distribution

## Usage

 ```1 2 3 4``` ```dgpd(x, sigma, xi, u = 0, log.d = FALSE) pgpd(q, sigma, xi, u = 0, lower.tail = TRUE, log.p = FALSE) qgpd(p, sigma, xi, u = 0, lower.tail = TRUE, log.p = FALSE) rgpd(n, sigma, xi, u = 0) ```

## Arguments

 `x, q, p` Value, quantile or probability respectively. `n` Number of random numbers to simulate. `sigma` Scale parameter. `xi` Shape parameter. `u` Threshold `log.d, log.p` Whether or not to work on the log scale. `lower.tail` Whether to return the lower tail.

## Details

The functions were originally based on code due to Stuart Coles and which appears in the `ismev` package. The functions have been vectorized and tested.

Random number generation is done by inversion of the distribution function. Code written by Harry Southworth.

## Author(s)

Janet E Heffernan, Harry Southworth

## Examples

 ```1 2 3 4 5``` ``` x <- rgpd(1000, sigma=1, xi=.5) hist(x) x <- rgpd(1000, sigma=exp(rnorm(1000, 1, .25)), xi=rnorm(1000, .5, .2)) hist(x) plot(pgpd(x, sigma=1, xi=.5)) ```

### Example output

```Loading required package: mvtnorm