| cdfcompcens {fitdistrplus} | R Documentation |
Plots the empirical cumulative distribution (censored continuous data) with theoretical ones corresponding to various fitted distributions.
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, ...)
ft |
One |
xlim |
The x-limits of the plot. |
ylim |
The y-limits of the plot. |
xlogscale |
If |
ylogscale |
If |
main |
A main title for the plot, see also |
xlab |
A label for the x-axis, defaults to a description of |
ylab |
A label for the y-axis, defaults to a description of |
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 |
addlegend |
If |
legendtext |
A character or expression vector of length ≥q 1 to appear
in the legend, see also |
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 |
lines01 |
A logical to plot two horizontal lines at |
Turnbull.confint |
if TRUE, confidence intervals will be added to the Turnbull plot of the empirical distribution. |
add |
logical; if |
... |
Further graphical arguments passed to graphical functions used in |
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.
Marie-Laure Delignette-Muller and Christophe Dutang.
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.
CIcdfplot, plotdistcens, survfit.formula, legend
and par.
# (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)