Hung-Hsuan Chen (Sean)
2008-Mar-13 09:17 UTC
[R] How to set type of censored data in coxph regression
Dear R users, I tried to analysis the hazard function of some data by coxph function in survival package. The type of the data include "left-censored", "right-censored", "both right-censored and left-censored" (btw, does this has a technical term?), and "complete" ones. I noticed that event (one parameter in "Surv()") might be an indicator for the censored type. However, whenever I set event to 2 or 3, the Surv() function always returns error msg. Take the following code segment for example,> state = c(0, 0, 1, 1, 2, 2, 3, 3, 0, 1) > begin = c(0, 0, 1, 1, 1, 2, 2, 1, 0, 1) > end = c(8, 8, 9, 7, 8, 6, 9, 8, 8, 9) > Surv(begin, end, state)will get err msg: Surv(begin, end, state) : Invalid status value When trying the following code segment:> state = c(0, 0, 1, 1, 0, 1, 0, 1, 0, 1) > Surv(begin, end, state)will get [1] (0,8+] (0,8+] (1,9 ] (1,7 ] (1,8+] (2,6 ] (2,9+] (1,8 ] (0,8+] (1,9 ] I can understand the second code segment, but I cannot understand why the first code segments failed. Can anyone give me some examples or suggestions? Thanks a lot.
Terry Therneau
2008-Mar-13 13:36 UTC
[R] How to set type of censored data in coxph regression
> Dear R users, > I tried to analysis the hazard function of some data by coxph function in > survival package. >The type of the data include "left-censored", "right-censored", "both > right-censored and > left-censored" (btw, does this has a technical term?), and "complete" ones.The coxph function is only defined for right-censored data. That is why you get an error when you include left and interval censored observations. Terry Therneau