Tutorials › Competing Risks and Multi-State Models › Cluster-Robust Variance for Fine-Gray Models

Regression: Cause-Specific Cox and Fine-Gray · Tutorial 157 of 699

Cluster-Robust Variance for Fine-Gray Models

You will calculate and interpret cluster-robust uncertainty for Fine-Gray coefficients, and identify when the sandwich variance is or is not trustworthy.

Advanced 10 min read

What You'll Learn

  • State the assumptions needed for cluster-robust Fine-Gray inference.
  • Construct the sandwich variance from cluster-level Fine-Gray score contributions.
  • Distinguish a change in uncertainty estimates from a change in the fitted coefficients.
  • Interpret a cluster-robust confidence interval and test in context.
  • Diagnose too few clusters, influential clusters, and problems the sandwich cannot repair.

Why Cluster-robust Variance Is Used

Fine-Gray regression relates covariates to the subdistribution hazard for a specified event cause. Its risk-set construction retains information about people who experience a competing event, and censoring weights may be used to handle censoring. When individuals are grouped—for example, patients treated at the same clinic—their outcomes may be more alike within a group than across groups. Treating every individual as independent can then understate or otherwise misstate the uncertainty of the estimated regression coefficients.

A cluster-robust variance estimator changes the estimated covariance matrix to allow dependence among individuals in the same cluster. It does not, by itself, change the Fine-Gray estimating equation or the coefficient estimate obtained by solving that equation. Thus it changes standard errors, confidence intervals, and tests, not the fitted subdistribution-hazard target.

Definition: Let \(g=1,\ldots,G\) index independent clusters, and let \(i\) index individuals within cluster \(g\). Write \(U_g(\beta)\) for the sum of the Fine-Gray score contributions from cluster \(g\), evaluated at coefficient vector \(\beta\). The cluster-robust sandwich covariance estimate is $$ \widehat{\mathrm{Var}}(\hat\beta) = \hat A^{-1} \left(\sum_{g=1}^{G} U_g(\hat\beta)U_g(\hat\beta)^\mathsf{T}\right) \hat A^{-\mathsf{T}}, $$ where \(\hat A\) is the negative derivative of the total estimating equation with respect to \(\beta\), evaluated at \(\hat\beta\).

In this definition, the score contributions are those from the Fine-Gray estimating procedure actually fitted, including its risk-set construction and any inverse-probability censoring weights. Cluster contributions are summed before forming the outer products. This is the key step: the variance allows contributions from people in the same cluster to covary. The bread, \(\hat A^{-1}\), describes how sensitive the coefficient estimate is to changes in the estimating equation; the middle, or meat, estimates the variability of that equation across independent clusters.

Assumptions and What the Estimator Does

Cluster-robust inference relies on a correctly specified Fine-Gray estimating target and on the conditions needed for that estimating equation to be valid. In particular, the subdistribution-hazard model must be suitable for the intended coefficient interpretation, and the censoring assumptions and any censoring-weight model must be adequate for the fitted procedure. The cluster sandwich adds further requirements: clusters are independent of one another, the number of independent clusters is sufficiently large for the approximation being used, and no single cluster dominates the total information. Dependence within a cluster need not follow a specified correlation pattern.

This is a large-number-of-clusters justification. A large number of individuals concentrated in only a few clinics does not provide the same support as a large number of independent clinics. With few clusters, the sandwich estimate can be unstable and the usual normal or chi-square reference distributions can give inaccurate tests. Software may offer small-sample corrections, but their form varies; report which correction and reference distribution were used rather than assuming that one universal correction applies.

Robust variance is not a cure for every problem. It does not fix a misspecified subdistribution-hazard model, invalid censoring weights, informative sampling, or confounding. Nor does it make clusters independent if dependence extends across them. If a cluster-level feature changes the conditional or marginal outcome structure so that the chosen Fine-Gray model no longer describes the intended target, changing the covariance estimate alone will not repair the coefficient interpretation.

Derivation of the Cluster Sandwich

The justification follows from a first-order expansion of the estimating equation. Suppose the fitted coefficient solves \(\sum_{g=1}^{G} U_g(\hat\beta)=0\). Expand this equation around the target coefficient \(\beta_0\). With \(\hat A\) defined as the negative derivative of the total score, the first-order approximation is

