Learn R Programming

IDPSurvival (version 1.1)

isurvdiff: Test Survival Curves Differences for two right censored data

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(Xlevel. 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

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
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:

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

Run this code
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)

Run the code above in your browser using DataLab