isurvdiff {IDPSurvival} | R Documentation |
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(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
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 |
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
|
exact |
computes the posterior probability if value is TRUE,
or uses a normal approximation if value is FALSE.
If you omit this argument, |
level |
sets the significance level alpha = 1- |
display |
determines whether the posterior distributions of P(X<Y) have to be plotted (TRUE) or not (FALSE). |
nsamples |
if |
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 |
Lower.Cred.Int |
lower HPD credible interval.
Confidence level defined by |
Upper.Cred.Int |
upper HPD credible interval. Confidence level defined by |
alternative |
the direction of the test |
strata |
the number of subjects contained in each group. |
exact |
logical variable saying if the exact posterior distributions
have been computed ( |
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
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)