[R] Fitting weibull and exponential distributions to left censoring data
goran.brostrom at gmail.com
Sun Nov 2 18:25:53 CET 2008
On Sun, Nov 2, 2008 at 3:57 PM, Therneau, Terry M., Ph.D.
<therneau at mayo.edu> wrote:
> Brostram wrote
>> The survreg function cannot fit left-censored data (correct me if I am wrong).
> in response to my suggestion to use that routine.
> You are wrong. Try reading the help file for survreg, or the references given there.
My apologies. However, AFAICS, there is no mentioning of this in the
relevant help pages. The only place I could find this described was in
the help page for 'Surv' (not refered to on the survfit page), section
Details, where I also found that survreg can fit interval censored
data! This is great news (to me), and I think you should describe the
capabilities of survreg in its own home page. It's too important
imformation to be hidden away.
That said, I tried to fit left censored data with survreg, but I
failed miserably. I tried
> Surv(time = c(1, 2), event = c(1, 2), type = "left")
Error in Surv(time = c(1, 2), event = c(1, 2), type = "left") :
element 1 is empty;
the part of the args list of 'length' being evaluated was:
and variants thereof. Given no clue on the help page, I read the
source code of Surv, and found that
> Surv(time = c(1, 2), time2 = c(1, 2), type = "left")
works! So, with left censored data, time2 is not a time, but a status indicator!
> The survreg function does not fit left-truncated data, however.
> (As the author of the survival routines, I have a fairly good idea of what they can do.)
> Terry Therneau
More information about the R-help