graphcompcens | R Documentation |
cdfcompcens
plots the empirical cumulative distribution against fitted distribution functions,
qqcompcens
plots theoretical quantiles against empirical ones,
ppcompcens
plots theoretical probabilities against empirical ones.
cdfcompcens(ft, xlim, ylim, xlogscale = FALSE, ylogscale = FALSE, main, xlab, ylab, datacol, fillrect, fitlty, fitcol, fitlwd, addlegend = TRUE, legendtext, xlegend = "bottomright", ylegend = NULL, lines01 = FALSE, Turnbull.confint = FALSE, NPMLE.method = "Wang", add = FALSE, plotstyle = "graphics", ...) qqcompcens(ft, xlim, ylim, xlogscale = FALSE, ylogscale = FALSE, main, xlab, ylab, fillrect, fitcol, fitlwd, addlegend = TRUE, legendtext, xlegend = "bottomright", ylegend = NULL, line01 = TRUE, line01col = "black", line01lty = 1, ynoise = TRUE, NPMLE.method = "Wang", plotstyle = "graphics", ...) ppcompcens(ft, xlim, ylim, xlogscale = FALSE, ylogscale = FALSE, main, xlab, ylab, fillrect, fitcol, fitlwd, addlegend = TRUE, legendtext, xlegend = "bottomright", ylegend = NULL, line01 = TRUE, line01col = "black", line01lty = 1, ynoise = TRUE, NPMLE.method = "Wang", plotstyle = "graphics", ...)
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. |
fillrect |
A specification of the color to be used for filling rectanges
of non uniqueness of the empirical cumulative distribution
(only used if |
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 values than fits they are recycled in the standard fashion.
See also |
fitlwd |
A (vector of) line size(s) to plot fitted distributions.
If there are fewer values 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 coordinates to be used to position the legend.
They can be specified by keyword.
If |
lines01 |
A logical to plot two horizontal lines at |
Turnbull.confint |
if TRUE confidence intervals will be added to the Turnbull plot.
In that case NPMLE.method is forced to |
NPMLE.method |
Three NPMLE techniques are provided, |
add |
If |
line01 |
A logical to plot an horizontal line y=x for
|
line01col, line01lty |
Color and line type for |
ynoise |
A logical to add a small noise when plotting empirical
quantiles/probabilities for |
plotstyle |
|
... |
Further graphical arguments passed to graphical functions used in |
See details of plotdistcens
for a detailed description of provided goddness-of-fit plots.
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.
Wang Y (2008), Dimension-reduced nonparametric maximum likelihood computation for interval-censored data. Computational Statistics & Data Analysis, 52, 2388-2402.
Wang Y and Taylor SM (2013), Efficient computation of nonparametric survival functions via a hierarchical mixture formulation. Statistics and Computing, 23, 713-725.
Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.
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) # CDF plot cdfcompcens(list(fitsfn,fitsfl,fitsfg)) cdfcompcens(list(fitsfn,fitsfl,fitsfg),datacol="orange",fillrect = NA, legendtext=c("normal","logistic","Gumbel"), main="bacterial contamination fits", xlab="bacterial concentration (CFU/g)",ylab="F", xlegend = "bottom",lines01 = TRUE) # alternative Turnbull plot for the empirical cumulative distribution # (default plot of the previous versions of the package) cdfcompcens(list(fitsfn,fitsfl,fitsfg), NPMLE.method = "Turnbull.middlepoints") # customizing graphical output with ggplot2 if (requireNamespace ("ggplot2", quietly = TRUE)) { cdfcompcens <- cdfcompcens(list(fitsfn,fitsfl,fitsfg),datacol="orange",fillrect = NA, legendtext=c("normal","logistic","Gumbel"), xlab="bacterial concentration (CFU/g)",ylab="F", xlegend = "bottom",lines01 = TRUE, plotstyle = "ggplot") cdfcompcens + ggplot2::theme_minimal() + ggplot2::ggtitle("Bacterial contamination fits") } # PP plot ppcompcens(list(fitsfn,fitsfl,fitsfg)) ppcompcens(list(fitsfn,fitsfl,fitsfg), ynoise = FALSE) par(mfrow = c(2,2)) ppcompcens(fitsfn) ppcompcens(fitsfl) ppcompcens(fitsfg) par(mfrow = c(1,1)) if (requireNamespace ("ggplot2", quietly = TRUE)) { ppcompcens(list(fitsfn,fitsfl,fitsfg), plotstyle = "ggplot") ppcompcens(list(fitsfn,fitsfl,fitsfg), plotstyle = "ggplot", fillrect = c("lightpink", "lightblue", "lightgreen"), fitcol = c("red", "blue", "green")) } # QQ plot qqcompcens(list(fitsfn,fitsfl,fitsfg)) qqcompcens(list(fitsfn,fitsfl,fitsfg), ynoise = FALSE) par(mfrow = c(2,2)) qqcompcens(fitsfn) qqcompcens(fitsfl) qqcompcens(fitsfg) par(mfrow = c(1,1)) if (requireNamespace ("ggplot2", quietly = TRUE)) { qqcompcens(list(fitsfn,fitsfl,fitsfg), ynoise = FALSE, plotstyle = "ggplot") qqcompcens(list(fitsfn,fitsfl,fitsfg), ynoise = FALSE, plotstyle = "ggplot", fillrect = c("lightpink", "lightblue", "lightgreen"), fitcol = c("red", "blue", "green")) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.