Computes mean excess values using the Turnbull estimator. These mean excess values can then be plotted as a function of the empirical quantiles (computed using the Turnbull estimator) or as a function of the tail parameter k.
MeanExcess_TB(L, U = L, censored, trunclower =0, truncupper =Inf, plot =TRUE, k =FALSE, intervalpkg =TRUE, main ="Mean excess plot",...)
Arguments
L: Vector of length n with the lower boundaries of the intervals for interval censored data or the observed data for right censored data.
U: Vector of length n with the upper boundaries of the intervals. By default, they are equal to L.
censored: A logical vector of length n indicating if an observation is censored.
trunclower: Lower truncation point, default is 0.
truncupper: Upper truncation point, default is Inf.
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 values are plotted as a function of the tail parameter k (k=TRUE) or as a function of the empirical quantiles computed using the Turnbull estimator (k=FALSE). Default is FALSE.
intervalpkg: Logical indicating if the Turnbull estimator is computed using the implementation in the interval package if this package is installed. Default is TRUE.
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 values are given by
e^TB(v)=(∫v∞1−F^TB(u)du)/(1−F^TB(v))
where F^TB is the Turnbull estimator for the CDF. More specifically, we use the values v=Q^TB(p) for p=1/(n+1),…,(n−1)/(n+1) where Q^TB(p) is the empirical quantile function corresponding to the Turnbull estimator.
Right censored data should be entered as L=l and U=truncupper, and left censored data should be entered as L=trunclower and U=u.
If the interval package is installed and intervalpkg=TRUE, the icfit function is used to compute the Turnbull estimator. Otherwise, survfit.formula from survival is used.
Use MeanExcess for non-censored data.
See Section 4.3 in Albrecher et al. (2017) for more details.
Returns
A list with following components: - k: Vector of the values of the tail parameter k.
X: Vector of the empirical quantiles, computed using the Turnbull estimator, corresponding to (n-k)/(n+1)=1-(k+1)/(n+1).
e: Vector of the mean excess values corresponding to the tail parameters in k.
References
Albrecher, H., Beirlant, J. and Teugels, J. (2017). Reinsurance: Actuarial and Statistical Aspects, Wiley, Chichester.
Author(s)
Tom Reynkens
See Also
MeanExcess, Turnbull, icfit
Examples
# Pareto random sampleX <- rpareto(500, shape=2)# Censoring variableY <- rpareto(500, shape=1)# Observed sampleZ <- pmin(X, Y)# Censoring indicatorcensored <-(X>Y)# Right boundaryU <- Z
U[censored]<-Inf# Mean excess plotMeanExcess_TB(Z, U, censored, k=FALSE)