Tutorials › Competing Risks and Multi-State Models › Time-Varying Coefficients for Transition Hazards

Regression for Multi-State Data · Tutorial 362 of 699

Time-Varying Coefficients for Transition Hazards

Learn to specify and interpret a time-varying covariate coefficient for a multi-state transition, including its hazard ratio, uncertainty, and test for time dependence.

Advanced 11 min read

What You'll Learn

  • Distinguish a time-varying coefficient from a time-varying covariate.
  • Write a transition-specific hazard model with a time-by-covariate term.
  • Interpret the covariate hazard ratio at particular follow-up times.
  • Calculate uncertainty for a time-specific coefficient using its covariance.
  • Test whether a transition effect changes with time and recognize model limitations.

Why Let a Transition Effect Change With Time?

A transition-specific proportional-hazards model assigns a covariate a constant coefficient over follow-up. That may be too restrictive: a treatment could be associated with a strong reduction in one transition hazard soon after entry into a state, but a weaker reduction later. A time-varying coefficient represents this changing association directly, while retaining a transition-specific hazard model.

The key distinction is between a covariate whose value changes over time and a covariate whose coefficient changes over time. Internal and external time-varying covariates concern the former. Here, even if a covariate value is fixed, its association with a particular transition may vary with follow-up time.

Definition: For transition \(k\), a time-varying coefficient model specifies the transition hazard as a function of a coefficient that depends on event time. For a scalar covariate \(x(t)\), one useful form is $$ \lambda_k(t\mid \mathcal H(t-))=\lambda_{0k}(t)\exp\{x(t)[\beta_k+\gamma_k g(t)]\}, $$ where \(\lambda_{0k}(t)\) is the transition-specific baseline hazard, \(\mathcal H(t-)\) is the observed history just before \(t\), and \(g(t)\) is a chosen, known function of follow-up time. The coefficient at time \(t\) is \(\beta_k(t)=\beta_k+\gamma_k g(t)\). The parameter \(\gamma_k\) describes how the covariate effect changes with \(g(t)\).

For a binary covariate, the transition hazard ratio comparing \(x=1\) with \(x=0\), at the same time and conditional history, is \(\exp\{\beta_k+\gamma_k g(t)\}\). For a one-unit increase in a continuous covariate, the same expression is the hazard ratio, assuming the covariate enters linearly on the log-hazard scale. If the covariate changes over time, this comparison is between values differing by one unit at time \(t\); it is still the coefficient function, not the covariate path, that is being modeled as time-varying.

Model Specification and Assumptions

The function \(g(t)\) must be specified before interpreting the coefficient. A linear choice \(g(t)=t\) makes \(\gamma_k\) the change in log hazard ratio per unit of time. A centered or transformed function, such as \(g(t)=\log(1+t/c)\) for a positive time scale \(c\), allows a different pattern. Centering determines the time at which \(\beta_k\) is the covariate coefficient: if \(g(t_0)=0\), then \(\beta_k\) is the coefficient at \(t_0\).

For several covariates, the model can be written

$$ \lambda_k(t\mid \mathcal H(t-))=\lambda_{0k}(t)\exp\left\{\sum_{r=1}^{p} x_r(t)[\beta_{kr}+\gamma_{kr}g_r(t)]\right\}. $$

Each \(g_r(t)\) may be chosen to represent a scientifically plausible pattern. A time interaction can be included for some covariates and not others. Coefficients and time functions can also differ by transition. A time-varying coefficient for one transition does not imply that the effect changes in the same way for another transition.

Interpretation and estimation require the usual conditions for transition-specific hazard regression, together with a correctly specified time function. In particular, the transition risk sets must correctly represent who is at risk for transition \(k\) at each event time; covariate information used at time \(t\) must be available just before that time; and censoring must be conditionally non-informative given the modeled history and covariates. The model also assumes that the covariate’s log-hazard effect follows the chosen function \(g(t)\) and that the baseline hazard can be left unspecified as in a Cox model. Inference relies on adequate event information to estimate both the main effect and its time interaction. These assumptions do not make an observational association causal.

