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", ...)
NULL
to use default
valuesFALSE
) or number of exceedances (TRUE
) be
given on upper x-axisNULL
legend
)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.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.gpd
and
mrlplot
from
evd
libraryx = 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