censor_at | R Documentation |
Censor time to event end point at a given time. Implemented for right-censored dataset.
censor_at(time = NULL, status = NULL, censoring_time = NULL)
time |
time variable |
status |
status variable |
censoring_time |
censoring time |
The algorithm works as follow. If time of censoring is higher than (or equal to) patient's time, does nothing and returns time and status as they are. Otherwise:
- if the patients didn't experienced the event at full follow up, he/she didn't experienced even at the previous censoring time: therefore the algorithm should set censored time but leave indicator variable unchanged - if the patients experienced the event at time t, we hyphotize he/she was without event at time t-1 (aka an event is experienced the same day which is registered in the dataset), therefore the algorithm set 0 to indicator variable and set time to censoring time
... synthesizing, in both cases set indicator variable to 0 and time to censoring time.
A data frame to be used with cbind
ctimes <- c(160, 150, 125, 75) ## Example 1: time <- c(100,150, 200) status <- c( 0, 1, NA) cbind(data.frame(time, status), # original censor_at(time = time, status = status, censoring_time = ctimes)) ## Example 2 time <- c(100,150, NA) status <- c( 1, 0, 0) cbind(data.frame(time, status), # original censor_at(time = time, status = status, censoring_time = ctimes))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.