AI Glossary / Statistics and probability / Intermediate
Time-varying covariate
Definition
A time-varying covariate is a predictor whose value can change during the period being analyzed. In survival analysis, it allows an event-risk model to use a unit's relevant current or past information rather than only its baseline characteristics. The timing of each update is part of the variable's definition and must be represented correctly.
What it means
A customer's plan, a device's workload, or a service's usage level may change during follow-up. Treating the eventual value as if it applied from the start can misrepresent the history available at earlier times.
A time-varying covariate is different from a time-varying coefficient. In the first case, the predictor value changes; in the second, the strength of its modeled association changes with time. A model can contain either or both, but the interpretation must distinguish them.
How it works
Define the covariate and when its value becomes available. A measurement recorded at a later visit should not automatically be used to describe an earlier risk set. The predictor at an event time should reflect information available just before that event under the chosen convention.
Represent changes using intervals or another suitable longitudinal structure. In a common start-stop format, each row describes a period during which the recorded covariate value applies, with an indicator showing whether the interval ends in the event.
Keep interval boundaries and event ordering explicit. Changes and events recorded on the same date may need a documented within-day convention. Overlapping intervals can accidentally place the same unit in a risk set twice, while gaps can remove observed follow-up.
In an extended Cox model, a form such as h(t|X(t)) = h0(t) exp(beta X(t)) uses a time-varying predictor with a constant coefficient. At each event time, the model compares the current covariate values of units at risk.
Do not confuse row expansion with additional subjects. Splitting one person's follow-up into several nonoverlapping intervals is a data representation, not several independent individuals. Recurrent-event dependence is a separate issue that may require additional modeling or variance treatment.
Choose how to represent information between measurements. Carrying forward a last-known value is an assumption about the recorded predictor; it may not equal the true continuously changing state. Interpolation using future measurements can leak information into earlier times and requires careful justification in the analysis framework.
Distinguish external covariates, such as a scheduled environmental condition, from internal covariates related to the unit's evolving event process. Future paths may be unknown, complicating prediction beyond the current time. A conditional hazard model does not by itself supply those future trajectories.
For causal questions, changing covariates can be affected by earlier exposure and also influence later exposure. Ordinary adjustment may not identify the desired causal effect under such time-varying confounding. More specialized methods and assumptions may be needed.
Validate both data construction and model interpretation. Check update times, event flags, missing measurements, and whether the model's functional form fits the scientific question. Adding time-varying predictors does not automatically remove bias or make associations causal.
Three practical examples
- Retention modeling: update subscription status or usage summaries as information becomes available.
- Reliability analysis: incorporate changing workload recorded before device failure.
- AI monitoring: model time to an operational event using a system-state measure updated during follow-up.
Think of it this way
Think of a travel forecast that updates with the weather observed along the journey. Using tomorrow's storm report to describe yesterday's conditions would give the forecast information it did not have. Time-varying covariates require the same discipline about when information became available.
Worked example
Consider an original device followed from time zero until failure at day twelve. A recorded workload score is 2 initially, becomes 4 after day four, and becomes 3 after day nine. Using intervals open on the left and closed on the right, the rows are (0,4] with score 2 and no event, (4,9] with score 4 and no event, and (9,12] with score 3 and an event.
The durations are four, five, and three days, totaling twelve. The three rows represent one device and one failure. At an event time of day seven, this device's covariate value would be 4, because that is the value available in its current interval.
In a stipulated Cox model with beta = log(1.5), a two-unit difference in current workload gives a conditional hazard ratio exp(2 beta) = 2.25, holding other modeled variables fixed.
This is not a risk ratio or a prediction that failure probability is multiplied by 2.25. Nor does it establish that increasing workload causes failure; that would require additional causal assumptions.
Illustrative case study
Fictional case: Alder Subscriptions studies whether adopting an AI feature is associated with cancellation timing. Its first dataset marks eventual adopters as users from signup, assigning their pre-adoption history to the user group. Analysts reconstruct adoption dates and update usage status only when adoption occurs. They then examine confounding and model assumptions separately. Correct timing removes one obvious history error without turning an observational association into a guaranteed causal effect.
Common misconceptions and mistakes
Do not use future values as baseline predictors. A changing covariate is not the same as a changing coefficient. Splitting follow-up into rows does not multiply the number of people or devices. A hazard ratio is not a cumulative risk ratio. Last-observation carry-forward does not prove the underlying state stayed constant. Proper time coding does not automatically solve time-varying confounding.
Business use
Use time-varying covariates when decisions depend on evolving histories rather than static profiles. Preserve timestamps and define the information available at each prediction time. Audit interval construction before interpreting model results, and make separate plans for future covariate paths when producing longer-horizon predictions.
People also ask
Can a baseline variable remain in the same model?
Yes; fixed and changing predictors can coexist.
Does every update create an independent observation?
No.
Does a constant coefficient imply the predictor never changes?
No; it describes a constant modeled association per unit of the current predictor.
Check your understanding
How many devices are represented by the three example rows?
Answer: One.
What workload applies on day seven?
Answer: Four.
What does the 2.25 ratio compare?
Answer: Conditional instantaneous hazards under the stipulated model, not cumulative event probabilities.
Related terms
- Cox model
- Risk set
- Longitudinal data
- Time-dependent covariate
- start-stop data
- time-varying coefficient
- immortal time bias
- time-varying confounding
Learn next
Study interval construction and predictable covariates, then compare time-varying predictors with nonproportional effects. Examine causal methods designed for exposure-confounder feedback when that is the research question.
More in Statistics and probability
- Time series breaks - Time series breaks are discontinuities in comparability caused by changes in how a variable is defined, classified, covered, measured, or compiled over time.
- Time-series segmentation - Time-series segmentation divides an ordered sequence into contiguous intervals that are relatively coherent under a chosen criterion.
- Time Warp Edit Distance - Time Warp Edit Distance, abbreviated TWED or TWE, is an elastic distance for comparing time series through a minimum-cost sequence of matching and editing...
- Tolerance - Tolerance is a regression diagnostic that measures how much of one predictor's variation remains unexplained by the other predictors in the model.
- Transfer model - A transfer model, in traditional machine translation, maps a representation of a source-language expression into a representation suitable for producing the...
- Transient failure model - A transient failure model is a probabilistic description that allows a sensor or component to produce an occasional faulty result without assuming that the...
Sources
Therneau, Crowson and Atkinson, Using Time Dependent Covariates and Time Dependent Coefficients in the Cox Model, 2017: https://people.math.aau.dk/~rw/Undervisning/DurationAnalysis/Literature/timedep_therneau.pdf Harrell, Glossary of Statistical Terms: https://hbiostat.org/glossary/ The device intervals and hazard-ratio calculation are original.
Previous: Time travel (for features) Next: Time Warp Edit Distance