cenfit                 package:NADA                 R Documentation

_C_o_m_p_u_t_e _a_n _E_C_D_F _f_o_r _C_e_n_s_o_r_e_d _D_a_t_a

_D_e_s_c_r_i_p_t_i_o_n:

     Computes an estimate of an empirical cumulative distribution
     function (ECDF) for censored data using the Kaplan-Meier method.

_U_s_a_g_e:

         cenfit(obs, censored, groups, ...)

_A_r_g_u_m_e_n_t_s:

     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
          'survfit' function from the `survival' package.  See Details. 

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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.).

_A_u_t_h_o_r(_s):

     Lopaka(Rob) Lee <rclee@usgs.gov>

     Dennis Helsel <dhelsel@usgs.gov>

_R_e_f_e_r_e_n_c_e_s:

     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.

_S_e_e _A_l_s_o:

     'survfit', 'Cen',  'plot-methods',  'mean-methods',  'sd-methods',
      'median-methods',  'quantile-methods',  'predict-methods', 
     'lines-methods',  'summary-methods',  'cendiff'

_E_x_a_m_p_l_e_s:

         # 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) 

