[R] Questions concerning survival analysis

Thomas Lumley tlumley at u.washington.edu
Tue Jul 30 17:27:08 CEST 2002


On Tue, 30 Jul 2002, Ruth Meili wrote:
> I have another question to the author(s) of summary.survreg:
> Why does summary(...,times=sort(x)) not give the same result as
> summary(...,censored=TRUE) ? Example:
>
> ###
> library(survival)
>
> x <-   c(1,1,2,4,4,4,6,9)
> status <- c(1,0,1,1,1,0,1,1)
>
> r.sf <- survfit(Surv(x, status)~1, type='kaplan-meier',conf.type="none")
>
> summary(r.sf,times=sort(x))
> summary(r.sf,censored=TRUE) # the censored data are not listed (?)
> ###

Well, the author of summary.survreg doesn't read r-help,  but in any case
censored=TRUE works as documented

    			If `censored=T', the default `times'
    vector contains all the unique times in `fit', otherwise the
    default `times' vector uses only the event (death) times.

> summary(r.sf,censored=TRUE) # the censored data are not listed (?)
Call: survfit(formula = Surv(x, status) ~ 1, type = "kaplan-meier",
    conf.type = "none")

 time n.risk n.event survival std.err
    1      8       1    0.875   0.117
    2      6       1    0.729   0.165
    4      5       2    0.438   0.188
    6      2       1    0.219   0.181
    9      1       1    0.000      NA


Every observed time point is listed, regardless of whether an event
occurred.  In this example an event occured at every time point so
specifying censored=TRUE has no effect

On the other hand
> summary(r.sf,times=sort(x))
Call: survfit(formula = Surv(x, status) ~ 1, type = "kaplan-meier",
    conf.type = "none")

 time n.risk n.event survival std.err
    1      8       1    0.875   0.117
    1      8       0    0.875   0.117
    2      6       1    0.729   0.165
    4      5       2    0.438   0.188
    4      5       0    0.438   0.188
    4      5       0    0.438   0.188
    6      2       1    0.219   0.181
    9      1       1    0.000      NA

does not give the right answer because there are repeated times. Note for
example the n.event column for time 4.  The help page says that the times
must be in increasing order.  In fact they must be strictly increasing --
repeats are not allowed.


	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list