Covariates that change during follow-up
Today let's look at a kind of covariate that does not sit still once you start watching it: one whose value can change partway through a subscriber's own follow-up.
A software company has 1,000 subscribers, each one followed for up to 36 months, until they cancel, the event, or the 36 months run out with them still subscribed, censored.
Most of these subscribers stay on the company's standard plan for their entire subscription. But some of them upgrade to a premium support plan, and not on the same day. One subscriber might upgrade in month 2, another in month 14, another not at all.
Here is one subscriber's own timeline, drawn out as two steps.
That second step is the one that matters. Before it, this subscriber is not on premium support. After it, they are. One subscriber, one timeline, and two different true answers to the same question, depending on which month you ask it.
A covariate that is not fixed at baseline
A covariate like a patient's sex, or which treatment arm they were randomized to, is fixed the moment they enroll. It is one value, decided before follow-up even starts, and it stays that value for the whole time you watch them. Call that a baseline covariate: known and fixed at time zero.
Premium-support status is not like that. Every subscriber starts at 0, not on premium support, because nobody has upgraded before they even sign up. For some subscribers it later switches to 1, at their own upgrade month. Call this a time-varying covariate: its value can change during follow-up, at a real month you can point to in the data.
That difference matters because an ordinary Cox model call expects one row per subscriber, and one row can only hold one value of premium. Four of this cohort's own subscribers make the problem concrete.
Here is that cohort of 1,000 subscribers built in R, with four of them pulled out to make the point.
Subscriber 1 never upgrades, so premium is honestly 0 for their whole 6.6 months. But look at subscriber 38. They upgrade in month 6 and are followed to month 11.7. A single row for them has to pick one premium value, 0 or 1, for all 11.7 months.
Neither one is true: for the five and a half months before the upgrade, premium really was 0, and for the months after, it really was 1. Subscribers 720 and 155 have the exact same problem, each at their own upgrade month, 11 and 15.