cfit | R Documentation |
Computes the empirical cumulative distribution function (ECDF) for censored data. Estimates parameters of the distribution, including the mean and quantiles.
cfit(
y,
cens,
conf = 0.95,
qtls = c(0.1, 0.25, 0.5, 0.75, 0.9),
plot.pos = 0.375,
q.type = 7,
Cdf = TRUE,
ecdf.col = 1,
km.orig = FALSE,
printstat = TRUE,
Ylab = NULL
)
y |
Concentrations plus detection limits for indicator formatted data. |
cens |
Censoring indicators (logical. 1 or |
conf |
The confidence coefficient for confidence intervals around the Kaplan-Meier mean and median. Default = 0.95. |
qtls |
Probabilities for the quantiles to be estimated. Defaults are (0.10, 0.25, 0.50, 0.75, 0.90). You may add and/or substitute probabilities – all must be between and not including 0 to 1. |
plot.pos |
numeric scalar between 0 and 1 containing the value of the plotting position constant. The default value is |
q.type |
an integer between 1 and 9 selecting one of the nine quantile algorithms detailed below to be used. See |
Cdf |
Logical |
ecdf.col |
Color for the ecdf plotted step function line. Default is black. |
km.orig |
If |
printstat |
Logical |
Ylab |
Optional input text in quotes to be used as the variable name on the ecdf plot. The default is the name of the |
Moment statistics are estimated using the enparCensored function of the EnvStats package. This avoids a small bias in the mean produced by the NADA package's cenfit function, which uses the reverse Kaplan-Meier procedure, converting left-censored to right-censored data prior to computing the ecdf and mean. See Gillespie et al. for more discussion on the bias of the estimate of the mean.
Quantiles and confidence limits on the median are estimated using the quantile function of the survfit command. See ?quantiles for choosing the q.type; default q.type = 7.
All printed values will also be output to an object if saved. Values are character because of the possibility of a <1
, but if no <
symbol can be converted to numeric using the as.numeric(...)
command. For data without censoring cfit will also return values. For data without censoring cfit will also return values. In that case it returns standard arithmetic mean, standard deviation and quantiles instead of K-M versions.
If printstat=TRUE
: Based on the provided conf
value, Kaplan-Meier summary statistics (mean
,sd
,median
), lower and upper confidence intervals around the mean and median value, sample size and percent of censored samples are returned. The specified quantile values are also printed and returned.
If Cdf=TRUE
: The ecdf of censored data is plotted.
Helsel, D.R., 2011. Statistics for Censored Environmental Data using Minitab and R, 2nd ed. John Wiley & Sons, USA, N.J.
Gillespie, B.W., et al., 2010. Estimating Population Distributions When Some Data Are Below a Limit of Detection by Using a Reverse Kaplan-Meier Estimator. Epidemiology 21, 564-570.
Millard, S.P, 2013. EnvStats: An R Package for Environmental Statistics, 2nd ed. Springer Science+Business Media, USA, N.Y. DOI 10.1007/978-1-4614-8456-1© Springer Science+Business Media New York 2013”
Excerpt From: Steven P. Millard. “EnvStats.” Apple Books.
survival::survfit
data(Brumbaugh)
cfit(Brumbaugh$Hg,Brumbaugh$HgCen)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.