Why the Censoring Model Belongs in the Variance Calculation
An inverse-probability-of-censoring-weighted (IPCW) estimator uses estimated follow-up probabilities, not known constants. Consequently, its variation has two sources: the observed outcomes and the fitted censoring model. Treating the estimated weights as fixed generally omits part of the sampling variation, including covariance between the outcome and censoring-model equations. The appropriate calculation stacks those equations and applies the sandwich formula to the combined system.
The derivation below uses independent subjects and a fixed-horizon mean for clarity. Its structure applies more broadly: define the outcome estimating equation and the censoring-model estimating equations at the subject level, stack them, and take the parameter block of the resulting sandwich covariance. This tutorial concerns that variance calculation, not the construction of longitudinal weights.
Stacking the Estimating Equations
Let \(O_i\) denote the observed data for subject \(i\), independently and identically distributed across \(i=1,\ldots,n\). At a fixed horizon, let \(R_i\) indicate whether the outcome \(Y_i\) is observed, and let \(H_i\) be observed history used in the censoring model. Write \(p(H_i;\eta)\) for the probability of remaining observed, with nuisance parameter \(\eta\). For a mean parameter \(\theta\), one possible IPCW estimating function is
The equation \(\sum_i m(O_i;\theta,\eta)=0\) defines the outcome estimator when \(\eta\) is supplied. Let \(g(O_i;\eta)\) be the censoring-model estimating function, such as a likelihood score, and let \(\hat\eta\) solve \(\sum_i g(O_i;\eta)=0\). The joint estimator \(\hat\psi=(\hat\theta^T,\hat\eta^T)^T\) solves the stacked system.
Here \(P_n\) denotes the empirical average. The population equation is \(E[u(O;\psi_0)]=0\), where \(\psi_0\) is the true parameter vector. The empirical “meat” of the sandwich uses the full vector \(u_i\), so it includes the covariance between outcome and censoring-model contributions.
Large-Sample Justification
The following result states conditions under which the sandwich has its usual interpretation. Assume: (1) subjects are iid; (2) \(E[u(O;\psi_0)]=0\), and the chosen root \(\hat\psi\) is consistent for an interior \(\psi_0\); (3) \(E\|u(O;\psi_0)\|^2<\infty\); (4) \(u\) is differentiable in a neighborhood of \(\psi_0\), and its derivative obeys a uniform law of large numbers there; and (5) the matrix \(A=E[\partial u(O;\psi_0)/\partial\psi^T]\) exists and is nonsingular. These conditions also require the estimating functions and derivatives to be measurable and the relevant expectations to be well-defined. For IPCW equations, positive censoring probabilities on the histories under study and adequate moments of the weighted contributions are essential; a formally defined weight can still have an infinite second moment.
Proof. Put \(\delta_n=\hat\psi-\psi_0\). The fundamental theorem of calculus, applied to the vector function along the line segment from \(\psi_0\) to \(\hat\psi\), gives the exact integral expansion
Call the matrix in braces \(A_n^*\). Consistency gives \(\delta_n\xrightarrow{p}0\). The stated uniform derivative convergence therefore implies \(A_n^*\xrightarrow{p}A\); since \(A\) is nonsingular, \(A_n^*\) is nonsingular with probability tending to one and its inverse converges to \(A^{-1}\). The multivariate central limit theorem gives \(\sqrt n P_nu(\psi_0)\xrightarrow{d}N(0,B)\). Rearranging the exact expansion and applying Slutsky’s theorem yields \(\sqrt n\delta_n=-(A_n^*)^{-1}\sqrt nP_nu(\psi_0)\), whose limiting covariance is \(A^{-1}BA^{-T}\). \(\square\)
In practice, estimate \(A\) by the empirical derivative \(\hat A=P_n[\partial u(\hat\psi)/\partial\psi^T]\) and estimate \(B\) by \(\hat B=P_n[(u_i(\hat\psi)-\bar u)(u_i(\hat\psi)-\bar u)^T]\), where \(\bar u=P_nu(\hat\psi)\). The estimated covariance of \(\hat\psi\) is \(\hat A^{-1}\hat B\hat A^{-T}/n\). The \(1/n\) factor is required because this is the covariance of the estimator, while the theorem gives the covariance of its \(\sqrt n\)-scaled version.
A Scalar Formula for the Effect of Fitting Weights
For a scalar mean parameter and a finite-dimensional nuisance parameter, partition the population derivative as
The zero lower-left block occurs when the censoring-model equation depends on \(\eta\), but not on \(\theta\). If these blocks are nonsingular, the outcome component of the first-order influence function is
This follows by solving the linearized nuisance equation first: \(A_{\eta\eta}\operatorname{IF}_{\eta}+g=0\), so \(\operatorname{IF}_{\eta}=-A_{\eta\eta}^{-1}g\). Substituting into the outcome equation, \(A_{\theta\theta}\operatorname{IF}_{\theta}+m+ A_{\theta\eta}\operatorname{IF}_{\eta}=0\), gives the displayed expression. Its variance is the variance of the entire expression, not just that of \(m\).
Worked Example: Fitting Two Stratum-Specific Censoring Probabilities
Let \(L\in\{0,1\}\), with \(P(L=0)=P(L=1)=1/2\). The target is \(\theta=E[Y]=1\). Conditional on \(L=j\), let \(Y=1+d_j+e\), where \(d_0=-\sqrt{0.8}\), \(d_1=\sqrt{0.8}\), and \(e\) has mean zero and variance \(1.2\). Let \(R\) be independent of \(Y\) given \(L\), with \(p_0=P(R=1\mid L=0)=0.5\) and \(p_1=0.8\). Fit the two probabilities using the stratum-specific observed proportions. Verify the mean and compare the known- and estimated-weight variances.
The conditional means are \(1-\sqrt{0.8}\) and \(1+\sqrt{0.8}\), so their equally weighted average is \(1\). In either stratum, \(E[(Y-1)^2\mid L=j]=d_j^2+\operatorname{Var}(e)=0.8+1.2=2\).
With the probabilities known, the outcome influence contribution is \(R(Y-1)/p_L\). Its conditional second moment in stratum \(j\) is \(E[R(Y-1)^2/p_j^2\mid L=j]=2/p_j\). Thus the variance is \(\frac12(2/0.5)+\frac12(2/0.8)=2+1.25=3.25\).
For the fitted probabilities, use nuisance equations \(g_j=I(L=j)(R-p_j)\), whose derivative is \(-1/2\) for parameter \(p_j\). The derivative of the outcome equation with respect to \(p_j\) is \(-E[I(L=j)R(Y-1)]/p_j^2=-\frac12d_j/p_j\). The influence-function formula therefore gives
Conditional on \(L=j\), this has mean \(d_j\) and variance \(1.2/p_j\), because \(R\) and \(e\) are conditionally independent. Its second moment is \(d_j^2+1.2/p_j=0.8+1.2/p_j\). Averaging the two strata gives \(\frac12(0.8+2.4)+\frac12(0.8+1.5)=1.6+1.15=2.75\). Thus the fitted-weight variance is \(2.75/n\), compared with \(3.25/n\) if the probabilities were known. Estimating nuisance parameters need not increase variance: here the nuisance correction changes the influence function and reduces it.
Further Worked Examples and Practical Checks
Worked Example: Solving the Fitted-Weight Equation in a Sample
Suppose a sample has four subjects in each of two strata. In stratum 0, two are observed, with outcomes 0 and 2; in stratum 1, three are observed, with outcomes 1, 3, and 4. Fit \(p_j\) by the observed fraction within stratum and solve the IPCW mean equation.
The fitted probabilities are \(\hat p_0=2/4=1/2\) and \(\hat p_1=3/4\). The weighted outcome total is \(2(0+2)+(4/3)(1+3+4)=4+32/3=44/3\). The total weight is \(2(2)+(4/3)(3)=4+4=8\). Hence the ratio-form weighted mean is \((44/3)/8=11/6\).
This is also the root of the unnormalized equation \(\sum_i R_i(Y_i-\theta)/\hat p_{L_i}=0\): its weighted outcome total is \(44/3\), and its total weight is \(8\), so its root is \(11/6\). The example checks the point estimate only; its standard error still requires the censoring equations in the sandwich.
Worked Example: A Pooled Censoring Probability Can Change the Target
Consider two equally common strata with true outcome means \(E[Y\mid L=0]=0\) and \(E[Y\mid L=1]=2\), so \(E[Y]=1\). Let their observation probabilities be \(0.5\) and \(0.8\). If a model incorrectly assigns the same probability to everyone, the population IPCW equation has root
This is about \(1.231\), not the target mean \(1\). A common fitted weight cancels from the equation, leaving the observed-outcome mean, which overrepresents the stratum with higher follow-up. A sandwich can estimate sampling variability around this misspecified limit; it cannot make that limit equal the intended target.
Several checks help identify when the calculation or model may be going wrong. First, verify that each subject contributes the entire stacked vector, including the censoring score, and that the empirical derivative has the stated row and column ordering. Second, check that censoring probabilities are bounded away from zero in the histories actually used and that the weighted estimating functions have finite second moments. Third, inspect numerical stability of \(\hat A\): near singularity makes the sandwich unstable and often signals weakly identified nuisance parameters or near-separation in a fitted model. These are checks on the calculation and fit, not proof that the censoring model is correctly specified.
The stacked sandwich is the direct estimating-equation alternative to a “fixed weights” variance, which conditions on fitted weights and generally omits their contribution. A subject-level bootstrap that refits the censoring model in every replicate is another approach; it can capture nuisance fitting, but requires a suitable bootstrap scheme and successful refitting. The stacked calculation is often efficient and transparent when the equations and derivatives are available. Neither method repairs positivity failure, model misspecification, or dependence that contradicts the assumed independent-subject sampling. For clustered data, the empirical meat must instead be built from cluster-level sums, under appropriate independent-cluster assumptions.
Common Pitfalls
- Holding fitted weights fixed. This uses only the outcome equation’s variability. The correction term in the influence function shows what is omitted and how it can covary with the outcome contribution.
- Using only diagonal blocks of the meat. The cross-covariance between \(m\) and \(g\) is part of \(B\). Dropping it generally changes the variance.
- Confusing the variance scale. \(A^{-1}BA^{-T}\) is the asymptotic covariance of \(\sqrt n(\hat\psi-\psi_0)\); divide by \(n\) for the estimated covariance of \(\hat\psi\).
- Assuming a sandwich validates the model. Robustness here refers to the variance calculation for the specified estimating equations under their regularity conditions. It does not protect against a wrong censoring model or a changed estimand.
- Applying a single intermediate Jacobian to a vector equation. The justified expansion uses the integral of the Jacobian along the segment between the true and estimated parameters; a multivariate mean-value point need not exist.
Check Your Understanding
Answer each question, then compare with the solutions below.
- Why does the stacked “meat” include covariance between the outcome and censoring equations?
- In the scalar block setup, what is the outcome influence function when \(A_{\theta\theta}=-1\), \(A_{\theta\eta}=2\), \(A_{\eta\eta}=-4\), and the subject contributions are \(m\) and \(g\)?
- If \(A^{-1}BA^{-T}=0.36\) for the parameter block and \(n=100\), what is the estimated asymptotic variance of the estimator?
- Does a correctly computed sandwich correct the bias in the pooled-probability example? Why or why not?
Solutions. (1) Both equations are evaluated on the same subjects, so their contributions can be correlated; the full empirical covariance retains that cross-covariance. (2) The formula gives \(-(-1)^{-1}\{m-2(-4)^{-1}g\}=m+\frac12 g\). (3) Divide the scaled covariance by \(n\): \(0.36/100=0.0036\). (4) No. The sandwich estimates variability around the equation’s population root, which in that example is \(16/13\), not the intended mean \(1\).