Learn R Programming

qrmtools (version 0.0-17)

tail_plot: Plot of an Empirical Surival Function with Smith Estimator

Description

Plot an empirical tail survival function, possibly overlaid with the Smith estimator.

Usage

tail_plot(x, threshold, shape = NULL, scale = NULL,
          q = NULL, length.out = 129, lines.args = list(),
          log = "xy", xlim = NULL, ylim = NULL,
          xlab = "x", ylab = "Tail probability at x", ...)

Value

If both shape and scale are provided, tail_plot()

overlays the empirical tail survival function estimator (evaluated at the exceedances) with the corresponding GPD. In this case,

tail_plot() invisibly returns a list with two two-column matrices, one containing the x-values and y-values of the empirical survival distribution estimator and one containing the x-values and y-values of the Smith estimator. If shape or

scale are NULL, tail_plot() invisibly returns a two-column matrix with the x-values and y-values of the empirical survival distribution estimator.

Arguments

x

numeric vector of data.

threshold

numeric(1) giving the threshold \(u\) above which the tail (starts and) is to be plotted.

shape

NULL or the GPD shape parameter \(\xi\) (typically obtained via fit_GPD_MLE()).

scale

NULL or the GPD shape parameter \(\beta\) (typically obtained via fit_GPD_MLE()).

q

NULL, numeric(1) or numeric vector of evaluationn points of the Smith estimator (semi-parametric GPD-based tail estimator in the POT method). If NULL, the evaluation points are determined internally as an equidistant sequence of length length.out between the smallest and largest exceedance (taken equidistant in log-scale if log contains "x"). If numeric(1), then the behavior is similar to NULL with the exception that the plot is extended to the right of the largest exceedance if q is larger than the largest exceedance.

length.out

length of q.

lines.args

list of arguments passed to the underlying lines().

log

character indicating whether logarithmic axes are to be used.

xlim

x-axis limits.

ylim

y-axis limits.

xlab

x-axis label.

ylab

y-axis label.

...

additional arguments passed to the underlying plot().

Author

Marius Hofert

Examples

Run this code
## Generate losses to work with
set.seed(271)
X <- rt(1000, df = 3.5) # in MDA(H_{1/df}); see MFE (2015, Section 16.1.1)

## Threshold (see ?dGPDtail, for example)
u <- 1.5 # threshold

## Plots of empirical survival distribution functions (overlaid with Smith estimator)
tail_plot(X, threshold = u, log = "", type = "b") # => need log-scale
tail_plot(X, threshold = u, type = "s") # as a step function
fit <- fit_GPD_MLE(X[X > u] - u) # fit GPD to excesses (POT method)
tail_plot(X, threshold = u, # without log-scale
          shape = fit$par[["shape"]], scale = fit$par[["scale"]], log = "")
tail_plot(X, threshold = u, # highlights linearity
          shape = fit$par[["shape"]], scale = fit$par[["scale"]])

Run the code above in your browser using DataLab