If you really want to get control of the colours then pick up the relevant returned values and pass them individually to lines().
foo[[2]] will hold time axis, foo[[8]] and [[9]]the upper and lower ci.
I actually feed the ci values into polygon() and am then able to produce shaded confidence intervals.
eg
fit.r <- survfit(Surv(fuperiod, censor), data=s.data, type= "kaplan-meier", conf.type="plain", conf.lower="peto")
x <- c(0,fit.r[[2]]) #add at time 0
y <- c(1,fit.r[[5]])
plot(x,y, col="blue",type="n",xlab="Time (years)",ylab="Proportion surviving")
xp <- c(x,rev(x))
yp <- c(1,fit.r[[8]],rev(fit.r[[9]]),1)
polygon(xp,yp,density=NULL,col="pink", border= "pink", lwd=0.5)
lines(x,y, col="blue",type="l",lwd=3)
Paul
On Wednesday, March 26, 2003, at 12:13 pm, Ko-Kang Kevin Wang wrote:
Hi,
If I have:
foo <- survfit(y ~ x)
where y is a survival object and x is a n-level factor. The documentation
says when I plot(foo), the confidence intervals will not be plotted (which
I guess is understandable as otherwise the plot will get really messy).
I tried to plot with confidence intervals by using:
plot(foo, conf.int = TRUE)
and indeed the resulting plot is messy. However I'm just wondering if I
can (suppose x is a 2-level factor) use different colours and line types
for the confidence lines? If I do:
plot(foo, conf.int = TRUE, col = 1:2)
then I'll get two different colours. What I would like is to then plot
the confidence lines using lty = 2 (while keeping the colour).
Can I do this?
-- Cheers,
Kevin
----------------------------------------------------------------------- -------
/* Time is the greatest teacher, unfortunately it kills its students */
-- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki)
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Prof. P. B. Pynsent, Research and Teaching Centre, Royal Orthopaedic Hospital, Birmingham, B31 2AP, U.K.
______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
