Learn R Programming

evmix (version 1.0)

mrlplot: Mean Residual Life Plot

Description

Plots the sample mean residual life (MRL) plot.

Usage

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", ...)

Arguments

data
vector of sample data
tlim
vector of (lower, upper) limits of range of threshold to plot MRL, or NULL to use default values
nt
number of thresholds for which to evaluate MRL
alpha
logical, significance level (0, 1)
p.or.n
logical, should tail fraction (FALSE) or number of exceedances (TRUE) be given on upper x-axis
ylim
y-axis limits or NULL
legend.loc
location of legend (see legend)
try.thresh
vector of threshold to fit GPD using MLE and show theoretical MRL
main
title of plot
xlab
x-axis label
ylab
y-axis label
...
further arguments to be passed to the plotting functions

Value

  • 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 $100(1 - \alpha)%$ confidence interval. The standard deviation and confidence interval are NA for less than 5 exceedances.

Details

Plots the sample mean residual life plot, which is also known as the mean excess plot. The mean residual life above a threshold $u$ is given by mean(x[x > u]) - u, i.e. the sample mean of the exceedances less the threshold. If the generalised Pareto distribution (GPD)is an appropriate model for the excesses above $u$, then for any higher thresholds $v > u$ the MRL will be linear with intercept $(\sigma_u - \xi *u)/(1 - \xi)$ and gradient $\xi/(1 - \xi)$. Symmetric central limit theorem based confidence intervals are provided for all mean excesses, 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 they will be set to each unique datapoint, i.e. the MRL will only be evaluated where there is data. 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.

References

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.

See Also

gpd and mrlplot from evd library

Examples

Run this code
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