[R] question about val.surv in R

From: zhu yao <mailzhuyao_at_gmail.com>
Date: Sun, 08 May 2011 17:31:10 +0800


Dear R users:

I tried to use val.surv to give an internal validation of survival prediction model.

I used the sample sources.

# Generate failure times from an exponential distribution set.seed(123) # so can reproduce results n <- 1000
age <- 50 + 12*rnorm(n)
sex <- factor(sample(c('Male','Female'), n, rep=TRUE, prob=c(.6, .4))) cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='Female')) t <- -log(runif(n))/h
units(t) <- 'Year'
label(t) <- 'Time to Event'
ev <- ifelse(t <= cens, 1, 0)
t <- pmin(t, cens)
S <- Surv(t, ev)

# I use cph instead of psm in the example f <- cph(S ~ age + sex, y=TRUE)
w <- val.surv(f)

I got an error:
Error in survreg.distributions[[fit$dist]] :   attempt to select less than one element

Could some one explain for me?

Error in survreg.distributions[[fit$dist]] :   attempt to select less than one element

Error in survreg.distributions[[fit$dist]] :   attempt to select less than one element

*Yao Zhu*
*Department of Urology
Fudan University Shanghai Cancer Center
Shanghai, China*

        [[alternative HTML version deleted]]



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 08 May 2011 - 09:35:42 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 08 May 2011 - 14:40:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive