= Solution
The episodes from one patient share treatment, biological susceptibility and prior history, so they are not independent observations. Treating every row as an unrelated subject can substantially understate uncertainty. Two approaches address this <within-patient recurrent-event dependence>:
* A patient-clustered <sandwich covariance matrix> retains a suitable working Cox mean/intensity model but groups score contributions by patient. If $U_i$ is the patient's score contribution and $A$ the observed information, its form is $A^{-1}(\sum_iU_iU_i^{\mathsf T})A^{-1}$. Independent patients, rather than independent rows, determine the sampling units. This corrects uncertainty for within-patient dependence when the working estimating equation is appropriate; it does not repair an incorrect mean model.
* A <shared frailty model> introduces a common latent positive multiplier $V_i$ for all of patient $i$'s episode hazards, often with a specified gamma or lognormal distribution. Given frailty and the relevant history, the event mechanism is modeled through that patient's intensity. Estimate treatment and frailty parameters by integrating or profiling the latent effect. This models persistent heterogeneity directly, but relies on the frailty assumptions and generally gives a conditional treatment-effect interpretation.
A patient-level <bootstrap> is another way to retain dependence: resample complete histories, not individual episode rows. It is not necessary to assume that robust marginal/working and frailty-conditional effect estimates target exactly the same parameter.
Back to article page