# mrl: Mean residual life plot In harrysouthworth/texmex: Statistical Modelling of Extreme Values

## Description

Calculate mean residual life and plot it to aid the identification of a threshold over which to fit a generalized Pareto distribution

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14``` ```mrl(data, umin = min(data), umax = max(data) - 0.1, nint = 100, alpha=.050) ## S3 method for class 'mrl' print(x, ...) ## S3 method for class 'summary.mrl' print(x, ...) ## S3 method for class 'mrl' summary(object, ...) ## S3 method for class 'mrl' plot(x, xlab="Threshold", ylab="Mean excess", ...) ## S3 method for class 'mrl' ggplot(data, mapping, xlab = "Threshold", ylab = "Mean excess", main=NULL,fill="orange", col="blue", rug=TRUE, addNexcesses=TRUE, textsize=4, ..., environment) ```

## Arguments

 `data` A numeric vector. `umin` The minimum value over which to threshold the data. `umax` The maximum value over which to threshold the data. `nint` The number of points at which to compute the plot. `alpha` Used to determine coverage of confidence interval to plot. Defaults to plotting a 95% interval. `x, object` Arguments to print, summary and plot functions. `xlab` Label for the x-axis. Defaults to `xlab="Threshold"`. `ylab` Label for the y-axis. Defaults to `ylab="Mean excess"`. `...` Optional arguments to `plot`. `col` Colour of the line on the MRL plot. `rug` Whether to add raw data as a rug along axis of plot. `fill` Colour of the pointwise confidence region on the MRL plot. `main` Main title. `addNexcesses` Whether to annotate the plot with the numbers of excesses over increasing thresholds. Defaults to `addNexcesses=TRUE`. `textsize` Size of text on the plot (ggplot). Defaults to `textsize=4`. `mapping, environment` Not used.

## Details

Threshold choice for the fitting of the GPD is guided by the shape of the Mean Residual Life plot. A threshold which is suitably high will have a corresponding mrl plot which is approximately linear in shape above the threshold (up to sampling variation).

## Value

A list with two components. `data` is the original data, `mrl` is a matrix containing information to produce the mean residual life plot.

## Note

The function was originally written by Stuart Coles and appears in the `ismev` package. This version modified by Harry Southworth to allow more control over the appearance of the plot.

## Author(s)

Janet E. Heffernan, Harry Southworth

## References

S. Coles, An Introduction to Statistical Modeling of Extreme Values, Springer, 2001

harrysouthworth/texmex documentation built on Oct. 12, 2018, 1:08 p.m.