# MRL.plot: Mean residual life (MRL) plot In envoutliers: Methods for Identification of Outliers in Environmental Data

## Description

An empirical mean residual life plot (Coles, 2001), including confidence intervals, is produced based on maximum likelihood or moment estimates.

## Usage

 ```1 2 3 4 5``` ```MRL.plot(x, umin = quantile(na.omit(x), probs = 0.8), umax = quantile(na.omit(x), probs = 0.95), kmin = round(length(na.omit(x)) * 0.05), kmax = round(length(na.omit(x)) * 0.2), nint = 100, conf = 0.95, est.method = "mle", u0 = NULL, k0 = NULL) ```

## Arguments

 `x` data values. Supported data types a numeric vector a time series object `ts` a time series object `xts` a time series object `zoo` `umin` the minimum threshold at which the mean residual life function is calculated based on maximum likelihood estimates. Default is `umin = quantile(na.omit(x), probs = 0.8)`. `umax` the maximum threshold at which the mean residual life function is calculated based on maximum likelihood estimates. Default is `umin = quantile(na.omit(x), probs = 0.95)`. `kmin` the minimum number of largest order statistics for which the mean residual life function is calculated based on moment estimates. Default is `kmin = round(length(na.omit(x)) * 0.05)`. `kmax` the maximum number of largest order statistics for which the mean residual life function is calculated based on moment estimates. Default is `kmax = round(length(na.omit(x)) * 0.2)`. `nint` the number of points at which the mean residual life function is calculated. Default is `nint = 100`. `conf` the confidence coefficient for the confidence intervals depicted in the plot. Default is `conf = 0.95`. `est.method` a character string specifying the type of estimates for the scale and shape parameters of GP distribution. Possible options are `"mle"` (default) to use maximum likelihood estimates (Coles, 2001) `"moment"` to use moment estimates (de Haan and Ferreira2006). `u0` a numeric value giving the threshold meant for a GP approximation of the threshold exceedances. Default is `u0 = NULL`. `k0` a numeric value giving the number `(k0-1)` of largest observations meant for a GP approximation. Default is `k0 = NULL`.

## Details

The function constructs MRL plot (Coles, 2001) based on maximum likelihood or moment estimates for parameters of GP distribution. The MRL, i.e. the estimates of the mean excess, are expected to change linearly with threshold levels at which the GP model is appropriate. If `u0` (or `k0`, respectively) is given, a GP mean-threshold dependency line is plotted in addition to the MRL plot (Coles, 2001; Eq. 4.9). Each of the lines provide the user an option to assess the suitability of `u0` or `k0` as a lower bound for the threshold exceedances (for `u0`) or the number of upper order statistics (for `k0`) to fit the GP distribution. In case `est.method = "mle"` and `u0` takes a value, the theoretical GP mean is estimated by the MLE estimates of the GP parameters. For the case `est.method = "moment"` and `k0` is given, the theoretical GP mean is estimated using the moment estimates. In case `est.method = "moment"` the value `x(n-k)` on the x-axis of MRL plot denotes the `(k + 1)`-th largest observation of the total number of `n` observations.

## References

Theo Gasser, Alois Kneip & Walter Koehler (1991) A flexible and fast method for automatic smoothing. Journal of the American Statistical Association 86, 643-652. https://doi.org/10.2307/2290393

E. Herrmann (1997) Local bandwidth choice in kernel regression estimation. Journal of Graphical and Computational Statistics 6, 35-54.

Herrmann E, Maechler M (2013). lokern: Kernel Regression Smoothing with Local or Global Plug-in Bandwidth. R package version 1.1-5, URL http://CRAN.R-project.org/package=lokern.

Gasser, T, Muller, H-G, Mammitzsch, V (1985). Kernels for nonparametric curve estimation. Journal of the Royal Statistical Society, B Met., 47(2), 238-252.

Coles, S (2001). An Introduction to Statistical Modeling of Extreme Values. Springer-Verlag, London, U.K., 208pp.

de Haan, L, Ferreira, A (2006). Extreme Value Theory: An Introduction. Springer.

## Examples

 ```1 2 3 4``` ```data("mydata", package = "openair") x = mydata\$o3[format(mydata\$date, "%m %Y") == "12 2002"] res = smoothing(y = x)\$residuals MRL.plot(res) ```

### Example output

```
```

envoutliers documentation built on July 2, 2020, 3:25 a.m.