[R] Survival analysis
m@|||P@dpo@t @end|ng |rom gm@||@com
Fri Apr 17 23:03:37 CEST 2020
On 2020-04-17 20:06, Medic wrote:
> 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
I have no experience of left censoring beyond the text book. Is your
left censored data the SAME event or a different event?
YES, THE SAME!
> left_censor_data <- read.table("left.csv", header = TRUE, sep = ";")
> #sep = ";" it's right!
> dput(left_censor_data, file="left_censor_data") #file attached
> '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
So if I read this data correctly the first observation is left censored.
What does the time "5" refer to? Is that 5 days BEFORE observation the
My text book understanding of left censored data was that your
censored points would
have time 0.
I TRIED TO SET TIME 0 NOW (for censored points), AND RECEIVED THE SAME
WARNING (AND THE CURVE TURNED OUT WRONG)
> 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 WARNING message?
> #Then everything turns out wrong
Is the censoring type you want LEFT TRUNCATION rather than LEFT.
If they are also right censored I think R Surv calls these Counting.
I SAY ABOUT LEFT CENSORING (NOT ABOUT LEFT TRUNCATION)!
(COUNTING? I DO NOT UNDERSTAND THIS.)
THANKS! I HOPE SOMEONE EXPLAIN TO ME
1) HOW TO COMPILE THE DATA and
2) WRITE A CODE
More information about the R-help