A time-dependent Cox model compares covariate values just before each event among subjects currently at risk. Its formulas look like the baseline-covariate formulas, but validity now depends critically on filtration, predictability, and how histories are encoded.
Predictable covariate histories
Definition. A predictable-covariate Cox intensity is \[ \lambda_i(t\mid\mathcal F_{t-}) =Y_i(t)\lambda_0(t) \exp\{\beta^\top Z_i(t)\}, \] where \(Y_i\) and \(Z_i\) are predictable. The partial score remains \[ U_n(\beta) =\sum_i\int_0^\tau \{Z_i(t)-\bar Z_n(\beta,t)\}\,\mathrm{d}N_i(t). \]
Proposition. At the true parameter, \[ U_n(\beta_0) =\sum_i\int_0^\tau \{Z_i(t)-\bar Z_n(\beta_0,t)\}\,\mathrm{d}M_i(t), \] and is therefore a martingale, provided \(Z_i(t)\) is predictable.
Proof. The integrand is predictable because it is formed from predictable covariates and risk indicators. Substitution of \[ \mathrm{d}N_i =\mathrm{d}M_i +Y_i e^{\beta_0^\top Z_i}\mathrm{d}\Lambda_0 \] cancels the compensator after risk-set centering exactly as in the baseline-covariate case.
If a value recorded after an event is carried backward to time \(t\), the integrand is anticipative and the martingale proof fails. This is a mathematical formulation of look-ahead bias.
Start-stop representation
Definition. Divide subject \(i\)'s observed history into intervals \[ (L_{ik},R_{ik}],\qquad k=1,\ldots,K_i, \] on which covariates are constant at \(Z_{ik}\). Define \[ Y_{ik}(t)=1\{L_{ik}<t\le R_{ik}\}, \qquad \Delta_{ik}=1\{\text{event at }R_{ik}\}. \] The interval rows are pieces of one subject trajectory, not independent observations.
Proposition. The partial log-likelihood computed from start-stop rows equals the counting-process partial likelihood for the original piecewise-constant path, provided each subject contributes at most one active row at a time and risk sets use the open-left, closed-right convention.
Proof. At any event time \(t\), exactly one row for each at-risk subject satisfies \(L_{ik}<t\le R_{ik}\), and its stored value equals \(Z_i(t-)\). Therefore the numerator and every term in the risk-set denominator coincide with those of the pathwise partial likelihood. Multiplication over event times gives equality.
Example (treatment initiation). A subject enters at time \(0\), starts treatment at time \(4\), and fails at time \(9\). The correct rows are \[ (0,4],\ Z=0,\ \Delta=0; \qquad (4,9],\ Z=1,\ \Delta=1. \] Coding \(Z=1\) from baseline incorrectly assigns the guaranteed event-free period \((0,4]\) to treatment and creates immortal-time bias.
External and internal covariates
Definition. An external covariate path is generated independently of the subject's event mechanism beyond modeled history, as with ambient temperature or a prescheduled intervention. An internal covariate is affected by the subject's evolving health or event history, as with current biomarker level or number of previous episodes.
The partial likelihood can estimate conditional intensity associations for either type when predictability and intensity assumptions hold. However, survival under a fixed future internal-covariate path, \[ \exp\left\{ -\int_0^te^{\beta^\top z(u)}\,\mathrm{d}\Lambda_0(u) \right\}, \] need not be a marginal survival probability because the path itself is random and jointly generated with survival. Dynamic prediction requires a model for that joint evolution, such as a landmark or joint longitudinal-survival model.
Risk-set sampling and nested case-control designs
Definition. In nested case-control sampling, when a case occurs at \(t\), a subset \(\widetilde{\mathcal R}(t)\) of controls is sampled from the full risk set. Let \(\pi_j(t)\) be subject \(j\)'s conditional inclusion probability. A weighted risk-set sum is \[ \widetilde S^{(k)}(\beta,t) =\sum_{j\in\widetilde{\mathcal R}(t)} \frac{e^{\beta^\top Z_j(t)}Z_j(t)^{\otimes k}} {\pi_j(t)}. \]
Proposition (Horvitz-Thompson identity). Conditional on the full risk set and its covariates, \[ E\{\widetilde S^{(k)}(\beta,t)\mid\mathcal R(t)\} =S^{(k)}(\beta,t). \]
Proof. Write \(I_j(t)\) for sampling inclusion. Since \(E\{I_j(t)\mid\mathcal R(t)\}=\pi_j(t)\), \[ E\left[ \frac{I_j(t)}{\pi_j(t)} e^{\beta^\top Z_j(t)}Z_j(t)^{\otimes k} \middle|\mathcal R(t) \right] =e^{\beta^\top Z_j(t)}Z_j(t)^{\otimes k}. \] Sum over the full risk set.
Unweighted analysis of a sampled risk set generally changes the target. Variance must also account for the sampling design rather than treating sampled controls as an ordinary cohort.
Recurrent-event risk sets
Definition (Andersen-Gill model). Let \(N_i(t)\) count all recurrent events for subject \(i\). The model \[ \lambda_i(t\mid\mathcal F_{t-}) =Y_i(t)\lambda_0(t)e^{\beta^\top Z_i(t)} \] uses a common baseline intensity and leaves a subject at risk after an event. Its partial likelihood has the ordinary Cox form with every jump of \(N_i\) included.
Dependence. Repeated events within a subject are not independent. If the conditional intensity is correctly specified, martingale theory remains valid; a subject-cluster sandwich covariance is commonly used to protect against misspecified within-subject dependence. Event-number-stratified Prentice-Williams-Peterson models instead condition risk on having experienced the preceding event. These specifications answer different scientific questions.
Time-dependent coefficients
Definition. Let \[ \beta(t)=\sum_{k=1}^K\theta_kb_k(t). \] Then \[ \lambda_i(t) =Y_i(t)\lambda_0(t) \exp\left\{\sum_{k=1}^K\theta_k^\top Z_i(t)b_k(t)\right\} \] is an ordinary Cox model in expanded predictable covariates \(Z_i(t)b_k(t)\).
Example. For a binary treatment \(A\), use \(\beta(t)=\theta_0+\theta_1\log(1+t)\). The hazard ratio is \[ \exp(\theta_0)(1+t)^{\theta_1}. \] Testing \(\theta_1=0\) is a direct test of proportionality for this specified temporal deviation. A flexible basis broadens the alternative but requires regularization or a sufficiently large number of events.
Landmark prediction
At a landmark time \(s\), restrict to subjects with \(Y_i(s)=1\), summarize history through \(H_i(s)\), and model \[ P(T_i>s+u\mid T_i>s,H_i(s)). \] Landmarking respects the information available at prediction time and can be repeated over \(s\). It estimates a sequence of conditional prediction laws, not automatically one globally coherent joint process. That tradeoff is often preferable to extrapolating an internal biomarker path that is not yet observed.