Hi, in Design package, a plot of survival probability vs. a covariate can be 
generated by survplot() on a cph object using the folliowing code:

n <- 1000
set.seed(731)
age <- 50 + 12*rnorm(n)
label(age) <- "Age"
sex <- factor(sample(c('male','female'), n, TRUE))
cens <- 15*runif(n)
h <- .02*exp(.04*(age-50)+.8*(sex=='Female'))
dt <- -log(runif(n))/h
label(dt) <- 'Follow-up Time'
e <- ifelse(dt <= cens,1,0)
dt <- pmin(dt, cens)
units(dt) <- "Year"
dd <- datadist(age, sex)
options(datadist='dd')
S <- Surv(dt,e)


library(Design)

f <- cph(S ~ age, surv=TRUE,x=T,y=T)
plot(f,age=NA,time=5)

But the same code won't work if I used rms package:

detach(package:Design)
library(rms)

f <- cph(S ~ age, surv=TRUE,x=T,y=T)

plot(f,age=NA,time=5)
Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' and 'y' lengths differ


Is there a way to plot the same graph using rms package. I like to use Frank 
Harrell's new package rms and try to avoid using old Design package.

Thanks

John

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

Reply via email to