[R] Baseline survival estimate
Marc Schwartz
marc_schwartz at me.com
Wed Dec 16 19:01:20 CET 2009
I might just extend Thomas' succinct reply with a pointer to ?
survfit.coxph in the 'survival' package, which will provide the
baseline survival estimates at the mean values of the covariates from
the Cox model. It also has nice summary and plot methods and allows
for estimating predicted survival for given covariate values.
Using the 'ovarian' dataset:
fit <- coxph(Surv(futime, fustat) ~ age, data = ovarian)
# Note the default 'centered = TRUE' for basehaz()
> exp(-basehaz(fit)$hazard)
[1] 0.9880206 0.9738738 0.9545899 0.9334790 0.8973620 0.8624781
[7] 0.8243117 0.7750981 0.7244924 0.6734146 0.5962187 0.5204807
> summary(survfit(fit))$surv
[1] 0.9880206 0.9738738 0.9545899 0.9334790 0.8973620 0.8624781
[7] 0.8243117 0.7750981 0.7244924 0.6734146 0.5962187 0.5204807
You can also use:
summary(survfit(fit))
plot(survfit(fit))
...
You might also be interested in John Fox' web appendix on Cox models:
http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf
HTH,
Marc Schwartz
On Dec 16, 2009, at 11:34 AM, tlumley at u.washington.edu wrote:
>
>
> survival = exp(-hazard)
>
> -thomas
>
> On Wed, 16 Dec 2009, Laura Bonnett wrote:
>
>> Dear R-help,
>>
>> I am trying to obtain the baseline survival estimate of a fitted
>> Cox model
>> (S_0 (t)). I know that previous posts have said use 'basehaz' but
>> this
>> gives the baseline hazard function and not the baseline survival
>> estimate.
>> Is there a way to obtain the baseline survival estimate or do I
>> have to use
>> the formula which does something like S(t) = exp[- the integral
>> from 0 to t
>> of h(u) du]?
>>
>> Thank you for your assistance,
>>
>> Laura
>>
>> fit1 <-
>> coxph(Surv(tsecond/
>> 365
>> ,seccens
>> )~
>> stroke
>> (smess1
>> )
>> +
>> othnd
>> (smess1
>> )
>> +
>> relat
>> (smess1)+asleep(smess1)+abeeg1(smess1)+treat(smess1),data=smess1)
>> basehaz(fit1)
>>
>> where stroke is a function which creates a binary variable from the
>> dataset
>> smess1 etc.
More information about the R-help
mailing list