How to deal with exposure or outcome at time 0 in time-varying Cox model

20 Views Asked by At

Let's say I have a dataset with a list of cars, some of which have self-driving function which is the time-varying exposure. Some of the cars had this function from the beginning (time 0) and some acquired it after. The outcome of interest is crash. Some cars had car crash day 0.

df <- data.frame(id = 1:6,
                 selfdrive =      c(1,0,1,1,1,0),
                 crash =       c(0,1,1,0,1,1), 
                 time_toselfdrive = c(0,NA,0,10,30,NA), 
                 time_tocrash_orendfu =  c(55,0,10,90,45,1))


dcd.tv <- tmerge(data1 = df,
                 data2 = df,
                 id = id,
                 status = event(time_tocrash_orendfu, crash),
                 time.tv = tdc(time_toselfdrive))```



How do you deal with those exposures that occurred at time 0 and with those outcomes that occurred at time 0?
0

There are 0 best solutions below