$$ 0 \approx \sum_{g=1}^{G}U_g(\beta_0)-A(\hat\beta-\beta_0), \qquad \hat\beta-\beta_0 \approx A^{-1}\sum_{g=1}^{G}U_g(\beta_0). $$

Because clusters are independent, the variance of the sum of their score contributions is the sum of their variances. Estimating each cluster's score variance by its outer product gives the meat \(\sum_g U_g(\hat\beta)U_g(\hat\beta)^\mathsf{T}\). Applying the linear transformation \(A^{-1}\) on the left and its transpose on the right yields the sandwich formula. Crucially, this argument treats each cluster sum as one independent contribution; it does not require people within a cluster to be independent.

For a single coefficient, the formula reduces to a scalar calculation. If \(A\) is the negative score derivative and \(U_g\) are the cluster scores, then

$$ \widehat{\mathrm{Var}}(\hat\beta) = \frac{\sum_{g=1}^{G}U_g^2}{A^2}, \qquad SE(\hat\beta) = \sqrt{\widehat{\mathrm{Var}}(\hat\beta)}. $$

Worked Calculations

Worked Example: A Cluster-robust Interval for a Fine-Gray Coefficient

Hypothetical data. Suppose a study follows patients at 12 clinics and fits a Fine-Gray model for time to a specified cause, with death from another cause treated as the competing event. The coefficient for a treatment indicator is \(\hat\beta=0.50\). After fitting the model, the summed Fine-Gray score contributions at each clinic are \(2,-1,1,-2\), with the remaining eight clinic contributions equal to zero. The negative score derivative is \(A=10\). These are illustrative cluster-level quantities, not patient-level observations.

The cluster scores sum to zero, as expected at a fitted solution: \(2-1+1-2=0\). Their squared sum is \(2^2+(-1)^2+1^2+(-2)^2=10\). Thus the cluster-robust variance and standard error are

$$ \widehat{\mathrm{Var}}(\hat\beta)=\frac{10}{10^2}=0.1000, \qquad SE(\hat\beta)=\sqrt{0.1000}=0.3162. $$

Using a large-sample normal reference, a 95% confidence interval for the log subdistribution-hazard ratio is \(0.50\pm1.96(0.3162)\), or \((-0.1198,1.120)\). Exponentiating the endpoints gives a 95% interval of approximately \((0.887,3.06)\) for the subdistribution-hazard ratio. In this hypothetical analysis, the interval includes 1, so the data do not provide evidence against a zero treatment coefficient at the two-sided 5% level using this approximation. The interval describes uncertainty in the subdistribution-hazard ratio, not a causal effect unless the study design and assumptions support a causal interpretation.

Worked Example: Why Cluster Membership Changes the Meat

Hypothetical data. Consider six individuals from a fitted Fine-Gray model, with individual score contributions \(2,-1,1,-2,1,-1\). Their total is zero, and suppose the negative score derivative for the coefficient is \(A=10\). These scores are used only to show how grouping affects the sandwich calculation.

If the individuals belong to three independent clusters with score pairs \((2,-1)\), \((1,-2)\), and \((1,-1)\), the cluster scores are \(1,-1,0\). The meat is \(1^2+(-1)^2+0^2=2\), giving variance \(2/100=0.0200\) and standard error \(0.1414\).

For a different cluster allocation, suppose the score groups are \((2,-1)\), \((1,1)\), and \((-2,-1)\). The cluster scores are \(1,2,-3\); their sum is again zero, but the meat is \(1^2+2^2+(-3)^2=14\). The variance is \(14/100=0.1400\), and the standard error is \(0.3742\). The individual scores and fitted coefficient equation have not changed; the cluster-level dependence pattern changes the estimated uncertainty. In an actual analysis, cluster membership comes from the study design, not from a choice made to obtain a preferred variance.

Worked Example: A Robust Test of a Coefficient Contrast

Hypothetical data. A Fine-Gray model includes treatment and age, with estimated coefficients \(\hat\beta_T=0.40\) and \(\hat\beta_A=-0.20\). Suppose the cluster-robust covariance matrix is

$$ \widehat{\mathrm{Var}}(\hat\beta) = \begin{pmatrix} 0.09 & 0.02\\ 0.02 & 0.04 \end{pmatrix}. $$

