Learn R Programming

NADA (version 1.6-1.1)

cendiff: Test Censored ECDF Differences

Description

Tests if there is a difference between two or more empirical cumulative distribution functions (ECDF) using the \(G^\rho\) family of tests, or for a single curve against a known alternative.

Usage

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

Value

Returns a list with the following components:

n

the number of subjects in each group.

obs

the weighted observed number of events in each group. If there are strata, this will be a matrix with one column per stratum.

exp

the weighted expected number of events in each group. If there are strata, this will be a matrix with one column per stratum.

chisq

the chisquare statistic for a test of equality.

var

the variance matrix of the test.

strata

optionally, the number of subjects contained in each stratum.

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.

This function shares the same arguments as survdiff. The most important of which is rho which controls the type of test. With rho = 0 this is the log-rank or Mantel-Haenszel test, and with rho = 1 it is equivalent to the Peto & Peto modification of the Gehan-Wilcoxon test. The default is rho = 1, or the Peto & Peto test. This is the most appropriate for left-censored log-normal data.

For the formula interface: if the right hand side of the formula consists only of an offset term, then a one sample test is done. To cause missing values in the predictors to be treated as a separate group, rather than being omitted, use the factor function with its exclude argument.

References

Helsel, Dennis R. (2005). Nondectects and Data Analysis; Statistics for censored environmental data. John Wiley and Sons, USA, NJ.

Harrington, D. P. and Fleming, T. R. (1982). A class of rank test procedures for censored survival data. Biometrika 69, 553-566.

See Also

Cen, survdiff

Examples

Run this code
# NOT RUN {
    data(Cadmium)

    obs      = Cadmium$Cd
    censored = Cadmium$CdCen
    groups   = Cadmium$Region

    # Cd differences between regions?
    cendiff(obs, censored, groups)
    
    # Same as above using formula interface
    cenfit(Cen(obs, censored)~groups) 
# }

Run the code above in your browser using DataLab