
Last chance! 50% off unlimited learning
Sale ends in
Plots the sample mean residual life (MRL) plot.
mrlplot(data, tlim = NULL, nt = min(100, length(data)), p.or.n = FALSE,
alpha = 0.05, ylim = NULL, legend.loc = "bottomleft",
try.thresh = quantile(data, 0.9, na.rm = TRUE),
main = "Mean Residual Life Plot", xlab = "Threshold u",
ylab = "Mean Excess", ...)
vector of sample data
vector of (lower, upper) limits of range of threshold
to plot MRL, or NULL
to use default values
number of thresholds for which to evaluate MRL
logical, should tail fraction (FALSE
) or number of
exceedances (TRUE
) be given on upper x-axis
significance level over range (0, 1), or NULL
for no CI
y-axis limits or NULL
location of legend (see legend
) or NULL
for no legend
vector of thresholds to consider
title of plot
x-axis label
y-axis label
further arguments to be passed to the plotting functions
mrlplot
gives the mean residual life plot. It also
returns a matrix containing columns of the threshold, number of exceedances, mean excess,
standard devation of excesses and NA
for less than 5 exceedances.
Plots the sample mean residual life plot, which is also known as the mean excess plot.
If the generalised Pareto distribution (GPD) is an appropriate model for the excesses mean(x[x > v]) - v
.
Symmetric CLT based confidence intervals are provided, provided there are at least 5 exceedances. The sampling density for the MRL is shown by a greyscale image, where lighter greys indicate low density.
A pre-chosen threshold (or more than one) can be given in try.thresh
. The GPD is
fitted to the excesses using maximum likelihood estimation. The estimated parameters are
used to plot the linear function for all higher thresholds using a solid line. The threshold
should set as low as possible, so a dashed line is shown below the pre-chosen threshold.
If the MRL is similar to the dashed line then a lower threshold may be chosen.
If no threshold limits are provided tlim = NULL
then the lowest threshold is set
to be just below the median data point and the maximum threshold is set to the 6th
largest datapoint.
The range of permitted thresholds is just below the minimum datapoint and the second largest value. If there are less unique values of data within the threshold range than the number of threshold evalations requested, then instead of a sequence of thresholds the MRL will be evaluated at each unique datapoint.
The missing (NA
and NaN
) and non-finite values are ignored.
The lower x-axis is the threshold and an upper axis either gives the number of
exceedances (p.or.n = FALSE
) or proportion of excess (p.or.n = TRUE
).
Note that unlike the gpd
related functions the missing values are ignored, so
do not add to the lower tail fraction. But ignoring the missing values is consistent
with all the other mixture model functions.
Scarrott, C.J. and MacDonald, A. (2012). A review of extreme value threshold estimation and uncertainty quantification. REVSTAT - Statistical Journal 10(1), 33-59. Available from http://www.ine.pt/revstat/pdf/rs120102.pdf
Coles S.G. (2004). An Introduction to the Statistical Modelling of Extreme Values. Springer-Verlag: London.
# NOT RUN {
x = rnorm(1000)
mrlplot(x)
mrlplot(x, tlim = c(0, 2.2))
mrlplot(x, tlim = c(0, 2), try.thresh = c(0.5, 1, 1.5))
mrlplot(x, tlim = c(0, 3), try.thresh = c(0.5, 1, 1.5))
# }
Run the code above in your browser using DataLab