For the contrast \(\beta_T+\beta_A\), the estimate is \(0.40-0.20=0.20\). Its variance includes the covariance term: \(\widehat{\mathrm{Var}}(\hat\beta_T+\hat\beta_A)=0.09+0.04+2(0.02)=0.1700\). Therefore, its standard error is \(\sqrt{0.1700}=0.4123\), and the Wald statistic for \(H_0:\beta_T+\beta_A=0\) is \(z=0.20/0.4123=0.4851\). The two-sided normal-reference p-value is approximately \(0.628\). This calculation gives little evidence against the specified contrast being zero; it does not establish that the contrast is zero. With few independent clusters, the normal reference may be unreliable even when the arithmetic is correct.

Comparison, Diagnostics, and Limitations

The model-based variance uses the covariance structure implied by the fitted model, typically relying on independence across individuals conditional on included covariates. It can be more efficient when that structure is correct, but may be misleading when within-cluster dependence is ignored. The cluster sandwich relaxes that within-cluster independence requirement while retaining the same coefficient estimate and model-based subdistribution-hazard target. It is not a competing risk model of its own, and it does not replace the Fine-Gray risk-set or censoring-weight calculations.

A cluster bootstrap is another possible approach: repeatedly resample whole clusters, refit the model, and use the resulting coefficient distribution to quantify uncertainty. Resampling whole clusters preserves within-cluster groupings, but it also depends on having enough independent clusters and can be computationally demanding. It does not automatically solve a misspecified model or invalid censoring assumptions. The cluster sandwich is a direct large-sample calculation; the bootstrap is a resampling procedure, not a guarantee of valid inference in a small-cluster setting.

Useful checks include confirming that the software used the intended cluster identifier, that it summed score contributions at the cluster level, and that the reported coefficient estimates match the ordinary Fine-Gray fit when only the variance option changes. Examine the number and sizes of clusters, and inspect cluster-level score contributions or influence diagnostics for a small number of dominant groups. A very large difference between model-based and robust standard errors is a reason to investigate dependence and influential clusters, not a reason to select whichever result is more convenient.

One subtlety arises when Fine-Gray censoring weights are estimated from data. The variance calculation must be appropriate for that fitting procedure. Depending on the method, uncertainty from estimating the censoring distribution may need to be incorporated into the influence contributions or otherwise handled by the variance implementation. A generic sandwich based only on unadjusted score contributions may not capture all relevant variation. Cluster-robust standard errors also do not repair a censoring-weight model that fails to represent the censoring process.

Common Mistake

Common mistake: “The robust standard error is larger, so the fitted Fine-Gray coefficient must have changed or the model now estimates a different hazard.” This is incorrect. A cluster-robust variance calculation replaces the estimated covariance of the coefficient; when the estimating equation is unchanged, its solution \(\hat\beta\) and fitted subdistribution-hazard target are unchanged. The standard error, confidence interval, and test may change because the uncertainty calculation now allows within-cluster dependence.

The distinction matters for reporting. State the coefficient estimate and target in the same way as in the Fine-Gray fit, then identify the cluster-robust standard error and the clustering unit. Also state the inferential approximation or small-sample correction used. Do not interpret a robust standard error as evidence that the model's assumptions about the mean structure or censoring have been validated.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. What changes, and what remains unchanged, when a cluster-robust variance is applied to an otherwise unchanged Fine-Gray fit?
  2. For one coefficient, the negative score derivative is \(A=5\), and the three cluster scores are \(1,-2,1\). Calculate the sandwich variance and standard error.
  3. Why is it generally incorrect to form the meat by squaring each individual score and summing those squares when individuals are clustered?
  4. Name two problems that cluster-robust variance does not fix.

Solutions. (1) The estimated covariance, standard errors, intervals, and tests may change; the coefficient estimate and fitted target stay the same if the estimating equation is unchanged. (2) The meat is \(1^2+(-2)^2+1^2=6\), so the variance is \(6/5^2=0.2400\) and the standard error is \(\sqrt{0.2400}=0.4899\). (3) The cluster sandwich first sums scores within each cluster and then forms the outer products; individual-level squares omit the cross-products that represent within-cluster dependence. (4) Examples include a misspecified subdistribution-hazard model, invalid censoring weights, too few independent clusters for reliable large-sample inference, and dependence between clusters.

Clinical Biostats