Worked Example: Reading a Changing Hazard Ratio

Suppose a hypothetical model for transition \(k\) uses \(g(t)=\log(1+t/2)\), where \(t\) is measured in years, and estimates \(\hat\beta_k=-0.40\) and \(\hat\gamma_k=0.20\). The covariate \(x\) is binary, with \(x=1\) denoting a particular exposure. The fitted hazard ratio at time \(t\) is \(\exp\{-0.40+0.20\log(1+t/2)\}\).

At entry, \(t=0\), so \(g(0)=0\). The log hazard ratio is \(-0.40\), and the hazard ratio is \(\exp(-0.40)=0.6703\). At \(t=2\) years, \(g(2)=\log 2=0.6931\), giving a log hazard ratio of \(-0.40+0.20(0.6931)=-0.2614\) and a hazard ratio of \(\exp(-0.2614)=0.7700\). At \(t=6\) years, \(g(6)=\log 4=1.3863\), giving \(-0.40+0.20(1.3863)=-0.1227\) and a hazard ratio of \(\exp(-0.1227)=0.8845\).

The fitted association is a lower transition hazard for \(x=1\) than for \(x=0\) at each of these times, but the hazard ratio moves closer to 1 over follow-up. These are conditional comparisons for transition \(k\), not comparisons of overall survival or of the probability of ever making that transition.

How the Time Interaction Enters Estimation

For a single covariate, the Cox linear predictor at time \(t\) includes two terms, \(x(t)\beta_k\) and \(x(t)g(t)\gamma_k\). Thus \(x(t)g(t)\) is an additional covariate whose value is recalculated at each event time. The time function is evaluated at the event time for everyone in the transition-specific risk set; it is not a new measurement of each person’s exposure.

For distinct event times and one event at time \(t\) on transition \(k\), the partial-likelihood contribution has the form

$$ \frac{\exp\{x_i(t)[\beta_k+\gamma_k g(t)]\}} {\sum_{j\in\mathcal R_k(t)}\exp\{x_j(t)[\beta_k+\gamma_k g(t)]\}}, $$

where individual \(i\) has the transition event and \(\mathcal R_k(t)\) is the risk set for transition \(k\) just before \(t\). The contributions over event times form the transition-specific partial likelihood, with an appropriate method required if event times are tied. The time interaction is estimated along with the main covariate effect; it is not estimated by fitting unrelated models at a sequence of follow-up times.

Justification: At an event time \(t\), the model’s relative hazard for two individuals \(i\) and \(j\) in the same transition risk set is $$ \frac{\lambda_{ik}(t)}{\lambda_{jk}(t)} =\frac{\lambda_{0k}(t)\exp\{x_i(t)[\beta_k+\gamma_k g(t)]\}} {\lambda_{0k}(t)\exp\{x_j(t)[\beta_k+\gamma_k g(t)]\}} =\exp\{[x_i(t)-x_j(t)][\beta_k+\gamma_k g(t)]\}. $$ The common baseline hazard cancels. Consequently, conditional on one event occurring in that risk set at \(t\), the event probability is proportional to each individual’s relative hazard, which gives the partial-likelihood contribution above. Because \(g(t)\) is evaluated at the event time, this contribution estimates a time-dependent covariate effect within the transition risk set.

Uncertainty for a Hazard Ratio at a Chosen Time

A time-specific coefficient is a linear combination of estimated parameters. If \(\hat\beta_k\) and \(\hat\gamma_k\) have estimated variances \(V_{\beta\beta}\) and \(V_{\gamma\gamma}\), and covariance \(V_{\beta\gamma}\), then at time \(t\),

