I am making a survival analysis with a cox regression with proportional hazards, we want to analyze wheter the introduction of a phenomenon influences the time until the death of an individual.
A similar example would be: We have patients which were given a medicine at different stages of the disease (and at different ages too and some were not given the medicine at all), how the treatment variable should be introduced so we can measure the "strength" of the introduced change.
I have a possible solution:
- Create a dummy exogenous variable for ranges of the time in which the medicine was introduced. "First 0-6 months", "6 m - 1 year", "1-2 years", "Never", this measured since the birth of the patient.
- Create the same exogenous variable but not dummy.
- Change the time variable and measure it not from birth but from the introduction of the medicine (the problem would be the definition of this variable for the patients without medicine).
- Duplicate the rows of the individuals who had the medicine. In the first repetition, the time would be between birth and the introduction of the medicine as a "censored death"; the second repetition would include the time between the introduction of the medicine and the actual death.
Nowadays, the model includes the introduction of the medicine as a dummy but doesn't have into account the time in which it was introduced.