\HeaderA{GpdDistribution}{GPD Distributions for Extreme Value Theory}{GpdDistribution}
\aliasA{dgpd}{GpdDistribution}{dgpd}
\aliasA{pgpd}{GpdDistribution}{pgpd}
\aliasA{qgpd}{GpdDistribution}{qgpd}
\aliasA{rgpd}{GpdDistribution}{rgpd}
\keyword{distribution}{GpdDistribution}
\begin{Description}\relax
A collection and description of distribution functions 
used in extreme value theory. The functions compute 
density, distribution function, quantile function and 
generate random deviates for the Generalized Pareto 
Distribution GPD.
\\

The functions are:

\Tabular{ll}{
\code{dgpd} & Density of the GPD Distribution, \\
\code{pgpd} & Probability function of the GPD Distribution, \\
\code{qgpd} & Quantile function of the GPD Distribution, \\
\code{rgpd} & Random variates from the GPD Distribution. }
\end{Description}
\begin{Usage}
\begin{verbatim}
dgpd(x, xi = 1, mu = 0, beta = 1) 
pgpd(q, xi = 1, mu = 0, beta = 1) 
qgpd(p, xi = 1, mu = 0, beta = 1) 
rgpd(n, xi = 1, mu = 0, beta = 1)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{n}] the number of observations.

\item[\code{p}] a numeric vector of probabilities.

\item[\code{q}] a numeric vector of quantiles.

\item[\code{x}] a numeric vector of quantiles.

\item[\code{xi, mu, beta}] \code{xi} is the shape parameter, 
\code{mu} the location parameter,
and \code{beta} is the scale parameter.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\bold{Generalized Pareto Distribution:}
\\\\
Compute density, distribution function, quantile function and 
generates random variates for the Generalized Pareto Distribution.
\end{Details}
\begin{Value}
All values are numeric vectors: \\
\code{d*} returns the density, \\
\code{p*} returns the probability, \\
\code{q*} returns the quantiles, and \\
\code{r*} generates random deviates. \\
\end{Value}
\begin{Author}\relax
Alec Stephenson for the functions from R's \code{evd} package, \\
Diethelm Wuertz for this \R-port.
\end{Author}
\begin{References}\relax
Embrechts, P., Klueppelberg, C., Mikosch, T. (1997);
\emph{Modelling Extremal Events}, Springer.
\end{References}
\begin{Examples}
\begin{ExampleCode}
## SOURCE("fExtremes.53A-GpdModelling")

## *gpd  -
   xmpExtremes("\nStart: Simulate GPD Distributed sample >")
   par(mfrow = c(2, 2))
   r = rgpd(n = 1000, xi = 1/4)
   plot(r, type = "l", main = "GPD Series")
   
## Plot empirical density and compare with true density:
## Omit values greater than 500 from plot
   xmpExtremes("\nNext: Plot Empirical and True Density >")
   hist(r, n = 50, probability = TRUE, xlab = "r", 
     xlim = c(-5, 5), ylim = c(0, 1.1), main = "Density")
   x = seq(-5, 5, by = 0.01)
   lines(x, dgpd(x, xi = 1/4), col = "steelblue3")
   
## Plot df and compare with true df:
   xmpExtremes("\nNext: Plot Empirical and True Probability >")
   plot(sort(r), (1:length(r)/length(r)), 
     xlim = c(-3, 6), ylim = c(0, 1.1),
     cex = 0.5, ylab = "p", xlab = "q", main = "Probability")
   q = seq(-5, 5, by = 0.1)
   lines(q, pgpd(q, xi = 1/4), col = "steelblue3")
   
## Compute quantiles, a test:
   xmpExtremes("\nNext: Compute Quantiles >")
   qgpd(pgpd(seq(-1, 5, 0.25), xi = 1/4 ), xi = 1/4) 
 
\end{ExampleCode}
\end{Examples}

