isurvdiff: Test Survival Curves Differences for two right censored data

Description Usage Arguments Value METHOD References See Also Examples

View source: R/isurvdiff.r

Description

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.

Usage

1
2
3
4
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)

Arguments

formula

a formula expression of the form Surv(time, status) ~ predictor. A single predictor is admitted.

data

an optional data frame in which to interpret the variables occurring in the formula.

groups

a vector of two element indicating which value of the predictor represents groups 1 and 2.

s

sets the value of the prior strength s of the Dirichlet Process.

alternative

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.

exact

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.

level

sets the significance level alpha = 1-level of the test.

display

determines whether the posterior distributions of P(X<Y) have to be plotted (TRUE) or not (FALSE).

nsamples

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.

rope

introduces a (symmetric) Region of Practical Equivalence (ROPE) around 1/2, i.e., [1/2-value,1/2+value].

tmax

whether to consider the difference in survival up to time tmax. NULL is the default and means without limit.

Value

a list with components:

h

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

prob

the probability of the alternatice hypotesis P(X<Y)>1/2 if alternative="greater" or P(Y<X)>1/2 if alternative="less".

Lower.Cred.Int

lower HPD credible interval. Confidence level defined by level.

Upper.Cred.Int

upper HPD credible interval. Confidence level defined by level.

alternative

the direction of the test "greater","less" or "two.sided".

strata

the number of subjects contained in each group.

exact

logical variable saying if the exact posterior distributions have been computed (TRUE) or the Gaussian approximation has been used (FALSE).

METHOD

This function implements the IDP sum-rank test describe in Mangili and others (2014).

References

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, http://adsabs.harvard.edu/abs/2014arXiv1402.2755B.

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.

See Also

Surv.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(lung,package='survival')
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)

IDPSurvival documentation built on May 1, 2019, 10:24 p.m.