Learn R Programming

IDPSurvival (version 1.1)

isurvfit: Create survival curves based on the IDP model

Description

This function creates survival curves from right censored data using the prior near-ignorance Dirichlet Process (IDP).

Usage

isurvfit(formula, data, s=0.5, weights, subset, display=TRUE, conf.type=c('exact', 'approx', 'none'), nsamples=10000, conf.int= .95)

Arguments

formula
a formula object, which must have a Surv object as the response on the left of the ~ operator and, if desired, terms separated by + operators on the right. For a single survival curve the right hand side should be ~ 1.
data
a data frame in which to interpret the variables named in the formula, subset and weights arguments.
s
sets the value of the prior strength s of the Dirichlet Process.
weights
the weights must be finite and nonnegative; it is strongly recommended that they be strictly positive, since zero weights are ambiguous, compared to use of the subset argument.
subset
expression saying that only a subset of the rows of the data should be used in the fit.
display
determines whether the survival curves have to be plotted (TRUE) or not (FALSE).
conf.type
a variable saying how the credible interval shold be computed: 'exact': Monte-Carlo smapling from the exact distribution, 'approx': Gaussian approximation, 'none': no credible interval is computed.
nsamples
number pf samples used to approximate the credible intervals if conf.type='exact'.
conf.int
confidence level of the credible interval.

Value

an object of class "isurvfit".See isurvfit.object for details. Methods defined for survfit objects are print and plot.

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.

Details

The estimates are obtained using the IDP estimator by Mangili and others (2014) based on the prior near-ignorance Dirichlet Process model by Benavoli and others (2014).

See Also

isurvfit.object, plot.isurvfit, Surv.

Examples

Run this code
data(aml)
fit <- isurvfit(Surv(time, cens) ~ 1, data=aml, display=TRUE, nsamples=1000) 
legend('topright', c("Lower expectation", 
          "Upper expectation","confidence intervals"), lty=c(1,1,2),lwd=c(1,2,1)) 
title("IDP survival curve (s=0.5) \nAcute Myelogenous Leukemia dataset")

data(Aids2)
dataset <- Aids2
dataset["time"]<-dataset[4]-dataset[3]
dataset[5]<-as.numeric(unlist(dataset[5]))
fit <- isurvfit(Surv(time, status) ~ T.categ, dataset,s=1,
	            subset=(!is.na(match(T.categ, c('blood','haem','het')))),
                nsamples=1000,conf.type='none')
legend('topright',c("Heterosexual contact","Hemophilia","Blood"),
            title="Transmission category:",lty=c(1,1,1),col=c(1,2,3),pch=c(1,2,3))
title("IDP survival curve (s=1) \nAids dataset")
print(fit)

leukemia.surv <- isurvfit(Surv(time, cens) ~ group, data = aml, display=FALSE) 
plot(leukemia.surv) 
legend(100, .9, c("Maintenance", "No Maintenance"), lty=c(1,1),lwd=c(2,1),
       col=c('black','red'),pch=c(1,2)) 
title("IDP Curves\nfor AML Maintenance Study") 

Run the code above in your browser using DataLab