Tutorials › Competing Risks and Multi-State Models › Frailty Versus Cluster-Robust Standard Errors

Frailty and Clustered Events · Tutorial 626 of 699

Frailty Versus Cluster-Robust Standard Errors

Learn when frailty models and cluster-robust standard errors answer different questions, and how to interpret their coefficients, assumptions, uncertainty, and predictions.

Advanced 10 min read

What You'll Learn

  • Distinguish modeling cluster heterogeneity with frailty from adjusting standard errors for clustered observations.
  • Identify the assumptions behind a multiplicative frailty model and a cluster-robust sandwich variance.
  • Calculate a scalar cluster-robust standard error from cluster-level score contributions.
  • Explain why conditional frailty effects and marginal effects need not be equal.
  • Recognize what each approach can and cannot provide for prediction.

Two Different Responses to Clustered Event Data

When event outcomes from individuals in the same cluster are related, treating every individual as independent can give misleading uncertainty estimates. A cluster might be a clinic, household, or other group whose members share unmeasured influences. Two common approaches address this issue, but they do not do the same thing. A frailty model represents unobserved cluster heterogeneity as a random effect in the event model. Cluster-robust standard errors adjust uncertainty estimates for dependence among observations within a cluster, while leaving the fitted mean or hazard model in place.

The distinction matters for more than standard errors. A frailty model has assumptions about the distribution and role of latent cluster effects and can support predictions that incorporate such heterogeneity. A robust variance estimator does not specify a distribution of cluster effects, change the fitted coefficients, or create cluster-specific predictions. The earlier material on Conditional and Marginal Covariate Effects is relevant here: a coefficient conditional on a frailty value need not describe the corresponding population-marginal association.

Definition: A frailty model includes a latent random effect that multiplies an individual's hazard, often with a shared frailty for members of the same cluster. A cluster-robust variance estimator uses cluster-level contributions to an estimating equation to estimate the variance of its coefficient estimator while allowing dependence within, but not between, clusters.

Models, Targets, and Assumptions

For illustration, consider clusters \(i=1,\ldots,m\), with individuals \(j\) in cluster \(i\). A shared multiplicative frailty model can be written

$$ \lambda_{ij}(t\mid Z_i,X_{ij}) =Z_i\lambda_0(t)\exp(\beta^\top X_{ij}). $$

Here \(Z_i>0\) is the frailty shared by members of cluster \(i\), \(\lambda_0(t)\) is the baseline hazard, and \(X_{ij}\) is a covariate vector. A common scale convention is \(E(Z_i)=1\); the distribution of \(Z_i\), such as a gamma distribution, determines its remaining variation. Conditional on \(Z_i\) and the modeled covariates, event histories are typically assumed independent within a cluster. Clusters are assumed independent of one another, and the frailty distribution and event model must be sufficiently specified for likelihood-based estimation.

The coefficient \(\beta\) describes the covariate association conditional on the frailty. For a one-unit increase in covariate \(k\), holding other covariates and \(Z_i\) fixed, the conditional hazard ratio is \(\exp(\beta_k)\). Integrating over the frailty distribution generally changes the marginal hazard, so \(\exp(\beta_k)\) is not automatically a population-marginal hazard ratio.

A cluster-robust estimator instead starts with an estimating equation, such as a score equation, and groups its contributions by independent cluster. Let \(U_i(\beta)\) be the vector contribution from cluster \(i\), and let \(\hat\beta\) solve \(\sum_{i=1}^m U_i(\hat\beta)=0\). The robust variance uses the observed cluster contributions to estimate variability across clusters. It does not require a particular within-cluster correlation distribution, but it does require enough independent clusters for its large-sample approximation and a suitable estimating equation for the coefficient target of interest.

Key distinction: Frailty changes the model for the event process by representing latent heterogeneity. A cluster-robust variance changes the estimated uncertainty for a chosen coefficient estimator; by itself, it does not model that heterogeneity or change the coefficient's estimand.

Why the Cluster-Robust Sandwich Has Two “Bread” Factors

For a general estimating equation, define the sensitivity matrix as \(A=-\partial\sum_i U_i(\beta)/\partial\beta^\top\), evaluated at \(\hat\beta\), and define \(B=\sum_i U_i(\hat\beta)U_i(\hat\beta)^\top\). Under regularity conditions, independent clusters, and a nonsingular \(A\), linearizing the estimating equation around the target gives an approximate coefficient error equal to \(A^{-1}\) times the summed cluster-score error. The covariance of that summed error is estimated by \(B\). Applying the covariance rule for a linear transformation gives

$$ \widehat{\operatorname{Var}}(\hat\beta) =A^{-1} \left(\sum_{i=1}^m U_i(\hat\beta)U_i(\hat\beta)^\top\right) (A^{-1})^\top. $$

