tail_plot | R Documentation |
Plot an empirical tail survival function, possibly overlaid with the Smith estimator.
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", ...)
x |
|
threshold |
|
shape |
|
scale |
|
q |
|
length.out |
length of |
lines.args |
|
log |
|
xlim |
x-axis limits. |
ylim |
y-axis limits. |
xlab |
x-axis label. |
ylab |
y-axis label. |
... |
additional arguments passed to the underlying
|
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.
Marius Hofert
## 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"]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.