Why weighting changes the standard error
A weighted Cox fit can produce a useful estimate of a marginal hazard-model parameter while its ordinary, model-based standard error is wrong. The issue is not that the fitted coefficient necessarily changes when a different variance estimator is used. The issue is that weighting changes the variability of the estimating equation, while the ordinary Cox standard error estimates uncertainty from the curvature of the partial log-likelihood as though that curvature alone described the sampling variation.
For a weighted Cox model, observations contribute unequally to the score. In inverse-probability weighting, for example, a large weight makes an observation’s contribution more influential. The resulting weighted partial likelihood is generally a pseudo-likelihood, not the likelihood for independent observations drawn from the weighted population. Consequently, the likelihood information identity that motivates the ordinary inverse-Hessian variance need not hold.
For example, with one covariate vector \(X_i(t)\), at-risk indicator \(Y_i(t)\), event process \(N_i(t)\), and weight \(W_i(t)\), a common weighted Cox score has the form
where \(S_W^{(0)}(\beta,t)=\sum_i W_i(t)Y_i(t)\exp\{\beta^\mathsf{T}X_i(t)\}\) and \(S_W^{(1)}(\beta,t)=\sum_i W_i(t)Y_i(t)\exp\{\beta^\mathsf{T}X_i(t)\}X_i(t)\). The exact score depends on the weighting and tie conventions. The key point is that the fitted equation has weighted contributions, so its sampling variation must be assessed from those contributions, not inferred automatically from an unweighted likelihood argument.
Two variance calculations
Write the score as a sum of independent-unit contributions \(U_n(\beta)=\sum_{i=1}^n u_i(\beta)\). If an individual contributes repeated intervals, the independent unit is the person: sum that person’s interval contributions before forming the variance. Define the observed negative derivative and the empirical score-variation matrix by
The ordinary model-based estimate is \(\widehat A^{-1}\). The robust sandwich estimate is \(\widehat A^{-1}\widehat B\widehat A^{-\mathsf{T}}\), where \(\widehat A^{-\mathsf{T}}=(\widehat A^{-1})^\mathsf{T}\). In a scalar model, these reduce to \(1/\widehat A\) and \(\widehat B/\widehat A^2\).
These are not competing estimates of the fitted coefficient. They use the same \(\hat\beta\), but make different claims about its sampling variance. The model-based calculation treats curvature as sufficient. The sandwich calculation estimates how variable the independent-unit scores actually are and scales that variability by the score’s sensitivity to changes in \(\beta\).
Deriving the sandwich variance
The result below requires independent sampling units, a consistent root \(\hat\beta\) near the true estimating-equation parameter \(\beta_0\), a nonsingular limiting derivative, and a central limit theorem for the score contributions. In particular, assume \(n^{-1/2}U_n(\beta_0)\xrightarrow{d}N(0,B)\), \(n^{-1}[-\partial U_n(\beta_0)/\partial\beta^\mathsf{T}]\xrightarrow{p}A\), with \(A\) nonsingular, and that the average negative derivative along the segment from \(\beta_0\) to \(\hat\beta\) also converges in probability to \(A\). Assume the score has mean zero at \(\beta_0\) and the required finite second moments. These conditions must apply to the estimating equation actually used; if weights are estimated, their estimation may need to be included in the score contributions.
To prove the result, use the fundamental theorem of calculus along the line segment between \(\beta_0\) and \(\hat\beta\). This gives an exact vector expansion; it does not require claiming that a single intermediate vector makes a multivariate mean-value formula exact. Set
Because \(U_n(\hat\beta)=0\), integration of the derivative yields \(0=U_n(\beta_0)-\bar A_n(\hat\beta-\beta_0)\). Therefore,
By assumption, \(\bar A_n/n\xrightarrow{p}A\), and the score central limit theorem gives \(U_n(\beta_0)/\sqrt n\xrightarrow{d}N(0,B)\). Slutsky’s theorem then gives the stated normal limit and covariance \(A^{-1}BA^{-\mathsf{T}}\). The empirical sandwich has this same limit because its derivative and score-variation components consistently estimate \(A\) and \(B\), respectively. \(\square\)
For an ordinary correctly specified likelihood, regularity conditions give the information identity: the score variance equals the expected negative derivative. That identity is what permits the inverse information alone to estimate variance. It does not follow just because an objective function is called a partial likelihood. With weights, the derivative and the variance of the weighted score generally differ. Even in a simple sum of weighted contributions, multiplying a contribution by \(W_i\) multiplies its variance by \(W_i^2\), whereas the derivative is multiplied by \(W_i\). Dependence among risk-set terms adds further reasons not to assume equality.
Worked numerical comparisons
Worked Example: Robust Standard Error Larger Than the Model-Based One
Consider a one-parameter weighted Cox fit whose score contributions at the fitted coefficient, grouped by independent person, are \(u_i=(1.5,-1.5,1,-1)\). Suppose the observed negative derivative is \(\widehat A=4\). These are illustrative score and derivative summaries; the calculations compare variance estimators from the same fit.
First check that the fitted score is zero: \(1.5-1.5+1-1=0\). The empirical score variation is
The model-based variance and standard error are \(1/4=0.25\) and \(\sqrt{0.25}=0.5\). The sandwich variance and standard error are \(6/4^2=6/16=0.375\) and \(\sqrt{0.375}\approx0.612\). The robust standard error is larger because the observed score variation exceeds what the model-based calculation implies.
Worked Example: Robust Standard Error Can Be Smaller
Now suppose another scalar fit has score contributions \(u_i=(1,-1,0.5,-0.5)\) and \(\widehat A=5\). Their sum is \(1-1+0.5-0.5=0\), and
The model-based variance is \(1/5=0.2\), giving standard error \(\sqrt{0.2}\approx0.447\). The sandwich variance is \(2.5/5^2=2.5/25=0.1\), giving standard error \(\sqrt{0.1}\approx0.316\). Thus the robust standard error is smaller here. Robust does not mean larger; it means that the variance estimate uses the empirical score variation rather than assuming it equals the derivative.
Worked Example: Rescaling All Weights
Suppose the first example’s weights are all multiplied by \(c=2\), without changing the fitted coefficient. The score and derivative both double, so \(\widehat A\) changes from \(4\) to \(8\). Each score contribution doubles, so \(\widehat B\) changes from \(6\) to \(2^2(6)=24\).
The rescaled model-based variance is \(1/8=0.125\), half its previous value. The sandwich variance is \(24/8^2=24/64=0.375\), unchanged. In general, multiplying all weights by a positive constant \(c\) leaves the sandwich variance invariant because \((cA)^{-1}(c^2B)(cA)^{-\mathsf{T}}=A^{-1}BA^{-\mathsf{T}}\). The inverse-Hessian variance, by contrast, scales by \(1/c\). This is a useful warning: a model-based standard error can depend on an arbitrary common scaling of pseudo-likelihood weights.
Diagnostics, alternatives, and limitations
A practical check is to compare model-based and sandwich standard errors, along with the weighted score contributions and the fitted curvature. A large discrepancy signals that the information-identity calculation is not a reliable description of variability. Inspect whether a few people have unusually large weighted score contributions, and verify that repeated records have been combined at the independent-person level. Also check that the derivative is nonsingular and that the fit is not dominated by a very small number of highly weighted observations. These checks can reveal instability; they do not establish that the causal weighting assumptions or the outcome model are correct.
The principal alternatives answer different questions. The inverse-Hessian estimate is appropriate when the fitted likelihood and sampling model justify its information identity. The sandwich estimate is a robust large-sample variance for an estimating equation under independent units and a valid score central limit theorem. A person-level bootstrap can provide another uncertainty estimate by resampling people and repeating the fitting procedure, including weight estimation when that estimation is part of the analysis. It can be computationally demanding and may itself be unstable with extreme weights or few events. For estimated weights, a sandwich calculation that treats them as fixed can omit their estimation uncertainty; the appropriate adjustment uses the joint estimating equations or a procedure that re-estimates the weights in each resample, as covered in the earlier material on accounting for estimated weights in Cox model uncertainty.
No variance estimator repairs poor positivity, extreme weights, an incorrect causal estimand, or dependence that has not been represented in the independent-unit definition. Nor does the sandwich formula guarantee good finite-sample coverage: its justification is asymptotic, and sparse events or a small number of independent people can make it unreliable. Finite-sample corrections are available in some settings, but their form depends on the design and software and should not be treated as a universal fix.
Check Your Understanding
Try each question, then check the solutions below.
- For a scalar weighted Cox fit, \(\widehat A=10\) and \(\widehat B=40\). Calculate the model-based and sandwich standard errors.
- Why should repeated-interval score contributions from one person generally be combined before calculating \(\widehat B\)?
- If every weight is multiplied by \(c>0\), how do the scalar model-based and sandwich variances change?
- Does a sandwich standard error account automatically for estimating the weights? State one way to include that uncertainty.
Solutions. (1) The model-based variance is \(1/10=0.1\), so its standard error is \(\sqrt{0.1}\approx0.316\). The sandwich variance is \(40/10^2=0.4\), so its standard error is \(\sqrt{0.4}\approx0.632\). (2) Intervals from one person are not independent sampling units. Summing within person preserves the appropriate unit-level score and its within-person dependence. (3) The model-based variance is divided by \(c\); the sandwich variance is unchanged because the derivative scales by \(c\) and the score-variation term by \(c^2\). (4) No. Use a joint estimating-equation variance that includes weight estimation, or bootstrap people while re-estimating the weights in every resample.