The transpose on the right is essential for a general estimating equation: \(A\) need not be symmetric. In likelihood settings, the relevant information or Hessian is often symmetric, in which case the expression may simplify. The cluster contributions must be summed within clusters before forming the outer products; treating each individual as its own contribution would discard the dependence the estimator is meant to accommodate.

Worked Example: Calculating a Cluster-Robust Standard Error

Suppose a fitted one-coefficient event model has estimate \(\hat\beta=0.40\). There are five independent clusters, and their score contributions at the estimate are \(2,-1,3,-2,-2\). The sensitivity is \(A=20\). Treat these as hypothetical values from a correctly specified estimating equation, and use the uncorrected sandwich estimator.

Check the setup. The cluster scores sum to zero: \(2-1+3-2-2=0\), as expected at a fitted root up to numerical precision. The calculation assumes independence across the five clusters; dependence within each cluster is represented by using one score contribution per cluster. With only five clusters, the asymptotic approximation is fragile, so the result is illustrative rather than a recommendation to rely on the uncorrected standard error.

Calculate the variability term. In one dimension, each outer product is the squared score: \(B=2^2+(-1)^2+3^2+(-2)^2+(-2)^2=4+1+9+4+4=22\). Thus

$$ \widehat{\operatorname{Var}}(\hat\beta) =\frac{22}{20^2}=0.0550, \qquad SE(\hat\beta)=\sqrt{0.0550}=0.2345. $$

A large-sample Wald statistic for \(H_0:\beta=0\) is \(z=0.40/0.2345=1.706\), giving a two-sided normal-approximation \(p\)-value of about \(0.088\). At the 5% significance level, this calculation does not reject \(H_0\). It does not show that the null is true. The standard error and test concern this fitted coefficient under the estimating equation and cluster-level approximation, not a frailty distribution or a cluster-specific effect.

Frailty and Prediction: A Numerical Illustration

A frailty model can use its specified distribution to integrate over latent heterogeneity for a marginal prediction. For gamma frailty with mean one and variance \(\theta\), the marginal survival for a covariate value \(x\) is \(S_m(t\mid x)=\{1+\theta\Lambda_0(t)\exp(\beta x)\}^{-1/\theta}\), where \(\Lambda_0(t)\) is the baseline cumulative hazard. This prediction depends on the frailty model, not merely on a robust standard error.

Worked Example: Marginal Survival Versus a Robust Standard Error

Suppose, hypothetically, that \(\theta=0.5\), \(\Lambda_0(2)=0.20\) per two-year interval, and \(\beta=0.40\) for a binary covariate. Consider \(x=1\), and suppose the fitted conditional hazard model is otherwise appropriate. We compare survival at two years from the gamma-frailty model with survival at frailty \(Z=1\).

The relative hazard is \(\exp(0.40)=1.4918\), so the conditional cumulative hazard at \(Z=1\) is \(0.20(1.4918)=0.2984\). Conditional survival is therefore \(S(2\mid Z=1,x=1)=\exp(-0.2984)=0.7420\).

For the population-marginal prediction, integrate over the specified gamma frailty:

$$ S_m(2\mid x=1) =\{1+0.5(0.20)(1.4918)\}^{-2} =(1.1492)^{-2} \approx 0.7572. $$

The marginal survival is about \(0.7572\), or 75.7%, compared with about 74.2% conditional on \(Z=1\). These are predictions under the stated model, not observed proportions. A cluster-robust standard error for \(\hat\beta\) could quantify uncertainty for a coefficient estimate, but it cannot supply this integration over frailty or predict a particular cluster's latent hazard.

Different Coefficients Can Answer Different Questions

The difference between conditional and marginal effects can be explicit even when the frailty model is correct. Under gamma frailty with mean one and variance \(\theta\), the marginal hazard at covariate value \(x\) is

$$ \lambda_m(t\mid x) =\frac{\lambda_0(t)\exp(\beta x)} {1+\theta\Lambda_0(t)\exp(\beta x)}. $$

This follows by averaging the conditional hazard over the frailty distribution among individuals who have survived to time \(t\). That surviving group is no longer an unselected sample of frailties: higher-frailty individuals tend to experience events earlier. Consequently, the marginal hazard ratio can vary with time even when the conditional hazard ratio is constant.

Worked Example: Conditional and Marginal Hazard Ratios

Assume a gamma frailty model with \(\theta=0.5\), conditional coefficient \(\beta=0.60\), and \(\Lambda_0(t)=0.40\) at a specified time. Suppose the covariate is binary and the frailty distribution is the same in both covariate groups. The conditional hazard ratio comparing \(x=1\) with \(x=0\) is \(\exp(0.60)=1.8221\).

Using the marginal hazard expression, the marginal hazard ratio at this time is

