Tests if there is a difference between two survival curves based on two samples (X and Y)
with right censored data. More precisely it test whether the probabiliy P(X<Y) is greater
than, lower than or equal to 1/2.
The prior near-ignorance Dirichlet Process (IDP) rank sum test is used.
It returns the result of the deicison.
H=1 indicates that the alternative hypothesis is true with posterior
probability greater than level.
H=0 indicates the hypothesis is not true with posterior greater than level,
H=2 indicates an indeterminate instance. This means that the decision depends on
the choice of the prior.
isurvdiff(formula, data, groups=c(1,2), s=0.25,
alternative = c("two.sided", "less", "greater"),
exact=NULL, level = 0.95, display=TRUE,
nsamples=10000, rope=0, tmax=NULL)a list with components:
The decision of the test: H=0 -> accept the null hypothesis; H=1 -> rejects the null hypothesis; H=2 -> indeterminate (a robust decision cannot be made).
the probability of the alternatice hypotesis P(X<Y)>1/2
if alternative="greater" or
P(Y<X)>1/2 if alternative="less".
lower HPD credible interval.
Confidence level defined by level.
upper HPD credible interval. Confidence level defined by level.
the direction of the test "greater","less" or "two.sided".
the number of subjects contained in each group.
logical variable saying if the exact posterior distributions
have been computed (TRUE) or the Gaussian approximation
has been used (FALSE).
a formula expression of the form Surv(time, status) ~ predictor.
A single predictor is admitted.
an optional data frame in which to interpret the variables occurring in the formula.
a vector of two element indicating which value of the predictor represents groups 1 and 2.
sets the value of the prior strength s of the Dirichlet Process.
define the direction of the test:
"greater" --evaluates the hypothesis P(X < Y)>1/2, i.e., returns H=1
if the lower probability of the hypothesis is larger than
level, H=0 if the upper probability is smaller than
level and H=2 if the lower and upper probabilities
encompass level;
"less" -- evaluates the hypothesis P(Y < X)>1/2;
"two.sided" -- performs a two-sided Bayesian test, i.e., returns H=1 if
1/2 is not included between the left bound of the
lower and the right bound of the upper level
HPD credible intervals, H=0 if 1/2 is included in both
the upper and lower credible intervals, H=2 otherwise.
computes the posterior probability if value is TRUE,
or uses a normal approximation if value is FALSE.
If you omit this argument, isurvdiff uses the exact method
if at least one group has less than 100 samples
and the approximate one otherwise.
sets the significance level alpha = 1-level of the test.
determines whether the posterior distributions of P(X<Y) have to be plotted (TRUE) or not (FALSE).
if exact=TRUE, sets the number of samples used in the Monte Carlo
computation of the posterior distributions. For faster but less accurate
results, one can tune down this parameter. For more accurate, one might
increase it.
introduces a (symmetric) Region of Practical Equivalence (ROPE) around 1/2, i.e., [1/2-value,1/2+value].
whether to consider the difference in survival up to time tmax. NULL is the default and means without limit.
This function implements the IDP sum-rank test describe in Mangili and others (2014).
Benavoli, A., Mangili, F., Zaffalon, M. and Ruggeri, F. (2014). Imprecise Dirichlet process with application to the hypothesis test on the probability that X < Y. ArXiv e-prints, https://ui.adsabs.harvard.edu/abs/2014arXiv1402.2755B/abstract.
Mangili, F., Benavoli, A., Zaffalon, M. and de Campos, C. (2014). Imprecise Dirichlet Process for the estimate and comparison of survival functions with censored data.
Surv.
test <-isurvdiff(Surv(time,status)~sex,lung,groups=c(1,2),
alternative = 'two.sided',s=0.5, nsamples=1000)
print(test)
data(Aids2)
fdata <- Surv(time, status) ~ T.categ
dataset <- Aids2
groups=c("blood","haem")
dataset["time"]<-dataset[4]-dataset[3]
dataset[5]<-as.numeric(unlist(dataset[5]))
test <-isurvdiff(fdata,dataset,groups=groups,
alternative = 'greater',s=0.5, nsamples=1000)
print(test)
Run the code above in your browser using DataLab