$$ \widehat{\beta_k(t)}=\hat\beta_k+g(t)\hat\gamma_k,\qquad \widehat{\operatorname{Var}}\{\widehat{\beta_k(t)}\} =V_{\beta\beta}+g(t)^2V_{\gamma\gamma}+2g(t)V_{\beta\gamma}. $$

A Wald confidence interval for the log hazard ratio is the estimate plus or minus a normal critical value times its standard error. Exponentiating both endpoints gives the interval for the hazard ratio. The covariance term matters: omitting it can materially change the standard error.

Worked Example: A Time-Specific Hazard Ratio and Interval

Consider a hypothetical fitted model with \(\hat\beta_k=-0.10\), \(\hat\gamma_k=0.25\), \(\operatorname{Var}(\hat\beta_k)=0.0100\), \(\operatorname{Var}(\hat\gamma_k)=0.0064\), and \(\operatorname{Cov}(\hat\beta_k,\hat\gamma_k)=-0.0030\). Let \(g(t)=\log(1+t/1\text{ year})\), and find the hazard ratio and approximate 95% confidence interval at \(t=3\) years. Then \(g(3)=\log 4=1.3863\).

The estimated log hazard ratio is \[ -0.10+1.3863(0.25)=-0.10+0.346575=0.246575. \] Thus the estimated hazard ratio is \(\exp(0.246575)=1.280\).

Its estimated variance is \[ 0.0100+(1.3863)^2(0.0064)+2(1.3863)(-0.0030) =0.0100+0.0122997-0.0083178=0.0139819, \] which rounds to \(0.01398\). The standard error is \(\sqrt{0.0139819}=0.1182\). The approximate 95% interval on the log scale is \[ 0.246575\pm1.96(0.1182)=0.246575\pm0.2317, \] or approximately \((0.0149,\,0.4783)\). Exponentiating gives a hazard-ratio interval of approximately \((1.015,\,1.613)\).

At 3 years, the fitted hazard for a one-unit increase in \(x\) is estimated to be 1.280 times as large, conditional on the transition risk set and modeled history. The approximate interval is for the population hazard ratio at that time; it is not a 95% probability statement about the fixed parameter.

Testing Whether the Effect Changes With Time

In the model \(\beta_k(t)=\beta_k+\gamma_k g(t)\), no time variation on the chosen scale corresponds to \(H_0:\gamma_k=0\). A Wald test uses the estimate divided by its standard error; equivalently, the squared statistic is compared with a chi-square distribution with one degree of freedom. This tests the specified time interaction, not every possible departure from a constant effect. A likelihood-based comparison of nested models is another standard option when its assumptions and fitting method are appropriate.

Worked Example: Testing a Linear Time Interaction

Suppose a hypothetical transition model uses \(g(t)=t\), with time measured in years, and estimates \(\hat\gamma_k=0.30\) with \(SE(\hat\gamma_k)=0.12\). Test \(H_0:\gamma_k=0\) against a two-sided alternative at \(\alpha=0.05\).

The Wald statistic is \(z=0.30/0.12=2.50\). Under \(H_0\), the two-sided normal-approximation p-value is \(2P(Z\ge2.50)\approx0.0124\), where \(Z\sim N(0,1)\). Since \(0.0124<0.05\), reject \(H_0\). The data provide evidence that the log hazard ratio changes with time linearly on the specified scale. The estimated change is 0.30 in log hazard ratio per year; it does not say that the hazard itself rises by 30% each year.

Choosing a Time Function and Checking the Model

The choice of \(g(t)\) determines the pattern the model can represent. A linear interaction assumes a constant rate of change in the log hazard ratio per time unit. A logarithmic interaction can accommodate a more rapid early change followed by slower change. If a single function is implausible, a small set of basis functions can represent a smoother pattern, but the number of parameters must be supported by enough transition events.

