Running examples in ‘boot-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: censboot
> ### Title: Bootstrap for Censored Data
> ### Aliases: censboot cens.return
> ### Keywords: survival
> 
> ### ** Examples
> 
> library(survival)

Attaching package: ‘survival’

The following object is masked from ‘package:boot’:

    aml

> # Example 3.9 of Davison and Hinkley (1997) does a bootstrap on some
> # remission times for patients with a type of leukaemia.  The patients
> # were divided into those who received maintenance chemotherapy and 
> # those who did not.  Here we are interested in the median remission 
> # time for the two groups.
> data(aml, package = "boot") # not the version in survival.
> aml.fun <- function(data) {
+      surv <- survfit(Surv(time, cens) ~ group, data = data)
+      out <- NULL
+      st <- 1
+      for (s in 1:length(surv$strata)) {
+           inds <- st:(st + surv$strata[s]-1)
+           md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]])
+           st <- st + surv$strata[s]
+           out <- c(out, md)
+      }
+      out
+ }
> aml.case <- censboot(aml, aml.fun, R = 499, strata = aml$group)
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
> 
> # Now we will look at the same statistic using the conditional 
> # bootstrap and the weird bootstrap.  For the conditional bootstrap 
> # the survival distribution is stratified but the censoring 
> # distribution is not. 
> 
> aml.s1 <- survfit(Surv(time, cens) ~ group, data = aml)
> aml.s2 <- survfit(Surv(time-0.001*cens, 1-cens) ~ 1, data = aml)
> aml.cond <- censboot(aml, aml.fun, R = 499, strata = aml$group,
+      F.surv = aml.s1, G.surv = aml.s2, sim = "cond")
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
> 
> 
> # For the weird bootstrap we must redefine our function slightly since
> # the data will not contain the group number.
> aml.fun1 <- function(data, str) {
+      surv <- survfit(Surv(data[, 1], data[, 2]) ~ str)
+      out <- NULL
+      st <- 1
+      for (s in 1:length(surv$strata)) {
+           inds <- st:(st + surv$strata[s] - 1)
+           md <- min(surv$time[inds[1-surv$surv[inds] >= 0.5]])
+           st <- st + surv$strata[s]
+           out <- c(out, md)
+      }
+      out
+ }
> aml.wei <- censboot(cbind(aml$time, aml$cens), aml.fun1, R = 499,
+      strata = aml$group,  F.surv = aml.s1, sim = "weird")
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
Warning in min(surv$time[inds[1 - surv$surv[inds] >= 0.5]]) :
  no non-missing arguments to min; returning Inf
> 
> # Now for an example where a cox regression model has been fitted
> # the data we will look at the melanoma data of Example 7.6 from 
> # Davison and Hinkley (1997).  The fitted model assumes that there
> # is a different survival distribution for the ulcerated and 
> # non-ulcerated groups but that the thickness of the tumour has a
> # common effect.  We will also assume that the censoring distribution
> # is different in different age groups.  The statistic of interest
> # is the linear predictor.  This is returned as the values at a
> # number of equally spaced points in the range of interest.
> data(melanoma, package = "boot")
> library(splines)# for ns
> mel.cox <- coxph(Surv(time, status == 1) ~ ns(thickness, df=4) + strata(ulcer),
+                  data = melanoma)
> mel.surv <- survfit(mel.cox)
> agec <- cut(melanoma$age, c(0, 39, 49, 59, 69, 100))
> mel.cens <- survfit(Surv(time - 0.001*(status == 1), status != 1) ~
+                     strata(agec), data = melanoma)
> mel.fun <- function(d) { 
+      t1 <- ns(d$thickness, df=4)
+      cox <- coxph(Surv(d$time, d$status == 1) ~ t1+strata(d$ulcer))
+      ind <- !duplicated(d$thickness)
+      u <- d$thickness[!ind]
+      eta <- cox$linear.predictors[!ind]
+      sp <- smooth.spline(u, eta, df=20)
+      th <- seq(from = 0.25, to = 10, by = 0.25)
+      predict(sp, th)$y
+ }
> mel.str <- cbind(melanoma$ulcer, agec)
> 
> # this is slow!
> mel.mod <- censboot(melanoma, mel.fun, R = 499, F.surv = mel.surv,
+      G.surv = mel.cens, cox = mel.cox, strata = mel.str, sim = "model")
Error in call[[1L]] : object of type 'symbol' is not subsettable
Calls: censboot ... model.frame.default -> makepredictcall -> makepredictcall.ns -> eval
Execution halted