fitdistrplus (version 1.0-8)

cdfcompcens: Compares various fitted distributions to censored data on a cdf plot

Description

Plots the empirical cumulative distribution (censored continuous data) with theoretical ones corresponding to various fitted distributions.

Usage

cdfcompcens(ft, xlim, ylim, xlogscale = FALSE, ylogscale = FALSE, main, xlab, ylab, datacol, fitlty, fitcol, addlegend = TRUE, legendtext, xlegend = "bottomright", ylegend = NULL, lines01 = FALSE, Turnbull.confint = FALSE, add = FALSE, ...)

Arguments

ft
One "fitdistcens" object or a list of objects of class "fitdistcens".
xlim
The $x$-limits of the plot.
ylim
The $y$-limits of the plot.
xlogscale
If TRUE, uses a logarithmic scale for the $x$-axis.
ylogscale
If TRUE, uses a logarithmic scale for the $y$-axis.
main
A main title for the plot, see also title.
xlab
A label for the $x$-axis, defaults to a description of x.
ylab
A label for the $y$-axis, defaults to a description of y.
datacol
A specification of the color to be used in plotting data points.
fitcol
A (vector of) color(s) to plot fitted distributions. If there are fewer colors than fits they are recycled in the standard fashion.
fitlty
A (vector of) line type(s) to plot fitted distributions. If there are fewer colors than fits they are recycled in the standard fashion. See also par.
addlegend
If TRUE, a legend is added to the plot.
legendtext
A character or expression vector of length $\geq 1$ to appear in the legend, see also legend.
xlegend, ylegend
The $x$ and $y$ co-ordinates to be used to position the legend. They can be specified by keyword or in any way which is accepted by 'xy.coords': see legend for details.
lines01
A logical to plot two horizontal lines at h=0 and h=1.
Turnbull.confint
if TRUE, confidence intervals will be added to the Turnbull plot of the empirical distribution.
add
logical; if TRUE add to an already existing plot; if FALSE start a new plot.
...
Further graphical arguments passed to graphical functions used in cdfcompcens.

Details

Empirical and theoretical distributions are plotted in cdf. The EM approach of Turnbull (Turnbull, 1974) is used to compute the overall empirical cdf curve, with confidence intervals if Turnbull.confint is TRUE, by calls to functions survfit and plot.survfit from the survival package. By default a legend is added to the plot. Many graphical arguments are optional, dedicated to personalize the plot, and fixed to default values if omitted.

References

Turnbull BW (1974), Nonparametric estimation of a survivorship function with doubly censored data. Journal of American Statistical Association, 69, 169-173.

Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.

See Also

CIcdfplot, plotdistcens, survfit.formula, legend and par.

Examples

Run this code
# (1) Plot various distributions fitted to bacterial contamination data
#
data(smokedfish)
Clog10 <- log10(smokedfish)

fitsfn <- fitdistcens(Clog10,"norm")
summary(fitsfn)

fitsfl <- fitdistcens(Clog10,"logis")
summary(fitsfl)

dgumbel <- function(x,a,b) 1/b*exp((a-x)/b)*exp(-exp((a-x)/b))
pgumbel <- function(q,a,b) exp(-exp((a-q)/b))
qgumbel <- function(p,a,b) a-b*log(-log(p))
fitsfg<-fitdistcens(Clog10,"gumbel",start=list(a=-3,b=3))
summary(fitsfg)

cdfcompcens(list(fitsfn,fitsfl,fitsfg))
cdfcompcens(list(fitsfn,fitsfl,fitsfg),datacol="orange",
    legendtext=c("normal","logistic","Gumbel"),
    main="bacterial contamination fits",
    xlab="bacterial concentration (CFU/g)",ylab="F",
    xlegend = "center",lines01 = TRUE)

Run the code above in your browser using DataLab