Learn R Programming

OIsurv (version 0.2)

confBands: Confidence bands for a survival curve

Description

A function for constructing confidence bands for a survival curve. This is in contrast to pointwise confidence intervals for the survival curve.

Usage

confBands(x, confType = c("plain", "log-log", "asin-sqrt"), confLevel = c(0.9, 0.95, 0.99), type = c("ep", "hall"), tL, tU)

Arguments

x
An object of class "Surv".
confType
The type of confidence ban. There are three options: "plain", "log-log", and "asin-sqrt". Entering only the first letter of the option (e.g. "p" for code"plain") is sufficient.
confLevel
Confidence level. Only numerical values of 0.9, 0.95, or 0.99 are accepted.
type
The type of method used to construct the confidence band. Available options are EP ("ep") and Hall-Wellner ("hall") confidence bands. Entering only the first letter of the option is sufficient.
tL
A minimum time to be considered. The default is the first observed or censored time.
tU
A maximum time to be considered. The default it the last observed time.

Value

Returns an object of class "confBands", which is a list of three items:
time
A vector of times.
lower
A vector of the lower band values corresponding to the times.
upper
A vector of the upper band values corresponding to the times.

Details

See References.

References

Klein JP, Moeschberger ML (2003). Survival Analysis: Techniques for Censored and Truncated Data. Springer Verlag, New York.

See Also

relapse

Examples

Run this code
#=====> 5. Kaplan-Meier confidence bands <=====#
data(bmt)
attach(bmt)
mySurv <- Surv(t2[group==1], d3[group==1])
#pdf("confBand.pdf", 7, 4.5)
#par(mar=c(3.9, 3.9, 2.5, 1), mgp=c(2.6, 0.7, 0))
plot(survfit(mySurv ~ 1), xlim=c(100, 600), xlab='time',
     ylab='Estimated Survival Function',
     main='Reproducing Confidence Bands, bone marrow transplant')
myCB <- confBands(mySurv)
lines(myCB, lty=3)
legend(100, 0.3, legend=c('K-M survival estimate',
     'pointwise intervals','EP confidence bands'), lty=1:3)
#dev.off()
detach(bmt)

Run the code above in your browser using DataLab