How to code output in survival analysis with interval data

I have data of several patients with several observation points. At each observation points we test if the patient has a condition (0) or not (1). I want to perform survival analysis on this data but I'm confused on how to represent the output correctly.

Example data could be:

| Patient | Day | Condition |
-----------------------------
|       A |  30 |         0 |
|       A |  60 |         1 |
|       A |  90 |         1 |
|       B |  80 |         0 |
|       B | 200 |         0 |
|       C |   0 |         1 |


Checking other similar questions such as this or this one I got to

| Patient |    Output |
----------------------
|       A |       (?) |
|       A |  (30, 60] |
|       A |       (?) |
|       B |  (80, NA) |
|       B | (200, NA) |
|       C |   (NA, 0) |


which I don't know if it is correct. Also, how would we represent the observation with a (?)?

What confuses me the most is the fact that the patients have a different number of observations and they are measured at non-regular points. In this fashion I selected as "Day 0" the date of the first observation of all the patients. However, if a patient has the condition on its first observation (lets say day 10) I don't think it is correct to code it as (0, 10) but rather (NA, 10).

Any help would be appreciated.

It looks like you're on the right track. Modeling recurrent event survival times is hard.

One tweak: it looks like patient B is recruited at time 80 and followed until time 200 then he or she is censored because they did not experience the outcome. If that is the case, you will need to set-up a survival record to indicate that interval of time. I do not know how the software you are dealing with handles records of the form (80, NA) and (200, NA). My hunch is that they're discarded: this info tells us "well we know patient B didn't have the outcome at 80 or 200". My response would be "so what? could've happened at 81 or 80.1 or 80.001." So your code and the intuition are not aligned there. They contribute no person-years' exposure to the denominator of the outcome (risk or incidence).

Before turning to the patient C question, I want to underscore: there's a subtle distinction between modeling the risk of the event and the incidence of the event. Modeling risk means that a patient experiences the event once and they are censored for any later observations.

You've modeled risk here. Modeling incidence on the other hand, means that the third record for Patient A would include time from 60 to 90 and another outcome of 1.

To answer whether you model risk or incidence is a matter of the scientific question and not the data. At times, risk and incidence can lead to conflicting conclusions. This happens with not-rare events, especially when many events happen in the same person. When modeling incidence, people with many events have a greater influence on analyses.

Putting that aside, your question about patient C bears out for either modeling approach. The requirements of survival analysis are that patients must be recruited while they are at-risk for the outcome. This means that your patient C was not recruited while at-risk, but in fact found at a time indistinguishable from the beginning of the study, and unfortunately must be omitted from analyses. Otherwise, their contribution to the hazard function is infinite and Patient C's shared risk factors with other patients who do or do not have the disease may lead to strong influence on the whole analysis.

• Thank you for your answers. A few clarifications: I'm using R, I don't know if that helps. "My response would be "so what? could've happened at 81 or 80.1 or 80.001." I was actually assuming that once you get the condition you will always have that condition in the future, so in that case since the observation (200, NA) is present then it could not have happened at time 81. Finally, if I understood you correctly, when modelling risk the patient A will only have on row and the observations with (?) would be discarded.
– skd
Mar 14 '18 at 17:00
• @skd I see. if the condition is prevalent after first occurrence then you cannot model incidence and you are correct in removing the third record since patient A is no longer at risk for disease from time 60 on. Regarding patient B, I think we are in agreement, but you must format the data to say patient B was at-risk for disease from time 80 to 200. That would be along the lines of Surv(time1=80, time2=200, event=0). They are censored after that. The presence of (?)s is an artifact of how you coded the data. They are being reshaped from long to wide. Each survival record is an interval. Mar 14 '18 at 17:07