[R] Survival analysis

Medic m@|||P@dpo@t @end|ng |rom gm@||@com
Fri Apr 17 21:06:03 CEST 2020


I can't understand how to do a survival analysis (?Surv ()) when some
event occurred before the start of observation (left censored). If I
understand correctly, there are two methods. I chose a method with: 1)
time from the start of treatment to the event and 2) the indicator of
the event. I did (in my data) the event indicator so:
1 - event, 2 - event before the start of observation, 0 - no event
---
library(survival)
left_censor_data <- read.table("left.csv", header = TRUE, sep = ";")
#sep = ";" it's right!
dput(left_censor_data, file="left_censor_data") #file attached
left_censor_data
   'data.frame':   11 obs. of  2 variables:
   $ timee : int  5 151 33 37 75 14 7 9 1 45 ...
   $ eventt: int  2 0 0 0 0 0 0 2 0 1 ...
   # 1—event, 2 – event before the start of observation , 0 – no event

sur <- Surv(time = left_censor_data$timee,  event =
left_censor_data$eventt, type = "left")
  Warning message:
  In Surv(time = left_censor_data$timee, event = left_censor_data$eventt,  :
  Invalid status value, converted to NA

#Why such a message?
#Then everything turns out wrong


More information about the R-help mailing list