Why the Person Is the Variance Unit
A pooled logistic survival model represents follow-up using person-interval records. A person may contribute several rows, but those rows are not separate, independently sampled people. They share a history, a treatment trajectory, and the same underlying outcome process. In particular, an individual can experience the event only once and leaves the risk set after that event. Treating each interval as an independent unit can therefore give an incorrect standard error even when the fitted coefficient is unchanged.
The relevant variance unit is the independent person (or other independent sampling cluster), not the row. The person-clustered sandwich estimates uncertainty from each person's total score contribution, allowing the interval-specific contributions within that person to be dependent. This tutorial treats the treatment weights as fixed in the outcome fit. It does not include uncertainty from estimating those weights.
The vector \(x_{ij}\) can include the baseline-hazard terms and treatment terms used in the marginal structural model. The interval weights are those assigned to the relevant records under the established treatment-weight timing. A person who contributes multiple intervals has one cluster score: the sum of the weighted score contributions across those intervals.
With fixed weights, the negative derivative of the score is \(\sum_j R_{ij}w_{ij}p_{ij}(\theta)\{1-p_{ij}(\theta)\}x_{ij}x_{ij}^{\mathsf T}\). Adding these matrices across people gives the usual weighted logistic “bread.” The sandwich “meat,” by contrast, is built from person-level score totals, not separate rows.
The Clustered Sandwich and Its Justification
The result below is stated for a general estimating equation, so it also covers a weighted score whose model-based variance is not correct. Write \(\theta_0\) for the parameter solving \(E[U_i(\theta_0)]=0\). Under a correctly specified marginal model, this is the target parameter; under a misspecified mean model, it is the population root of the estimating equation, if that root is well defined.
These regularity conditions require, in particular, that the relevant derivatives and score second moments be integrable and that the estimator remain in a neighborhood where the score expansion is valid. They also require independent people; dependence within a person is allowed. For weighted pooled logistic scores, one commonly uses the empirical bread and the outer products of fitted person-level scores:
Here \(\hat{p}_{ij}=p_{ij}(\hat{\theta})\). Because \(\hat{A}\) and \(\hat{B}\) are sums, no additional factor of \(1/n\) appears in this expression. Equivalently, define the empirical averages \(\hat{A}/n\) and \(\hat{B}/n\); the covariance is then \(n^{-1}(\hat{A}/n)^{-1}(\hat{B}/n)(\hat{A}/n)^{-\mathsf T}\). A finite-sample correction may be applied by software, but it does not change the defining cluster-level construction.
Derivation. Set \(\bar U_n(\theta)=n^{-1}\sum_iU_i(\theta)\). The estimating equation gives \(\bar U_n(\hat{\theta})=0\), while \(E[U_i(\theta_0)]=0\). Apply the fundamental theorem of calculus along the line segment from \(\theta_0\) to \(\hat{\theta}\). The resulting matrix is an average Jacobian along that segment; in general, it is not the Jacobian at a single intermediate point.
Call the bracketed matrix \(A_n^*\). By consistency and the stated uniform law of large numbers and continuity conditions, \(A_n^*\xrightarrow{p}A\). The multivariate central limit theorem for independent person-level scores gives \(n^{-1/2}\sum_iU_i(\theta_0)\xrightarrow{d}N(0,B)\). Since \(A\) is nonsingular, Slutsky's theorem yields
For the pooled logistic score, differentiating \(Y_{ij}-p_{ij}(\theta)\) gives the stated bread. To see why the meat must be clustered, expand a person's outer product:
The second sum contains cross-interval terms. Adding separate row-level outer products omits them. This is not a harmless bookkeeping choice: those terms represent the within-person dependence that the variance estimator must allow.
Worked Calculations
Worked Example: A Two-Interval Survival Dataset
Consider an intercept-only pooled logistic fit with unit weights. There are eight people: two experience the event in interval 1, two survive interval 1 and experience the event in interval 2, and four remain event-free through both intervals. Event subjects contribute no later at-risk interval. Thus there are \(2+4+8=14\) person-interval records and four events.
The fitted event probability is the event fraction, \(\hat p=4/14=2/7\). The fitted residual for an event record is \(1-\hat p=5/7\), and for a non-event record it is \(-\hat p=-2/7\). The score totals for the three trajectory types are therefore:
- Each early-event person: \(5/7\), so the two such people contribute \(2(5/7)^2=50/49\) to the meat.
- Each late-event person: \(-2/7+5/7=3/7\), so the two contribute \(2(3/7)^2=18/49\).
- Each event-free person: \(-2/7-2/7=-4/7\), so the four contribute \(4(4/7)^2=64/49\).
The clustered meat is \(50/49+18/49+64/49=132/49\). The bread is \(14(2/7)(5/7)=140/49=20/7\). In this scalar model, the sandwich variance is \((132/49)/(140/49)^2=132/400=0.33\).
If the interval rows were instead treated as independent, the row-level squared residuals would sum to \(4(5/7)^2+10(2/7)^2=140/49\). The resulting inverse-Hessian model-based variance is \((140/49)/(140/49)^2=49/140=0.35\). The two estimates differ because the row-level calculation discards the cross-interval terms. This small illustration is not a precision claim: eight clusters are too few for routine reliance on large-sample approximations.
Worked Example: Combining Weighted Interval Scores
Suppose one person contributes two records to a model with \(\theta=(\theta_0,\theta_1)^{\mathsf T}\). The first has \(x_1=(1,0)^{\mathsf T}\), \(Y_1=0\), \(w_1=2\), and fitted probability \(p_1=0.2\). The second has \(x_2=(1,1)^{\mathsf T}\), \(Y_2=1\), \(w_2=1\), and \(p_2=0.4\).
The interval scores are \(u_1=2(1,0)^{\mathsf T}(0-0.2)=(-0.4,0)^{\mathsf T}\) and \(u_2=(1,1)^{\mathsf T}(1-0.4)=(0.6,0.6)^{\mathsf T}\). The person-level score is \(U_i=u_1+u_2=(0.2,0.6)^{\mathsf T}\), so this person contributes
By contrast, summing the two row-level outer products gives \(\begin{pmatrix}0.52&0.36\\0.36&0.36\end{pmatrix}\). The difference is the cross-product \(u_1u_2^{\mathsf T}+u_2u_1^{\mathsf T}\). With many people, the sandwich meat sums the person-level matrix, not the row-level matrices.
Worked Example: Correlated Scores Can Increase Variance
For a simple illustration, suppose a person's two scalar interval scores have mean zero, variance \(1\) each, and correlation \(0.6\). Their person-level score is their sum, whose variance is \(\operatorname{Var}(u_1+u_2)=1+1+2(0.6)=3.2\). Treating the intervals as independent would use variance \(1+1=2\). The actual cluster-score variance is \(3.2/2=1.6\) times that row-independent calculation. This demonstrates how positive within-person dependence can raise uncertainty; the direction and size of the difference are not guaranteed in every dataset.
Interpretation, Alternatives, and Diagnostics
The usual inverse-Hessian variance is appropriate when the likelihood's independent-observation variance assumptions describe the data. For pooled logistic survival records, that calculation treats rows as independent contributions. The person-clustered sandwich keeps the same fitted estimating equation and bread but replaces the model-based meat with person-level score outer products. A person-level bootstrap is another option: resample people, retaining all of each selected person's intervals. Resampling individual rows would break the observed person histories and is not an appropriate substitute.
The sandwich does not repair a biased estimating equation. It cannot fix incorrect treatment weights, a misspecified marginal mean model, positivity problems, or an incorrect risk-set construction. Nor does the fixed-weight sandwich above account for estimating the weights; that is a separate source of uncertainty. It addresses variance misspecification due to dependence and other departures from the working variance, provided the person-level estimating equation and regularity conditions are suitable.
Check that the cluster identifier is the person, that all of each person's at-risk records enter one cluster score, and that the number of independent people is adequate for the intended approximation. Inspect fitted coefficients and standard errors for sensitivity to highly influential people, and compare clustered with model-based standard errors as a diagnostic—not as a rule for choosing whichever is smaller. Sparse events, extreme weights, or a nearly singular bread can make either variance estimate unstable. With few clusters, ordinary sandwich standard errors can be biased; small-sample corrections or carefully designed person-level resampling may be considered, but neither creates information absent from the data.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- Why is the cluster score a sum of interval scores rather than one score per interval?
- For two interval scores with variances \(2\) and \(3\), and covariance \(1\), what is the variance of their person-level sum? What would an independence calculation give?
- In the two-interval weighted example, what is the first person's contribution to the score meat?
- Name two problems that person-clustered robust variance does not correct.
Solutions. (1) The independent sampling units are people; adding their interval scores preserves within-person cross-products in the meat. (2) The sum has variance \(2+3+2(1)=7\); assuming independence gives \(2+3=5\). (3) It is \(\begin{pmatrix}0.04&0.12\\0.12&0.36\end{pmatrix}\), obtained from the outer product of the total score \((0.2,0.6)^{\mathsf T}\). (4) Examples include a misspecified marginal mean model, incorrect treatment weights, positivity violations, and uncertainty from estimating the weights.