[R] : newbie estimating survival curve w/ survfit for coxph

Charles C. Berry cberry at tajo.ucsd.edu
Thu Dec 21 23:24:03 CET 2006


Spencer,

It always helps to look at the documentation for the objects you use.

 	?survfit.object

tells you:

-----------

COMPONENTS

 	strata

 	   if there are multiple curves, this component gives the number
            of elements of the time etc. vectors corresponding to the first
            curve, the second curve, and so on. The names of the elements
            are labels for the curves.


-----------

Note:

> z$strata
rx=1 rx=2
    7    3
>


If it is still not obvious what gives, look at

 	plot(z)

then at z$time, z$strata, and z$surv.


On Thu, 21 Dec 2006, sj wrote:

> I am wondering how to estimate the survival curve for a particular case(s)
> given a coxph model
>
> using this example code:
>
> #fit a cox proportional hazards model and plot the
>     #predicted survival curve
>     fit <- coxph(
> Surv(futime,fustat)~resid.ds+strata(rx)+ecog.ps+age,data=ovarian[1:23,])
>     z <- survfit(fit,newdata=ovarian[24:26,],individual=F)
>     zs <- z$surv
>     zt <- z$time
>
> I get the following output:
>
>              24              25           26
> [1,] 0.9740399 0.91737529 0.9873785
> [2,] 0.9431988 0.82552974 0.9721557
> [3,] 0.9023088 0.71387936 0.9515702
> [4,] 0.8518865 0.59121499 0.9255099
> [5,] 0.7269607 0.35151309 0.8572808
> [6,] 0.6130966 0.20108501 0.7895814
> [7,] 0.2807720 0.01553603 0.5415119
> [8,] 0.9159643 0.74991615 0.9584975
> [9,] 0.8225510 0.52704511 0.9099799
> [10,] 0.7058027 0.31906859 0.8451399
>
> [1]  59 115 156 268 329 431 638 464 475 563
>
> I am not sure what I am getting here, I was expecting to get three survival
> curves for each scenario in the "newdata" however the survival curves don't
> seem to be monotonically decreasing with time. I get the feeling that this
> has something to do with the use of strata(rx) in the model, but I am no
> sure how to sort it out.
>
> any help is appreciated,
>
> best regards,
>
> Spencer
>

[ irrelevant prior msg deleted ]



Charles C. Berry                        (858) 534-2098
                                          Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://biostat.ucsd.edu/~cberry/         La Jolla, San Diego 92093-0717



More information about the R-help mailing list