Skip to content
Prev 139354 / 398503 Next

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,
will get err msg: Surv(begin, end, state) : Invalid status value

When trying the following code segment:
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.