[R] Censboot Warning and Error Messages
Jingky Lozano
jlozano at apoy.upm.edu.ph
Mon Jun 7 12:06:02 CEST 2004
Good day R help list!!!
I've been trying to do Bootstrap in R on Censored data. I encountered
WARNING/ERROR messages which I could not find explanation.
I've been searching on the literature for two days now and still can't find
answers. I hope there's anyone out there who can help me
with these two questions:
1. If the "Loglik converged before variable..." message appears (please see
printout below) while doing ordinary bootstrap,
does it mean that I cannot trust the result of the bootstrap statistics? Is
there a valid way to resolve it like increase the sample size?
2. In doing conditional bootstrap with survival data, how can one handle a data
with two largest survival time observations (ties)
but one is censored while the other is not. For example, if the censoring time
is 48 months and a patient died exactly at that time, he will
have the same survival time as another patient who was also observed to lived 48
months long but classified as censored because he was still
alive at the set censoring time. Doing the recommended algorithm in R gives an
"error in sample length..." message.
I have pasted the actual outputs below for your reference. Thanks in advanced.
regards,
Jei
**********************************
#1
> library(survival)
> library(boot)
> filename <- type2a # this file has 100 records
>
> r <- 50
>
> data.cox <- coxph(Surv(time,cens==1)~x1+x2+x3a+x3b+x3c, data=filename)
> data.surv <- survfit(data.cox)
> data.cens <- survfit(Surv(time-0.001*(cens==1),cens!=1),data=filename)
>
> beta.fun <- function(filename) {
+ cox <- coef(coxph(Surv(filename$time,filename$cens==1) ~
filename$x1+filename$x2+filename$x3a+filename$x3b+filename$x3c))
+ }
>
>
> ## Calculate cox's regression coefficients' standard error and bias using the
Ordinary Bootstrap
>
> set.seed(1234)#set the random start
> cox.ord <-censboot(data=filename,statistic=beta.fun,R=r,F.surv=data.surv,
G.surv=data.cens,cox=data.cox,sim="ordinary")
Warning messages:
1: Loglik converged before variable 3,4,5 ; beta may be infinite. in:
fitter(X, Y, strats, offset, init, control, weights = weights,
2: Loglik converged before variable 3,4,5 ; beta may be infinite. in:
fitter(X, Y, strats, offset, init, control, weights = weights,
3: Loglik converged before variable 3,4,5 ; beta may be infinite. in:
fitter(X, Y, strats, offset, init, control, weights = weights,
4: Loglik converged before variable 3,4,5 ; beta may be infinite. in:
fitter(X, Y, strats, offset, init, control, weights = weights,
>
> cox.ord
CASE RESAMPLING BOOTSTRAP FOR CENSORED DATA
Call:
censboot(data = filename, statistic = beta.fun, R = r, F.surv = data.surv,
G.surv = data.cens, sim = "ordinary", cox = data.cox)
Bootstrap Statistics :
original bias std. error
t1* 0.01967371 -0.0007196731 0.01281441
t2* -0.93237995 -0.0126333032 0.41266809
t3* 0.70063667 1.2257364224 4.74488522
t4* 0.96192181 1.3134875081 4.77301974
t5* 2.90407255 1.4075296648 4.68596872
>
*********************************
#2
> sample
time cens group
1 9 1 1
2 13 1 1
3 13 0 1
4 18 1 1
5 23 1 1
6 28 0 1
7 31 1 1
8 34 1 1
9 45 0 1
10 48 1 1
11 48 0 1
12 5 1 2
13 5 1 2
14 8 1 2
15 8 1 2
16 12 1 2
17 16 0 2
18 23 1 2
19 27 1 2
20 30 1 2
21 33 1 2
22 43 1 2
23 45 1 2
> filename <- sample
>
> r <- 50
>
> ## Calculate median survival time; standard error and bias using the Ordinary
Bootstrap
>
> data.fun <- function(data) {
+ surv <- survfit(Surv(data$time, data$cens))
+ md <- min(surv$time[surv$surv<0.5])
+ }
> set.seed(1234)#set the random start
> msurv.ord <- censboot(data=filename, statistic=data.fun,R=r)
> msurv.ord#median survival time using ordinary bootstrap
CASE RESAMPLING BOOTSTRAP FOR CENSORED DATA
Call:
censboot(data = filename, statistic = data.fun, R = r)
Bootstrap Statistics :
original bias std. error
t1* 27 0.52 5.466932
>
>
> ## Calculate median survival time; standard error and bias using the
Conditional Bootstrap
>
> data.fun <- function(data) {
+ surv <- survfit(Surv(data$time, data$cens))
+ md <- min(surv$time[surv$surv<0.5])
+ }
> data.fail <- survfit(Surv(time, cens), data=filename)
> data.cens <- survfit(Surv(time-0.001*cens,1-cens), data=filename)
> set.seed(1234)#set the random start
> msurv.cond <-censboot(data=filename,statistic=data.fun,R=r,
F.surv=data.fail,G.surv=data.cens,sim="cond")
Error in sample(length(x), size, replace, prob) :
invalid first argument
> msurv.cond
----------------------------------------------------------------
University of the Philippines Manila (http://mail.upm.edu.ph)
More information about the R-help
mailing list