File: bootkm.Rd

package info (click to toggle)
hmisc 3.14-5-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,792 kB
  • ctags: 701
  • sloc: asm: 23,440; fortran: 600; ansic: 375; xml: 160; makefile: 1
file content (80 lines) | stat: -rw-r--r-- 2,328 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
\name{bootkm}
\alias{bootkm}
\title{
  Bootstrap Kaplan-Meier Estimates
}
\description{
  Bootstraps Kaplan-Meier estimate of the probability of survival to at
  least a fixed time (\code{times} variable) or the estimate of the \code{q}
  quantile of the survival distribution (e.g., median survival time, the
  default).
}
\usage{
bootkm(S, q=0.5, B=500, times, pr=TRUE)
}
\arguments{
  \item{S}{
    a \code{Surv} object for possibly right-censored survival time
  }
  \item{q}{
    quantile of survival time, default is 0.5 for median
  }
  \item{B}{
    number of bootstrap repetitions (default=500)
  }
  \item{times}{
    time vector (currently only a scalar is allowed) at which to compute
    survival estimates.  You may specify only one of \code{q} and
    \code{times}, and if \code{times} is specified \code{q} is ignored. 
  }
  \item{pr}{
    set to \code{FALSE} to suppress printing the iteration number every
    10 iterations
  }
}
\value{
  a vector containing \code{B} bootstrap estimates
}
\section{Side Effects}{
  updates \code{.Random.seed}, and, if \code{pr=TRUE}, prints progress
  of simulations
}
\details{
  \code{bootkm} uses Therneau's \code{survfitKM} function to efficiently
  compute Kaplan-Meier estimates.
}
\author{
  Frank Harrell
  \cr
  Department of Biostatistics
  \cr
  Vanderbilt University School of Medicine
  \cr
  \email{f.harrell@vanderbilt.edu}
}
\references{
  Akritas MG (1986): Bootstrapping the Kaplan-Meier estimator.  JASA
  81:1032--1038.
}
\seealso{
  \code{\link[survival]{survfit}}, \code{\link[survival]{Surv}},
  \code{\link[rms]{Survival.cph}}, \code{\link[rms]{Quantile.cph}}
}
\examples{
# Compute 0.95 nonparametric confidence interval for the difference in
# median survival time between females and males (two-sample problem)
set.seed(1)
library(survival)
S <- Surv(runif(200))      # no censoring
sex <- c(rep('female',100),rep('male',100))
med.female <- bootkm(S[sex=='female',], B=100) # normally B=500
med.male   <- bootkm(S[sex=='male',],   B=100)
describe(med.female-med.male)
quantile(med.female-med.male, c(.025,.975), na.rm=TRUE)
# na.rm needed because some bootstrap estimates of median survival
# time may be missing when a bootstrap sample did not include the
# longer survival times
}
\keyword{survival}
\keyword{nonparametric}
\concept{bootstrap}