# How to properly do a Survival analysis - Question about start times

I have a monthly report that lists transactional errors made by facilities all over the country. Each row is a single error and the columns represent descriptive information about each error (ID, geographic region (Group1), city (Group2), date transaction was created, etc). Generally, these reports have about 1500 - 2000 rows.

Here's a preview of what it looks like:

Obs_Num UniqueID Group1 Group2 CreationDate ReportDate DateDiff
1       654K34C  1      345    03/12/2018   04/01/2019 385
2       231U09R  1      654    06/17/2017   04/01/2019 653
3       144L77E  2      987    03/12/2018   04/01/2019 385
4       798Y65A  4      209    10/26/2018   04/01/2019 157
5       862H42J  5      654    02/27/2019   04/01/2019 33


We know a specific error has been corrected, when it does not appear on the next month's report. We send a summary of these reports out every month by totaling the number of errors by geographic region and then facility in a particular city. The hope is that with each report we send out the number of total errors decreases month by month. That's not always the case - sometimes the numbers go up, but most of the time they go down.

​I want to do a survival analysis on these errors basically "surviving" until they are corrected. The event will be the correction and the "time to event" will be the time it takes until correction.

My plots all look reasonably correct and the results from doing a few Log-Rank tests made sense. However, my issue is with the time variable that I'm using. I have a designated point for when the time period for measuring whether or not an event occurs ends; the date the report was generated. But, most errors have wildly different creation dates. Some a few days before the report generation date, others a few years before the report generation date.

My question: In survival analysis, do I need to structure a dataset in which all errors (rows) have the same starting time periods? Or at least equal intervals? If that's the case, should I have ranges of 30 days in which an event can occur and then continue adding 30 day periods (or however many days in the particular month) as each monthly report is generated?

The answer depends on what survival time you are interested in modeling.

If you are interested in the time from the original error until its correction, use the time of the original error as the start time. If you are interested in the time from the first report including the error until its correction, use that time of the first report including the error as the start time.

I understood the question differently. Do you ask whether all cases have to start at the same time or inside some time interval? If this is the question the answer is no. See here for a visual clarification of the start, end and survival time (section censoring, example).

In your situation the start date is the time when an error firstly occured and the end date is the time when the corrected report was generated. And the survival time is as always end minus start date.

Another thing is that I am not sure what your "subjects" are. Usually you have indipendent objects, namely patients or cars or something like that. If you have data from facilities there will be probably multiple reports from each facility and thus the observations are not independent. This sounds a little like a recurrent event but it is still different because in recurrent event analysis each subject has some start time (date of diagnosis or date when car was produced) and can experience multiple events from that start (first time getting a cold, second time,...). In contrast, in your situation each facility probably submits continuously new reports which can have errors or are corrected. To my understanding your data looks something like this:

Facility    Error occured (start)    Error corrected or censoring (end)
A           12.03.2012               24.01.2013
B           01.12.2008               22.12.2008
A           21.03.2012               24.01.2013
...         ...                      ...


Thus each facility is multiple times included in your analysis with different survival times which means the time to event rows are not independent. I am not sure how to deal with that.