# MeanExcess: Mean excess function In ReIns: Functions from "Reinsurance: Actuarial and Statistical Aspects"

## Description

Computes the mean excess values for a vector of observations. These mean excess values can then be plotted as a function of the data or as a function of the tail parameter k.

## Usage

 `1` ```MeanExcess(data, plot = TRUE, k = FALSE, main = "Mean excess plot", ...) ```

## Arguments

 `data` Vector of n observations. `plot` Logical indicating if the mean excess values should be plotted in a mean excess plot, default is `TRUE`. `k` Logical indicating if the mean excess scores are plotted as a function of the tail parameter k (`k=TRUE`) or as a function of the data (`k=FALSE`). Default is `FALSE`. `main` Title for the plot, default is `"Mean excess plot"`. `...` Additional arguments for the `plot` function, see `plot` for more details.

## Details

The mean excess plot is

(k,e_{k,n})

or

(X_{n-k,n}, e_{k,n})

with

e_{k,n}=1/k∑_{j=1}^k X_{n-j+1,n}-X_{n-k,n}.

Note that the mean excess plot is the derivative plot of the Exponential QQ-plot.

See Section 4.1 of Albrecher et al. (2017) for more details.

## Value

A list with following components:

 `k` Vector of the values of the tail parameter `k`. `X` Vector of the order statistics `data[n-k]` corresponding to the tail parameters in `k`. `e` Vector of the mean excess values corresponding to the tail parameters in `k`.

## Author(s)

Tom Reynkens based on `S-Plus` code from Yuri Goegebeur.

## References

Albrecher, H., Beirlant, J. and Teugels, J. (2017). Reinsurance: Actuarial and Statistical Aspects, Wiley, Chichester.

Beirlant J., Goegebeur Y., Segers, J. and Teugels, J. (2004). Statistics of Extremes: Theory and Applications, Wiley Series in Probability, Wiley, Chichester.

`ExpQQ`, `LognormalQQ_der`, `ParetoQQ_der`, `WeibullQQ_der`
 ```1 2 3 4 5 6 7 8 9``` ```data(norwegianfire) # Mean excess plots for Norwegian Fire Insurance data for claims in 1976. # Mean excess values as a function of k MeanExcess(norwegianfire\$size[norwegianfire\$year==76], k=TRUE) # Mean excess values as a function of the data MeanExcess(norwegianfire\$size[norwegianfire\$year==76], k=FALSE) ```