Learn R Programming

QRM (version 0.4-7)

POT: Peaks-over-Threshold Method

Description

Functions for fitting, analysing and risk measures according to POT/GPD

Usage

fit.GPD(data, threshold = NA, nextremes = NA, type = c("ml", "pwm"),
        information = c("observed", "expected"), optfunc = c("optim", "nlminb"), ...)
findthreshold(data, ne)
plotTail(object, extend = 2, fineness = 1000, ...)
MEplot(data, omit = 3, labels=TRUE, ...)
xiplot(data, models = 30., start = 15., end = 500., reverse = TRUE, 
       ci = 0.95, auto.scale = TRUE, labels = TRUE, table = FALSE, ...)
hillPlot(data, option = c("alpha", "xi", "quantile"), start = 15, 
         end = NA, reverse = FALSE, p = NA, ci = 0.95,
         auto.scale = TRUE, labels = TRUE, ...)
plotFittedGPDvsEmpiricalExcesses(data, threshold = NA, nextremes = NA)
showRM(object, alpha, RM = c("VaR", "ES"), extend = 2, ci.p = 0.95,
       like.num = 50., ...)
RiskMeasures(out, p)

Arguments

alpha
numeric, probability level(s).
auto.scale
logical, whether plot should be automatically scaled.
ci
numeric, probability for asymptotic confidence bands.
ci.p
numeric, confidence levels.
data
numeric, data vector or timesSeries.
end
integer, maximum number of exceedances to be considered.
extend
numeric, extension of plotting range.
fineness
integer, count of points at which to evaluate the tail estimate.
information
character, whether standard errors should be calculated with observed or expected information. This only applies to maximum likelihood type; for pwm type expected
labels
logical, whether axes shall be labelled.
like.num
integer, count of evaluations of profile likelihood.
type
character, estimation by either ML- or PWM type.
models
integer, count of consecutive gpd models to be fitted; i.e., the count of different thresholds at which to re-estimate $\xi$; this many $\xi$ estimates will be plotted.
ne
integer, count of excesses above the threshold.
nextremes
integer, count of upper extremes to be used.
object
list, returned value from fitting GPD
omit
integer, count of upper plotting points to be omitted.
optfunc
character, function used for ML-optimization.
option
logical, whether "alpha", "xi" (1 / alpha) or "quantile" (a quantile estimate) should be plotted.
out
list, returned value from fitting GPD.
p
vector, probability levels for risk measures.
reverse
logical, plot ordered by increasing threshold or number of extremes.
RM
character, risk measure, either "VaR" or "ES"
start
integer, lowest number of exceedances to be considered.
table
logical, printing of a result table.
threshold
numeric, threshold value.
...
ellpsis, arguments are passed down to either plot() or optim() or nlminb().

Details

MEplot(): An upward trend in plot shows heavy-tailed behaviour. In particular, a straight line with positive gradient above some threshold is a sign of Pareto behaviour in tail. A downward trend shows thin-tailed behaviour whereas a line with zero gradient shows an exponential tail. Because upper plotting points are the average of a handful of extreme excesses, these may be omitted for a prettier plot. RiskMeasures(): calculates risk measures (VaR or ES) based on a generalized Pareto model fitted to losses over a high threshold. xiplot(): creates a plot showing how the estimate of shape varies with threshold or number of extremes. hillplot(): This plot is usually calculated from the alpha perspective. For a generalized Pareto analysis of heavy-tailed data using the gpd function, it helps to plot the Hill estimates for xi. See pages 286--289 in QRM. Especially note that Example 7.28 suggests the best estimates occur when the threshold is very small, perhaps 0.1 of the sample size (10--50 order statistics in a sample of size 1000). Hence one should NOT be using a 95 percent threshold for Hill estimates. plotFittedGPDvsEmpiricalExcesses(): Build a graph which plots the GPD fit of excesses over a threshold u and the corresponding empirical distribution function for observed excesses.

See Also

GEV

Examples

Run this code
data(danish)
plot(danish)
MEplot(danish)
xiplot(danish) 
hillPlot(danish, option = "alpha", start = 5, end = 250, p = 0.99)
hillPlot(danish, option = "alpha", start = 5, end = 60, p = 0.99)
plotFittedGPDvsEmpiricalExcesses(danish, nextremes = 109)
plotFittedGPDvsEmpiricalExcesses(danish, threshold = 10)
findthreshold(danish, 50)
mod1 <- fit.GPD(danish, threshold = 10) 
RiskMeasures(mod1, c(0.95, 0.99)) 
plotTail(mod1)
showRM(mod1, 0.99, RM = "VaR", method = "BFGS")
showRM(mod1, 0.99, RM = "ES", method = "BFGS")
mod2 <- fit.GPD(danish, threshold = 10, type = "pwm")
mod3 <- fit.GPD(danish, threshold = 10, optfunc = "nlminb")

Run the code above in your browser using DataLab