PP-plot with fitted and Turnbull survival function
PP-plot with fitted and Turnbull survival function
This function plots the fitted survival function of the spliced distribution versus the Turnbull survival function (which is suitable for interval censored data).
SplicePP_TB(L, U = L, censored, splicefit, x =NULL, log =FALSE, plot =TRUE, main ="Splicing PP-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.
splicefit: A SpliceFit object, e.g. output from SpliceFiticPareto.
x: Vector of points to plot the functions at. When NULL, the default, the empirical quantiles for 1/(n+1),…,n/(n+1), obtained using the Turnbull estimator, are used.
log: Logical indicating if minus the logarithms of the survival probabilities are plotted versus each other, default is FALSE.
plot: Logical indicating if the splicing PP-plot should be made, default is TRUE.
main: Title for the plot, default is "Splicing PP-plot".
...: Additional arguments for the plot function, see plot for more details.
Details
The PP-plot consists of the points
(1−F^TB(xi),1−F^spliced(xi)))
for i=1,…,n with n the length of the data, xi=Q^TB(pi) where pi=i/(n+1), Q^TB is the quantile function obtained using the Turnbull estimator, F^TB the Turnbull estimator for the distribution function and F^spliced the fitted spliced distribution function. The minus-log version of the PP-plot consists of
(−log(1−F^TB(xi)),−log(1−F^spliced(xi))).
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. The limits trunclower and truncupper are obtained from the SpliceFit object.
If the interval package is installed, the icfit function is used to compute the Turnbull estimator. Otherwise, survfit.formula from survival is used.
Use SplicePP for non-censored data.
See Reynkens et al. (2017) and Section 4.3.2 in Albrecher et al. (2017) for more details.
Returns
A list with following components: - spp.the: Vector of the theoretical probabilities 1−F^spliced(xi) (when log=FALSE) or −log(1−F^spliced(xi)) (when log=TRUE).
spp.emp: Vector of the empirical probabilities 1−F^TB(xi) (when log=FALSE) or −log(1−F^TB(xi)) (when log=TRUE).
References
Albrecher, H., Beirlant, J. and Teugels, J. (2017). Reinsurance: Actuarial and Statistical Aspects, Wiley, Chichester.
Reynkens, T., Verbelen, R., Beirlant, J. and Antonio, K. (2017). "Modelling Censored Losses Using Splicing: a Global Fit Strategy With Mixed Erlang and Extreme Value Distributions". Insurance: Mathematics and Economics, 77, 65--77.
Verbelen, R., Gong, L., Antonio, K., Badescu, A. and Lin, S. (2015). "Fitting Mixtures of Erlangs to Censored and Truncated Data Using the EM Algorithm." Astin Bulletin, 45, 729--758
## Not run:# 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# Splice ME and Paretosplicefit <- SpliceFiticPareto(L=Z, U=U, censored=censored, tsplice=quantile(Z,0.9))x <- seq(0,20,0.1)# Plot of spliced CDFplot(x, pSplice(x, splicefit), type="l", xlab="x", ylab="F(x)")# Plot of spliced PDFplot(x, dSplice(x, splicefit), type="l", xlab="x", ylab="f(x)")# Fitted survival function and Turnbull survival function SpliceTB(x, L=Z, U=U, censored=censored, splicefit=splicefit)# Log-log plot with Turnbull survival function and fitted survival functionSpliceLL_TB(x, L=Z, U=U, censored=censored, splicefit=splicefit)# PP-plot of Turnbull survival function and fitted survival functionSplicePP_TB(L=Z, U=U, censored=censored, splicefit=splicefit)# PP-plot of Turnbull survival function and # fitted survival function with log-scalesSplicePP_TB(L=Z, U=U, censored=censored, splicefit=splicefit, log=TRUE)# QQ-plot using Turnbull survival function and fitted survival functionSpliceQQ_TB(L=Z, U=U, censored=censored, splicefit=splicefit)## End(Not run)