Mohammad Ehsanul Karim
2007-Nov-29 01:11 UTC
[R] Survreg(), Surv() and interval-censored data
Can anybody give me a neat example of interval censored data analysis codes in R? Given that suvreg(Surv(c(1,1,NA,3),c(2,NA,2,3),type="interval2")~1) works why does survreg(Surv(data[,1],data[,2],type="interval2")~1) not work where data is : T.1 T.2 Status 1 0.0000000 0.62873036 1 2 0.0000000 2.07039068 1 3 0.0000000 1.40297214 1 4 0.0000000 0.09112871 1 5 0.0000000 0.75115280 1 6 0.0000000 2.36476839 1 7 0.0000000 2.47483937 1 8 0.0000000 1.16913097 1 9 0.0000000 0.21498251 1 10 0.0000000 1.89557501 1 11 0.9286723 1.09883334 1 12 0.3428920 1.16436088 1 13 0.5924055 2.20572832 1 14 0.7985962 1.73894982 1 15 1.7493239 999.00000000 0 16 0.8653470 999.00000000 0 17 0.6917203 999.00000000 0 18 1.1452119 999.00000000 0 19 2.2587688 999.00000000 0 20 0.7854710 999.00000000 0 21 1.5986105 999.00000000 0 22 2.2189803 999.00000000 0 23 0.7905505 999.00000000 0 24 1.3111472 999.00000000 0 25 2.3394220 999.00000000 0 26 1.3667469 999.00000000 0 27 0.3094596 999.00000000 0 28 1.6855216 999.00000000 0 29 1.7934033 999.00000000 0 Thanks in advance. Ehsan Re: [R] Survreg(), Surv() and interval-censored data This message: [ Message body ] [ More options ] Related messages: [ Next message ] [ Previous message ] [ In reply to ] [ Re: [R] Survreg(), Surv() and interval-censored data ] From: Thomas Lumley <tlumley_at_u.washington.edu> Date: Thu 16 Feb 2006 - 07:58:26 EST On Mon, 13 Feb 2006, Stephen Richards wrote:> Can survreg() handle interval-censored data like the documentation > says? I ask because the command: > > survreg(Surv(start, stop, event) ~ 1, data = heart) > > fails with the error message > > Invalid survival type > > yet the documentation for Surv() states: > > "Presently, the only methods allowing interval censored data are > the parametric models computed by 'survreg'" > > Any pointers as to what I'm missing? >You are specifying left-truncated, right-censored data, not interval-censored. You need the type= argument, eg> Surv(c(1,1,NA,3),c(2,NA,2,3),type="interval2")[1] [1, 2] 1+ 2- 3 specifies interval censoring at [1,2], right-censoring at 1, left-censoring at 2, and an observed event at 3. -thomas
The question (slightly rephrased) was Why does survreg(Surv(T.1, T.2, type='interval2') ~1, data=x) fail, when x is T.1 T.2 Status 1 0.0000000 0.62873036 1 2 0.0000000 2.07039068 1 3 0.0000000 1.40297214 1 4 0.0000000 0.09112871 1 5 0.0000000 0.75115280 1 6 0.0000000 2.36476839 1 ... ---------------- The default model for survreg is a Weibull, for which a survival time of exactly zero is not a valid value. Your example triggers this error message. This is a bug in survreg. In the 10+ years the code has been available, no one has ever specified this particular data: a (0,x] interval for a Weibull. Congratulations! Fixing this will require some thought, however. To work around the problem, change 0 to NA, which marks the observation as left-censored. Terry Therneau (author of survreg)