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@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.