Useful checks include examining whether the selected time scale and functional form are scientifically reasonable, verifying that the time variable uses the intended units, and checking that the interaction is estimable across the observed follow-up. Sparse events late in follow-up can make a time-specific estimate very imprecise even when the overall model converges. Large standard errors, unstable estimates after modest changes in the time function, or a hazard ratio that is driven by a few late events are warnings against strong interpretation. Model fit should also be compared with a simpler constant-effect specification and, where justified, a more flexible time function.

The main alternatives answer related but different questions. A constant coefficient is more parsimonious but assumes a fixed hazard ratio. Stratifying by transition allows transition-specific baseline hazards, but by itself does not make a covariate effect change over time. A time-varying covariate changes the value of \(x(t)\), whereas a time-varying coefficient changes the multiplier of that covariate. Splitting follow-up into intervals and fitting interval-specific effects can describe step changes, but the cut points are arbitrary and precision may be poor within intervals. A smooth time interaction can avoid sharp jumps, at the cost of additional modeling choices and parameters.

None of these forms guarantees that the fitted hazard ratio is constant within an interval or correctly describes all aspects of the multi-state process. A hazard ratio is conditional and transition-specific; it does not directly provide state occupation probabilities or the probability of eventually experiencing an event. Those quantities depend on the whole set of transition hazards. As with other regression associations, estimated time variation should not be interpreted causally without a design and assumptions that support causal inference.

Common Mistakes

  • Confusing changing exposure with changing effect. A subject’s \(x(t)\) may change while \(\beta_k\) stays fixed, or \(x\) may stay fixed while \(\beta_k(t)\) changes. These are distinct model features.
  • Reporting one hazard ratio for all follow-up. With \(\gamma_k\ne0\), the hazard ratio depends on \(t\). State the time, time scale, and covariate contrast.
  • Dropping the covariance in an interval calculation. The variance of \(\hat\beta_k+g(t)\hat\gamma_k\) includes \(2g(t)\operatorname{Cov}(\hat\beta_k,\hat\gamma_k)\).
  • Calling a time interaction a change in the baseline hazard. The interaction changes the covariate effect; \(\lambda_{0k}(t)\) remains the transition-specific baseline hazard.
  • Extrapolating beyond observed event information. A fitted curve can be numerically defined where few or no transition events inform it. Its uncertainty and practical relevance must be considered.
Key takeaway: A transition-specific time-varying coefficient makes the covariate hazard ratio \(\exp\{\beta_k+\gamma_k g(t)\}\) depend on follow-up time. Specify the time function, interpret the ratio at an explicit time, and use the covariance matrix when calculating its uncertainty.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In \(\beta_k(t)=\beta_k+\gamma_k t\), what does \(\gamma_k\) measure when \(t\) is recorded in months?
  2. A model has \(\hat\beta_k=0.10\), \(\hat\gamma_k=-0.05\), and \(g(t)=t\) in years. Calculate the hazard ratio at 2 years for a one-unit covariate increase.
  3. Why does the variance of a time-specific coefficient include a covariance term?
  4. What null hypothesis tests whether the coefficient changes over time for a model using one time interaction?
  5. Explain why a time-varying coefficient is not the same as an internal time-varying covariate.

Solutions. (1) \(\gamma_k\) is the change in log hazard ratio per month, under the linear-in-months specification. (2) The coefficient is \(0.10-0.05(2)=0\), so the hazard ratio is \(\exp(0)=1.00\). (3) The time-specific coefficient is a linear combination of estimated parameters, and its variance includes their covariance: \(V_{\beta\beta}+g(t)^2V_{\gamma\gamma}+2g(t)V_{\beta\gamma}\). (4) The null is \(H_0:\gamma_k=0\); it tests no change on the chosen time-function scale. (5) An internal time-varying covariate has a value \(x(t)\) that changes over time, while a time-varying coefficient changes the covariate’s log-hazard multiplier \(\beta_k(t)\). Either feature can occur without the other.

Clinical Biostats