Why Let a Recurrent-Event Effect Change Over Time?
A proportional-effects recurrent-event model says that a covariate has the same multiplicative effect at every time: for example, a treatment hazard ratio of 0.80 throughout follow-up. That can be too restrictive. Treatment might have a strong early effect that fades, or an initially modest effect that becomes larger. Modeling this change directly avoids summarizing the whole follow-up period with a single coefficient that may conceal important variation.
A time-varying covariate changes its value over follow-up; a time-varying effect allows the coefficient multiplying a covariate to change with time. These are different modeling choices. Here the emphasis is on the second: the effect of a covariate, such as treatment assignment, is allowed to change even if the covariate itself is fixed. The earlier material on time-varying covariates and proportional effects provides the basic recurrent-event model context.
Modeling a Changing Coefficient
Let \(N_i(t)\) count recurrent events for subject \(i\) by time \(t\), and let \(Y_i(t)\) indicate whether the subject is in the applicable risk set immediately before \(t\). A general conditional-intensity model is
Here \(\mathcal{H}_i(t-)\) denotes the subject's event and covariate history just before \(t\); \(X_i\) is the covariate whose effect may vary, and \(Z_i\) contains other covariates with constant effects in this specification. The baseline intensity \(\lambda_0(t)\) and the risk-set definition depend on the chosen recurrent-event model. The formula does not by itself determine whether the target is a conditional event hazard or a marginal rate: that interpretation comes from the model and its risk-set construction. The time-varying-effect calculations below apply within the specified model and comparison.
A common parameterization adds an interaction between \(X_i\) and a chosen time function \(g(t)\):
For binary \(X_i\), the hazard ratio at time \(t\), comparing \(X_i=1\) with \(X_i=0\) while holding the remaining modeled conditions fixed, is \(\exp\{\beta_0+\beta_1g(t)\}\). Setting \(\beta_1=0\) recovers a constant effect. Choices for \(g(t)\) include elapsed time, log time, and spline basis functions. Centering time can make the main coefficient easier to interpret: if \(g(t)=t-t_0\), then \(\beta_0\) is the log hazard ratio at \(t_0\).
Worked Example: A Linear Treatment-by-Time Interaction
Suppose a hypothetical Andersen–Gill-type model uses time in months and treatment \(X=1\) versus control \(X=0\). Its estimated treatment coefficient is \(\hat\beta(t)=-0.30+0.04(t-6)\), with other covariates held equal. Assume both groups are compared within the same risk set and event-history conditions. Compute and interpret the treatment hazard ratios at 6 and 12 months.
At 6 months, the centered time value is \(6-6=0\). Therefore \(\hat\beta(6)=-0.30+0.04(0)=-0.30\), and the estimated hazard ratio is \(\exp(-0.30)=0.7408\). Under this model, the treatment group's instantaneous recurrent-event intensity at 6 months is estimated to be 0.741 times the control group's, or about 25.9% lower, for the specified comparison.
At 12 months, \(\hat\beta(12)=-0.30+0.04(12-6)=-0.30+0.24=-0.06\). Thus the estimated hazard ratio is \(\exp(-0.06)=0.9418\). The estimated treatment effect is closer to no difference by 12 months. These are time-specific model comparisons, not statements that treatment caused a change in event intensity.
The coefficient \(0.04\) is a change in the log hazard ratio per month, not a 4% monthly change in the hazard ratio. The model implies that the hazard ratio is multiplied by \(\exp(0.04)=1.041\) for each one-month increase in time.
Choosing and Interpreting the Time Function
A linear interaction in raw time imposes a linear trend in the log hazard ratio. It does not impose a linear trend in the hazard ratio itself. If the effect evolves more naturally with relative rather than absolute time, a log-time function may be preferable. With a quadratic function, curvature is allowed. With splines, the coefficient function is assembled from smooth basis functions and can take a more flexible shape. The additional flexibility costs degrees of freedom and can make estimates unstable, especially where few subjects remain at risk or few recurrences are observed.
For a general model \(\beta(t)=\boldsymbol{b}^{\top}\boldsymbol{q}(t)\), \(\boldsymbol{q}(t)\) is a specified vector of time functions and \(\boldsymbol{b}\) is its coefficient vector. For example, if \(u(t)=\log(t/6)\), then a quadratic log-time model is \(\beta(t)=b_0+b_1u(t)+b_2u(t)^2\). The division by 6 makes \(u(t)=0\) at 6 months, so \(b_0\) is the log hazard ratio at that time.
Worked Example: A Curved Log-Time Effect
For a hypothetical recurrent-event analysis, suppose \(\hat\beta(t)=-0.25-0.20u(t)+0.05u(t)^2\), where \(u(t)=\log(t/6)\) and time is measured in months. Estimate the treatment hazard ratios at 2 and 18 months. These calculations describe the fitted curve; they do not establish that its shape is scientifically correct.
At 2 months, \(u(2)=\log(1/3)\approx-1.0986\). Substitution gives \(\hat\beta(2)=-0.25-0.20(-1.0986)+0.05(-1.0986)^2=-0.25+0.21972+0.0603461\approx0.03007\). The estimated hazard ratio is \(\exp(0.03007)\approx1.031\).
At 18 months, \(u(18)=\log(3)\approx1.0986\). Therefore \(\hat\beta(18)=-0.25-0.20(1.0986)+0.05(1.0986)^2=-0.25-0.21972+0.0603461\approx-0.40937\). The estimated hazard ratio is \(\exp(-0.40937)\approx0.6640\).
The fitted association is slightly above one at 2 months and below one at 18 months. The sign change is a property of this fitted coefficient function, not proof of a real reversal. In particular, assess uncertainty and support in the data at both times before giving the pattern substantive weight.
Inference for Time-Specific Effects
The effect at a chosen time is a linear contrast in the model coefficients. In the general basis representation, \(\hat\beta(t)=\boldsymbol{q}(t)^\top\hat{\boldsymbol{b}}\). If \(\widehat{\operatorname{Var}}(\hat{\boldsymbol{b}})=\widehat{\boldsymbol{V}}\), then
A Wald confidence interval for the log hazard ratio is \(\hat\beta(t)\pm z_{1-\alpha/2}SE\{\hat\beta(t)\}\); exponentiating both endpoints gives an interval for the hazard ratio. This interval concerns the effect at the specified time. It is not a simultaneous confidence band for the entire curve. The covariance matrix must match the model's inferential procedure; for recurrent events, subject-level robust variance may be appropriate when the working intensity model does not capture within-subject dependence.
To test whether an interaction changes the effect over time, test the joint null hypothesis that all time-varying terms are zero. For a quadratic log-time model, this is \(H_0:b_1=b_2=0\), not merely a test of one coefficient. A Wald statistic is \(\hat{\boldsymbol{b}}_v^\top\widehat{\boldsymbol{V}}_v^{-1}\hat{\boldsymbol{b}}_v\), where the subscript \(v\) selects the varying-effect coefficients. Under the null and usual large-sample regularity conditions, it is compared with a chi-squared distribution having degrees of freedom equal to the number of restrictions. A score or likelihood-ratio test may also be used when its assumptions and fitting framework are appropriate.
Worked Example: An Interval for the Hazard Ratio at a Chosen Time
In a hypothetical linear log-time model, suppose \(\hat\beta(t)=\hat b_0+\hat b_1u(t)\), with \(u(t)=\log(t/6)\), \(\hat b_0=-0.10\), \(\hat b_1=0.30\), \(\widehat{\operatorname{Var}}(\hat b_0)=0.040\), \(\widehat{\operatorname{Var}}(\hat b_1)=0.010\), and \(\widehat{\operatorname{Cov}}(\hat b_0,\hat b_1)=-0.005\). Calculate an approximate 95% interval for the hazard ratio at 12 months.
At 12 months, \(u=\log(2)\approx0.6931\), so \(\hat\beta(12)=-0.10+0.30(0.6931)=0.1079\). The variance of this contrast is \(0.040+(0.6931)^2(0.010)+2(0.6931)(-0.005)=0.03787\), giving \(SE=\sqrt{0.03787}=0.1946\).
Using 1.96 for the 95% normal critical value, the log-scale interval is \(0.1079\pm1.96(0.1946)=0.1079\pm0.3814\), or approximately \((-0.2735,0.4893)\). Exponentiating gives the hazard-ratio interval \((0.761,1.631)\), with point estimate \(\exp(0.1079)=1.114\). The interval includes 1, so these data do not provide strong evidence of a difference at the 5% two-sided level at 12 months. It does not give a 95% probability that the fixed hazard ratio lies in this particular interval.
Justification, Assumptions, and Diagnostics
The time-specific hazard ratio follows directly from the model's log link. At a fixed time \(t\), compare two subjects with \(X=1\) and \(X=0\), and the same other covariates, history conditions, and risk-set membership. Their intensity ratio is
The common risk indicator, baseline intensity, and other modeled effects cancel. This derivation also shows the limits of the interpretation: if the groups are not compared under common conditions, if a covariate effect is misspecified, or if the risk-set definition differs, the ratio need not represent the intended contrast.
The model assumes that the chosen functional form adequately represents how the log effect changes with time, the baseline and covariate structure are adequate for the target model, and the observed histories and risk sets are correctly represented. Inference also requires appropriate handling of within-subject dependence and censoring under the chosen method. A robust variance estimator can address some dependence in uncertainty estimation; it does not correct a wrong mean or intensity model, an incorrect risk set, or informative censoring.
Useful diagnostics include plotting estimated time-specific hazard ratios with uncertainty, checking whether the pattern is dominated by sparse late follow-up, and comparing a simple interaction with a more flexible function using a prespecified inferential or model-checking strategy. Look for unstable coefficients, implausibly sharp bends, wide intervals, and strong sensitivity to the time scale or basis choice. If a log-time function is used, time must be positive; its behavior near zero is not defined. Avoid interpreting the curve beyond times with meaningful risk-set support.
Specify the recurrent-event model, risk set, covariate contrast, and time scale before interpreting an effect.
Use a simple interaction when a smooth linear log-effect trend is reasonable; consider splines or other flexible functions only when the data support them.
Evaluate \(\hat\beta(t)\), its uncertainty, and \(\exp\{\hat\beta(t)\}\) at meaningful times within the observed support.
Give time-specific estimates and intervals, the test of time-varying terms when relevant, and the model's risk-set interpretation.
Alternatives and Common Pitfalls
A constant-effect model is more parsimonious and easier to summarize, but it can obscure genuine time variation. Separate time-period effects are easy to communicate but require chosen cut points and assume a constant effect within each period. A smooth spline interaction avoids rigid linear or quadratic trends but uses more parameters and can be unstable with limited data. These alternatives address the shape of the effect; they do not replace choosing the recurrent-event estimand and risk-set structure appropriate to the question. Results from models with different estimands should not be compared as if they were merely different curve-fitting options.
- Confusing a time-varying covariate with a time-varying effect. Updating a subject's covariate value does not automatically allow its coefficient to change with time. Include the appropriate interaction or coefficient function to model that change.
- Reading an interaction coefficient as a hazard ratio. In a log-linear interaction model, the time interaction coefficient describes change in the log hazard ratio per unit of the chosen time function. Exponentiating the full time-specific coefficient gives the hazard ratio.
- Assuming a nonsignificant interaction proves proportional effects. A test may have low power. Report uncertainty and examine whether meaningful changes remain compatible with the data.
- Extrapolating a flexible curve. Estimates at late times can be highly uncertain when few subjects remain under observation. Do not treat a model's numerical prediction as evidence supported by data.
Check Your Understanding
Work through these questions, then compare your reasoning with the solutions.
- A fitted model has \(\hat\beta(t)=0.20-0.03(t-4)\), where time is in months. What is the estimated hazard ratio at 4 months?
- In the same model, calculate the estimated hazard ratio at 10 months and describe its direction relative to one.
- For \(\beta(t)=b_0+b_1\log(t/8)\), which coefficient gives the log hazard ratio at 8 months? What null hypothesis represents a constant effect over time?
- Why does a wide interval for a late time-specific hazard ratio matter even if the fitted curve appears to cross one?
Solutions. (1) At 4 months, \(t-4=0\), so \(\hat\beta(4)=0.20\) and the hazard ratio is \(\exp(0.20)=1.221\). (2) At 10 months, \(\hat\beta(10)=0.20-0.03(6)=0.02\), so the hazard ratio is \(\exp(0.02)=1.020\), slightly above one. (3) Since \(\log(8/8)=0\), \(b_0\) is the log hazard ratio at 8 months; a constant effect corresponds to \(H_0:b_1=0\). (4) A wide interval indicates substantial uncertainty, often because late follow-up has little risk-set support. A curve crossing one alone does not show a well-supported change in effect; the uncertainty at that time must also be considered.