A collection and description of functions to compute
the generalized Pareto distribution. The
functions compute density, distribution function,
quantile function and generate random deviates
for the GPD. In addition functions to
compute the true moments and to display the distribution
and random variates changing parameters interactively
are available.
The GPD distribution functions are:
dgpd  Density of the GPD Distribution, 
pgpd  Probability function of the GPD Distribution, 
qgpd  Quantile function of the GPD Distribution, 
rgpd  random variates from the GPD distribution, 
gpdMoments  computes true mean and variance, 
gpdSlider  displays density or rvs from a GPD. 
1 2 3 4 5 6 7 
log 
a logical, if 
lower.tail 
a logical, if 
method 
[gpdSlider]  
n 
[rgpd][gpdSim\  
p 
a vector of probability levels, the desired probability for the quantile estimate (e.g. 0.99 for the 99th percentile). 
q 
[pgpd]  
x 
[dgpd]  
xi, mu, beta 

All values are numeric vectors:
d*
returns the density,
p*
returns the probability,
q*
returns the quantiles, and
r*
generates random deviates.
Alec Stephenson for the functions from R's evd
package,
Alec Stephenson for the functions from R's evir
package,
Alexander McNeil for the EVIS functions underlying the evir
package,
Diethelm Wuertz for this Rport.
Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  ## rgpd 
par(mfrow = c(2, 2), cex = 0.7)
r = rgpd(n = 1000, xi = 1/4)
plot(r, type = "l", col = "steelblue", main = "GPD Series")
grid()
## dgpd 
# Plot empirical density and compare with true density:
# Omit values greater than 500 from plot
hist(r, n = 50, probability = TRUE, xlab = "r",
col = "steelblue", border = "white",
xlim = c(1, 5), ylim = c(0, 1.1), main = "Density")
box()
x = seq(5, 5, by = 0.01)
lines(x, dgpd(x, xi = 1/4), col = "orange")
## pgpd 
# Plot df and compare with true df:
plot(sort(r), (1:length(r)/length(r)),
xlim = c(3, 6), ylim = c(0, 1.1), pch = 19,
cex = 0.5, ylab = "p", xlab = "q", main = "Probability")
grid()
q = seq(5, 5, by = 0.1)
lines(q, pgpd(q, xi = 1/4), col = "steelblue")
## qgpd 
# Compute quantiles, a test:
qgpd(pgpd(seq(1, 5, 0.25), xi = 1/4 ), xi = 1/4)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.