Thank you very much, Frank. I installed Design package and tried survplot().


#R code
 survplot(testfit,time.inc=365.25,xaxt='n',xlim=c(0,1826.25),ylim=c(0,1),conf='none',
          fun=function(y)1-y,label.curves=list(keys=c('Med','Rev')),
          abbrev.label=TRUE,n.risk=TRUE)
# End of R code

I have achieved my goal with the 'fun' argument you advised. But I have a
difficult time to do the following fine tune.

1. The X axis scale was labeled as 'Days'. I would like something like
'xscale=365.25' in plot.survfit to put time into Years and label the ticks
from 0 to 5, instead of from 0 to 1826.25 by each 365.25 increment. I tried
xaxt='n' as you can see in the code above. Then I noticed that xaxt='n' only
work for plot(survfit), not in survplot(). Any advice how to change the tick
label using survplot()?

2. The n.risk was beautifully printed for each specified time point along
the x axis. However, since I am plotting the failure rate, the n.risk looks
busy with the failure rate curves. Is there a way to move the n.risk to the
top of the plot where there are lots of space?

3. I also tried label.curves=list(). It is very convenient. The curves are
labeled and the legend is created as well. Could I only keep the curve label
and get rid of the legend since the legend is not so necessary once the
curve is labeled. How do you think?

I really appreciate any help you give.

Best regards,

Jiang Lu

Statistician
Department of Epidemiology
University of Pittsburgh



On Thu, Nov 6, 2008 at 1:21 PM, Frank E Harrell Jr <f.harrell@vanderbilt.edu
> wrote:

>  Lu, Jiang wrote:
>
>> Dear R helper,
>>
>> I encountered a problem when I tried to plot the cumulative failure rate
>> (i.e. 1 - survival probability). I have used the following code to plot.
>> The
>> scenario is that patients are randomized to different treatment arm (rev
>> in
>> the code), the PCI revascularization was monitored over 5 years.
>>
>> #R code
>>  testfit <- survfit(Surv(pcifu,pci)~rev,data=subproc)
>>  testfit$surv <- 1 - testfit$surv
>>  testfail <- plot(testfit, mark.time=FALSE,col=1:2, main='Failure Rate')
>> #End of R code
>>
>> I arbitarily replaced testfit$surv by computing 1 minus the original
>> survival rate. So far so good. However, when I plot the manipulated
>> "testfit", there is a vertical line plotted at x=0, y=0:1. I checked
>> testfit$time and testfit$surv, nothing weird there. I am very confused
>> where
>> the vertical line at starting point of time 0 came from. How can I get rid
>> of it?
>>
>> Would you pleae help me with this? Thanks a lot!
>>
>> Jiang
>>
>>
> Also see the survplot.* functions in the Design package and their fun
> argument, e.g., fun=function(y)1-y
>
> Frank
>
>        [[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<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>
> --
> Frank E Harrell Jr   Professor and Chair           School of Medicine
>                     Department of Biostatistics   Vanderbilt University
>

	[[alternative HTML version deleted]]

