View source: R/genWilcox.test.R
genWilcox.test | R Documentation |
This function tests for differences in censored samples from 2 groups. Two methods are available—the Peto-Prentice test is appropriate only for left-censored data. The Gehan test has been extended to multiply censored data as suggested in Gehan (1965) but uses a permutation test to compute the variance.
genWilcox.test(x, y, alternative = "two.sided", method = "best", data.names, gehan.seed = 0)
x |
the samples from each group. Forced to the appropriate class. Missing values are removed before the analysis. |
y |
either another set of samples or a group identifier with exactly two groups. Missing values are removed before the analysis. See Details. |
alternative |
character string describing the alternative hypothesis. Must be one of "two.sided, "greater," or "less." |
method |
a character string indicating which method to use for the analysis. See Details. |
data.names |
character string to be used to explain the data. Default names are derived from the data arguments. |
gehan.seed |
an integer value to set the seed to compute the variance of the Gehan statistic. If 0 (the default), then use equation 9.5 from Helsel (2012) to compute the variance. |
If y
is either type character or factor, then it is assumed to be a group
identifier. Anything else is treated as another set of sample and forced to the
appropriate class of censored data.
The argument method
must be one of "peto" or "gehan." It may also
be "best," which selects "peto" for uncensored or
left-censored data and "gehan" otherwise.
An object of class "htest" that inherits "genWilcox."
The null hypothesis is that the distributions are not different from one another.
The genWilcox.test
function uses the survfit
function. Helsel (2012) describes flipping
the left-censored data so that small values become large and left-censored
values become right-censored values and adapt nonparametric techniques from
survival analysis. The results from survfit
are printed as the sample
estimates when printing the output, the important columns are records,
the number in each group; events, the number of uncensored values; and
median, the group median.
A plot
method is supported for the returned object.
Gehan, E.A., 1965, A generalized Wilcoxon test for comparing
arbitraritly singly censored samples: Biometrika, v. 52, p. 203-223.
Harrington, D.P., and Fleming, T.R., 1982, A class of rank test procedures
for censored survival data: Biometrika, v. 69, p. 553-566.
Helsel, D.R. 2012, Statistics for Censored Environmental Data Using Minitab
and R: New York, Wiley, 324 p.
Peto, R., and Peto, J., 1972, Asymptotically efficient rank invariant test
procedures (with discussion): Journal of the Royal Statistical Society,
Series A v. 135, p. 185-206.
Prentice, R.L. 1978, Linear rank tests with right-censored data: Biometika, v
65, p 167-179.
Prentice, R.L., and Marke, P., 1979, A qualitative discrepancy between
censored data rank tests: Biometrika, v. 35, p. 861-867.
survdiff
, survfit
,
lcens-class
# Compare uncensored results # First for grouped data set.seed(69) Xu <- rlnorm(22, 0, 1) Yu <- rlnorm(22, .6, 1) genWilcox.test(Xu, Yu) wilcox.test(Xu, Yu) # Compare effect of censoring genWilcox.test(as.lcens(Xu, 1), Yu) genWilcox.test(as.lcens(Xu, 1), as.lcens(Yu, 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.