# Re: [R] Calculating survival for set time intervals

From: Thomas Lumley <tlumley_at_u.washington.edu>
Date: Tue 13 Jun 2006 - 01:13:49 EST

On Sat, 10 Jun 2006, Gregory Pierce wrote:

> Hello friends and fellow R users,
>
> I have successfully tabulated and entered my survival data into R and
> have generated survival curves. But I would like to be able to determine
> what the survival rates are now at one month, three months, six months
> and one year.
>
> I have a data set, via.wall, which I have entered into R, and which
> generates the following Surv object:
>
> Surv(Days,Status==1)
>  648+ 3 109 241 99 7 849+ 105 3+ 539+ 121 42 490
> 21 870+
>  175 20 434 289 826+ 831+ 664 698+ 5 24 655+ 18 7+
> 85+ 65+
>  547+ 8 1 55+ 69 499+ 448+ 0 158+ 31 246+ 230+ 19
> 118+ 54
>  48+ 45+ 21+ 670+ 585 558+ 544+ 494 481+ 474+ 472+ 461 447
> 446+ 443+
>  429+ 423+ 401 395+ 390 390+ 389+ 383+ 383+ 373+ 362+ 354 344+
> 342 336+
>  335+ 326+ 306 300+ 292 284+ 280+ 271 246+ 237+ 234 233+ 233
> 230+ 230+
>  226+ 225+ 218+ 215 211+ 199+ 191+ 191 190+ 184+ 169+ 163+ 161+
> 153 150
>  129+ 110+ 107+ 100+ 84+ 77+ 69+ 52+ 38+ 11+
>> names(wall.via)
>  "Description" "Patient" "Physician" "MRN" "Age"
>  "Status" "Days" "Cr" "INR" "BR"
>  "MELD" "type"
>
> I can guess pretty accurately by looking at the graph what the survival
> rates are at each interval, but I would like to understand how to
> instruct R to calculate it. Hope I have made this clear. I am just a
> beginner, so forgive me if this is trivial. It just isn't clear to me.

You will have generated survival curves with survfit(). Give them to summary() and specify the times you want. For example, using one of the built-in data sets:

> fit <- survfit(Surv(time, status) ~ x, data = aml)
> summary(fit,times=c(10,20,30,40))
Call: survfit(formula = Surv(time, status) ~ x, data = aml)

```                 x=Maintained
time n.risk n.event survival std.err lower 95% CI upper 95% CI
10     10       1    0.909  0.0867        0.754        1.000
20      7       2    0.716  0.1397        0.488        1.000
30      5       1    0.614  0.1526        0.377        0.999
40      3       2    0.368  0.1627        0.155        0.875

x=Nonmaintained
time n.risk n.event survival std.err lower 95% CI upper 95% CI
10      8       4    0.667   0.136       0.4468        0.995
20      6       1    0.583   0.142       0.3616        0.941
30      4       3    0.292   0.139       0.1148        0.741
40      2       1    0.194   0.122       0.0569        0.664

-thomas

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley@u.washington.edu	University of Washington, Seattle

______________________________________________
```
R-help@stat.math.ethz.ch mailing list