# Can an independent variable change during survival analysis?

Here's my question:

Let's say I'm looking at smoking (categories smoker, ex-smoker, never smoked) and risk of death (binary dead, not dead). I have a follow-up of 5 years. What happens if someone becomes an ex-smoker 3 years into the study?

Do they become effectively censored from the point at which they became an ex-smoker? And following this do they contribute to the survival time for the ex-smoker group until either the end of follow-up (censored) or death? (event)

Its probably a very simple question but I can't find a good explanation of it online. Perhaps I'm having trouble wording the question.

Thanks!

• Censoring is only when an outcome is not observable over an interval of time, usually infinitely forward in time. – AdamO Jan 24 '17 at 15:15

Actually, censoring does occur, but not in the typical way. Ben Ogorek is right in that these data require using analyses that permit time-dependent covariates. There are many ways to do that, but they all require breaking up the follow-up period into pieces, where the pieces are defined by the boundaries where the covariate values change.

Consider the counting-process approach, described in the Vignette that Ben cited. Following your example, suppose you have an individual whose follow-up ended with the event (dead) at 4.53 years on study. Suppose further that they smoked in the first three years, but quit after the 3rd year. To simplify, let's assume smoking only has two levels (yes=1/no=0), and that the yearly time-scale is sufficient. Formulating this as a counting-process problem, your data for this person would look like this:

  id smk start stop death
1   1     0 1.00     0
1   1     1 2.00     0
1   1     2 3.00     0
1   0     3 4.00     0
1   0     4 4.53     1


Technically, the outcome is censored in first four entries for this person. You could then use the regression approaches described in the Vignette to analyze these data.

Nope, they are not censored. Under this framing, smoking is a "time dependent covariate." All the theory behind Survival Analysis (Risk Sets, etc.) is still sound, but you might get annoyed if you want to predict survival into the future and now you have to predict smoking status as well.

For some light reading, check out this vignette on time depended covariates from authors of R's survival package.

• This is not completely true since the time-dependent covariate can also be an internal (endogenous) time-dependent covariate. Especially in the smoking case that the behavior of smoking might carry information on the survival time. Your statement is only valid when the time-dependent covariate is external. Though the majority of the theory still hold for internal time-dependent covariate. – jujae Jan 25 '17 at 3:00