cenfit {NADA} | R Documentation |
Compute an ECDF for Censored Data
Description
Computes an estimate of an empirical cumulative distribution function (ECDF) for censored data using the Kaplan-Meier method.
Usage
cenfit(obs, censored, groups, ...)
Arguments
obs |
Either a numeric vector of observations or a formula. See examples below. |
censored |
A logical vector indicating TRUE where an observation in ‘obs’ is censored (a less-than value) and FALSE otherwise. |
groups |
A factor vector used for grouping ‘obs’ into subsets. |
... |
Additional items that are common to this function and the |
Details
This, and related routines, are front ends to routines in the
survival
package. Since the survival routines can not handle
left-censored data, these routines transparently handle “flipping" input
data and resultant calculations. Additionally provided are query and
prediction methods for cenfit
objects.
There are many additional options that are supported and documented
in survfit
. Only a few have application to the geosciences.
However, the most important is ‘conf.int’. This is the level for
a two-sided confidence interval on the ECDF. The default is 0.95.
If you are using the formula interface: The censored
and
groups
parameters are not specified – all information is provided
via a formula as the obs
parameter. The formula must have a
Cen
object as the response on the left of the ~
operator and,
if desired, terms separated by + operators on the right.
Value
a cenfit
object.
Methods defined for cenfit
objects are provided for
print
, plot
, lines
, predict
,
mean
, median
, sd
, quantile
.
If the input formula contained factoring groups
(ie., cenfit(obs, censored, groups)
, individual ECDFs can be
obtained by indexing (eg., model[1]
, etc.).
Author(s)
R. Lopaka Lee <rclee@usgs.gov>
Dennis Helsel <dhelsel@practicalstats.com>
References
Helsel, Dennis R. (2005). Nondectects and Data Analysis; Statistics for censored environmental data. John Wiley and Sons, USA, NJ.
Dorey, F. J. and Korn, E. L. (1987). Effective sample sizes for confidence intervals for survival probabilities. Statistics in Medicine 6, 679-87.
Fleming, T. H. and Harrington, D.P. (1984). Nonparametric estimation of the survival distribution in censored data. Comm. in Statistics 13, 2469-86.
Kalbfleisch, J. D. and Prentice, R. L. (1980). The Statistical Analysis of Failure Time Data. Wiley, New York.
Link, C. L. (1984). Confidence intervals for the survival function using Cox's proportional hazards model with covariates. Biometrics 40, 601-610.
See Also
survfit
,
Cen
,
plot-methods
,
mean-methods
,
sd-methods
,
median-methods
,
quantile-methods
,
predict-methods
,
lines-methods
,
summary-methods
,
cendiff
Examples
# Create a Kaplan-Meier ECDF, plot and summarize it.
data(Cadmium)
obs = Cadmium$Cd
censored = Cadmium$CdCen
mycenfit = cenfit(obs, censored)
plot(mycenfit)
summary(mycenfit)
quantile(mycenfit, conf.int=TRUE)
median(mycenfit)
mean(mycenfit)
sd(mycenfit)
predict(mycenfit, c(10, 20, 100), conf.int=TRUE)
# With groups
groups = Cadmium$Region
cenfit(obs, censored, groups)
# Formula interface -- no groups
cenfit(Cen(obs, censored))
# Formula interface -- with groups
cenfit(Cen(obs, censored)~groups)