GpdDistribution: Generalized Pareto Distribution

Description Usage Arguments Value Author(s) References Examples

Description

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.

Usage

1
2
3
4
5
6
7
dgpd(x, xi = 1, mu = 0, beta = 1, log = FALSE) 
pgpd(q, xi = 1, mu = 0, beta = 1, lower.tail = TRUE) 
qgpd(p, xi = 1, mu = 0, beta = 1, lower.tail = TRUE) 
rgpd(n, xi = 1, mu = 0, beta = 1)

gpdMoments(xi = 1, mu = 0, beta = 1)
gpdSlider(method = c("dist", "rvs"))

Arguments

log

a logical, if TRUE, the log density is returned.

lower.tail

a logical, if TRUE, the default, then probabilities are P[X <= x], otherwise, P[X > x].

method

[gpdSlider] -
a character string denoting what should be displayed. Either the density and "dist" or random variates "rvs".

n

[rgpd][gpdSim\ -
the number of observations to be generated.

p

a vector of probability levels, the desired probability for the quantile estimate (e.g. 0.99 for the 99th percentile).

q

[pgpd] -
a numeric vector of quantiles.

x

[dgpd] -
a numeric vector of quantiles.

xi, mu, beta

xi is the shape parameter, mu the location parameter, and beta is the scale parameter.

Value

All values are numeric vectors:
d* returns the density,
p* returns the probability,
q* returns the quantiles, and
r* generates random deviates.

Author(s)

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 R-port.

References

Embrechts, P., Klueppelberg, C., Mikosch, T. (1997); Modelling Extremal Events, Springer.

Examples

 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) 

Example output

Loading required package: timeDate
Loading required package: timeSeries
Loading required package: fBasics


Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: info@rmetrics.org
Loading required package: fGarch
Loading required package: fTrading
 [1] 0.00 0.00 0.00 0.00 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00 2.25 2.50
[16] 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00
attr(,"control")
   xi mu beta lower.tail
 0.25  0    1       TRUE

fExtremes documentation built on Nov. 17, 2017, 2:21 p.m.