$$ \frac{\lambda_m(t\mid 1)}{\lambda_m(t\mid 0)} =\exp(0.60) \frac{1+0.5(0.40)} {1+0.5(0.40)\exp(0.60)} =\frac{1.8221(1.20)}{1+0.3644} =\frac{2.1865}{1.3644} \approx 1.603. $$

Thus the conditional hazard ratio is about 1.822, while the model-implied marginal hazard ratio at this time is about 1.603. The attenuation here is a consequence of frailty selection under the specified model. Replacing a model-based standard error with a cluster-robust one would not convert the conditional coefficient into this marginal effect.

What Each Approach Requires and What Can Go Wrong

QuestionFrailty modelCluster-robust standard errors
How is dependence handled?Through a modeled latent cluster effect and its distribution.Through cluster-level score contributions in the variance estimate.
Does the method change the fitted coefficient?Usually yes, because the likelihood or estimating model includes frailty.No, when applied after fitting the same estimating equation.
What assumptions are central?Frailty distribution, hazard structure, conditional event model, and independent clusters.Independent clusters, a suitable estimating equation, and enough clusters for the approximation.
Can it yield latent cluster predictions?Potentially, with the model and additional prediction steps.No; a variance correction alone does not model latent cluster effects.

Neither approach is automatically preferable. Frailty is useful when latent heterogeneity is part of the scientific model and predictions require a distribution for it, but results can depend on distributional and hazard assumptions. Cluster-robust variance is useful when the coefficient estimating equation is the desired analysis and inference should allow unspecified within-cluster dependence. It does not repair a misspecified mean or hazard structure, remove confounding, or guarantee a scientifically meaningful coefficient.

A particularly important issue is the number of independent clusters. The sandwich estimator relies on the clusters, not the individuals, supplying the independent information for its large-sample approximation. Many individuals in only a few clusters do not make the number of independent clusters large. Small-sample corrections or methods designed for few clusters may be needed, and ordinary robust standard errors can be downward biased. If clusters are dependent on one another, the stated cluster-level independence assumption also fails.

Frailty models have their own failure modes. A poorly supported frailty distribution, inadequate event-time structure, or dependence remaining after conditioning on frailty can invalidate the model. A shared random effect may not capture every source of association. Moreover, the frailty scale and baseline hazard can be difficult to distinguish without adequate information; an estimated frailty variance should not be treated as reliable simply because the model converged.

Common Mistakes and Practical Checks

  • Calling a robust variance a dependence model. It changes estimated uncertainty, not the fitted hazard or dependence-generating mechanism. Use a frailty model if latent heterogeneity itself is the target of modeling.
  • Assuming robust standard errors fix a wrong coefficient model. They do not fix a misspecified hazard form, omitted covariates, informative observation processes, or a mismatch between the coefficient and scientific estimand.
  • Interpreting a frailty coefficient as marginal. In the multiplicative model, \(\exp(\beta_k)\) is a conditional hazard ratio. Marginal effects generally require integrating over frailty and can vary over time.
  • Counting individuals instead of clusters for robust inference. The number of independent clusters governs the key large-sample approximation. Inspect the number and sizes of clusters before trusting a sandwich standard error.
  • Using individual score contributions in place of cluster totals. Aggregate scores within cluster first, then form the outer products. Otherwise within-cluster dependence is not reflected in the variance calculation.

A useful diagnostic workflow is to identify the coefficient target first, check how many independent clusters are available, and inspect whether the assumptions for the chosen model are plausible. Compare estimates from a frailty model and a working model with robust variance only with care: differences may reflect different estimands and model assumptions, not simply one method correcting the other's standard error.

Key takeaway: Frailty models represent latent cluster variation and can distinguish conditional from marginal predictions. Cluster-robust standard errors protect uncertainty estimates against within-cluster dependence under suitable conditions, but do not alter the coefficient, specify a frailty distribution, or produce cluster-specific predictions.

Check Your Understanding

Answer each question, then check the brief solutions.

  1. A frailty model estimates a conditional hazard ratio of 1.5. Does a cluster-robust standard error turn it into a marginal hazard ratio?
  2. Why are cluster score contributions summed before calculating the sandwich “meat”?
  3. What is the main large-sample unit for a cluster-robust variance estimator: individuals or independent clusters?
  4. Can a robust variance estimator alone provide a prediction for the latent hazard of a particular cluster?

Solutions. (1) No. It changes the estimated variance, not the coefficient or its conditional interpretation; a marginal effect requires marginalizing under an appropriate model. (2) Summing first preserves within-cluster dependence in the cluster's total contribution. (3) Independent clusters. (4) No. It supplies an uncertainty adjustment for a coefficient estimator, not a distribution or estimate of cluster frailty.

Clinical Biostats