Hi,

I'm trying to print the p-values from the output of a CPH test onto a Kaplan Meier plot. Can this be done? I only really want the p-values from the CPH test to appear but if this can't be done I am willing to have the entire CPH output.

This is what I am currently trying: (it doesn't print the CPH output)

plot_KM <- function(field)
{
library(survival)
y = length(levels(factor(field)))
field.KM <- survfit(Surv(age_at_death,death)~field)
field.CPH <- coxph(Surv(age_at_death,death)~factor(field))
plot(field.KM,mark.time=FALSE,col=2: (y+1),lty=1,main=paste(as.character(substitute(field))," Kaplan-Meier Plot"))
text(1000, .3, paste(as.character(field.CPH)), col="red")
legend(1000, .5, levels(factor(field)), col=2:(y+1), lty=1)
}



Thanks, Neil

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to