GPDtail function

GPD-Based Tail Distribution (POT method)

GPD-Based Tail Distribution (POT method)

Density, distribution function, quantile function and random variate generation for the GPD-based tail distribution in the POT method.

dGPDtail(x, threshold, p.exceed, shape, scale, log = FALSE) pGPDtail(q, threshold, p.exceed, shape, scale, lower.tail = TRUE, log.p = FALSE) qGPDtail(p, threshold, p.exceed, shape, scale, lower.tail = TRUE, log.p = FALSE) rGPDtail(n, threshold, p.exceed, shape, scale)

Arguments

  • x, q: vector of quantiles.

  • p: vector of probabilities.

  • n: number of observations.

  • threshold: threshold uu in the POT method.

  • p.exceed: probability of exceeding the threshold u; for the Smith estimator, this is mean(x > threshold) for x

    being the data.

  • shape: GPD shape parameter xixi (a real number).

  • scale: GPD scale parameter betabeta (a positive number).

  • lower.tail: logical; if TRUE (default) probabilities are P(X<=x)P(X <= x) otherwise, P(X>x)P(X > x).

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

Returns

dGPDtail() computes the density, pGPDtail() the distribution function, qGPDtail() the quantile function and rGPDtail() random variates of the GPD-based tail distribution in the POT method.

Details

Let uu denote the threshold (threshold), pup_u the exceedance probability (p.exceed) and FGPDF_{GPD} the GPD distribution function. Then the distribution function of the GPD-based tail distribution is given by

F(q)=1pu(1FGPD(qu)) F(q) = 1-p_u(1-F_{GPD}(q - u))

. The quantile function is

F1(p)=u+FGPD1(1(1p)/pu) F^{-1}(p) = u + F_GPD^{-1}(1-(1-p)/p_u)

and the density is

f(x)=pufGPD(xu) f(x) = p_u f_{GPD}(x - u)

, where fGPDf_{GPD} denotes the GPD density.

Note that the distribution function has a jumpt of height P(X<=u)P(X <=u) (1-p.exceed) at uu.

Author(s)

Marius Hofert

References

McNeil, A. J., Frey, R., and Embrechts, P. (2015). Quantitative Risk Management: Concepts, Techniques, Tools. Princeton University Press.

Examples

## Generate data to work with set.seed(271) X <- rt(1000, df = 3.5) # in MDA(H_{1/df}); see MFE (2015, Section 16.1.1) ## Determine thresholds for POT method mean_excess_plot(X[X > 0]) abline(v = 1.5) u <- 1.5 # threshold ## Fit GPD to the excesses (per margin) fit <- fit_GPD_MLE(X[X > u] - u) fit$par 1/fit$par["shape"] # => close to df ## Estimate threshold exceedance probabilities p.exceed <- mean(X > u) ## Define corresponding densities, distribution function and RNG dF <- function(x) dGPDtail(x, threshold = u, p.exceed = p.exceed, shape = fit$par["shape"], scale = fit$par["scale"]) pF <- function(q) pGPDtail(q, threshold = u, p.exceed = p.exceed, shape = fit$par["shape"], scale = fit$par["scale"]) rF <- function(n) rGPDtail(n, threshold = u, p.exceed = p.exceed, shape = fit$par["shape"], scale = fit$par["scale"]) ## Basic check of dF() curve(dF, from = u - 1, to = u + 5) ## Basic check of pF() curve(pF, from = u, to = u + 5, ylim = 0:1) # quite flat here abline(v = u, h = 1-p.exceed, lty = 2) # mass at u is 1-p.exceed (see 'Details') ## Basic check of rF() set.seed(271) X. <- rF(1000) plot(X., ylab = "Losses generated from the fitted GPD-based tail distribution") stopifnot(all.equal(mean(X. == u), 1-p.exceed, tol = 7e-3)) # confirms the above ## Pick out 'continuous part' X.. <- X.[X. > u] plot(pF(X..), ylab = "Probability-transformed tail losses") # should be U[1-p.exceed, 1]
  • Maintainer: Marius Hofert
  • License: GPL (>= 3) | file LICENCE
  • Last published: 2024-03-04

Useful links