Why Related Participants Require Clustered Inference
Genetic association analyses often include participants who are related: siblings, parent–offspring pairs, or members of extended families. Even after adjusting for measured covariates, relatives may have correlated outcomes because they share genes, environments, or both. Treating every participant as independent can then make standard errors too small and evidence against a null hypothesis appear stronger than it is.
Cluster-robust inference addresses this problem by treating each family, or other prespecified group, as an independent unit while allowing observations within that unit to be dependent. It changes the estimated uncertainty, not the fitted regression coefficient. It is a variance adjustment, not a model of the detailed pattern of genetic resemblance.
The Cluster Sandwich Variance
Suppose a regression model has coefficient vector \(\beta\), participant-level covariate vector \(x_{ig}\), and response \(y_{ig}\), where \(i\) indexes participants within cluster \(g\). For a linear model, write \(y_{ig}=x_{ig}^{\mathsf T}\beta+\varepsilon_{ig}\). The model for the mean should be appropriate for the scientific question; the errors \(\varepsilon_{ig}\) need not be independent within a cluster. For logistic regression, the response is binary and the mean is modeled with a logistic link, but the same cluster-level sandwich principle applies.
For ordinary least squares, let \(X_g\) be the design matrix for cluster \(g\), and let \(\hat e_g\) be the vector of fitted residuals in that cluster. The cluster score is \(u_g=X_g^{\mathsf T}\hat e_g\). The uncorrected cluster sandwich covariance estimator is:
The two outer factors are the regression “bread,” and the middle sum is the “meat.” A cluster contributes one outer product of its total score, rather than separate outer products for each participant. Consequently, products involving residuals from different members of the same family are retained. If the clusters are independent, there are no corresponding covariance terms between different families.
In a general regression estimated by an estimating equation, let \(U_g(\beta)\) be the sum of the individual estimating-equation contributions in cluster \(g\). Define \(A\) as the negative derivative of the total estimating equation with respect to \(\beta\), evaluated at the fitted coefficient. The analogous estimator is:
For ordinary least squares, \(A=X^{\mathsf T}X\) and \(U_g(\hat\beta)=X_g^{\mathsf T}\hat e_g\), giving the formula above. In logistic regression, the cluster scores replace the least-squares residual scores and the bread is obtained from the fitted model’s sensitivity matrix. The same construction applies: sum scores within each family, take their outer products, and place that meat between the two bread factors.
Why the Formula Works
The justification is a first-order approximation to the estimating equation. At the fitted value, the total score is zero. Expanding it around the true coefficient gives an approximate relationship between coefficient error and the sum of the independent cluster scores:
Because distinct clusters are independent, the variance of the sum is the sum of the cluster score variances. Replacing those unknown variances by the observed outer products \(U_g(\hat\beta)U_g(\hat\beta)^{\mathsf T}\) yields the middle of the sandwich. The approximation is justified asymptotically as the number of independent clusters grows, under regularity conditions such as a correctly specified estimating equation for the target mean, a nonsingular bread matrix, finite score variances, and no cluster dominating the total information. The within-cluster covariance need not follow a particular parametric form.
This large-cluster justification is crucial. A large participant count does not by itself guarantee accurate cluster-robust inference: 1,000 participants from five families still provide only five independent clusters for this approximation. Small-sample corrections and reference distributions vary across software and methods; they can help in some settings but cannot create independent information that the study did not collect.
Worked Example: A Linear Genotype Association With Three Families
Hypothetical data. Suppose six participants come from three independent families, with two participants per family. Regress a continuous outcome \(y\) on an intercept and a genotype dosage \(x\), measured as 0 or 1 in these illustrative data. The observations are:
| Family | Genotype dosages | Outcomes | Fitted residuals |
|---|---|---|---|
| 1 | 0, 1 | 3.0, 1.5 | 1, −1 |
| 2 | 0, 1 | 1.0, 3.5 | −1, 1 |
| 3 | 0, 1 | 2.0, 2.5 | 0, 0 |
The fitted line is \(\hat y=2+0.5x\). For example, at \(x=0\), the mean outcome is \((3+1+2)/3=2\); at \(x=1\), it is \((1.5+3.5+2.5)/3=2.5\). Thus the fitted genotype coefficient is \(0.5\) outcome units per dosage. The listed residuals are observed outcome minus fitted outcome, and they sum to zero across all participants.
For each family, calculate the two components of the score \(u_g=X_g^{\mathsf T}\hat e_g\), corresponding to the intercept and dosage. Family 1 has \(u_1=(1-1,\;0(1)+1(-1))^{\mathsf T}=(0,-1)^{\mathsf T}\). Family 2 has \(u_2=(-1+1,\;0(-1)+1(1))^{\mathsf T}=(0,1)^{\mathsf T}\). Family 3 has \(u_3=(0,0)^{\mathsf T}\). Therefore:
The genotype-coefficient variance is the lower-right element of the sandwich. The genotype row of the inverse bread is \((-1/3,\;2/3)\), so the variance is:
This calculation shows how the family score, rather than each person’s score separately, enters the variance estimate. It does not support trustworthy large-sample inference: there are only three independent families. The standard error is shown to illustrate the calculation, not to endorse a p-value or confidence interval from so few clusters.
Cluster Scores in Logistic Association Regression
For a binary trait, a common association model uses logistic regression with an intercept, genotype dosage, and any chosen covariates. Each family’s score is a vector, with one component for each fitted coefficient. The next example uses hypothetical intermediate output from such a fit to make the matrix calculation explicit. It illustrates the variance formula; the small number of clusters means the resulting standard error should not be treated as reliable inferential evidence.
Worked Example: A Logistic Model’s Genotype Standard Error
Suppose a hypothetical logistic regression has an intercept and one genotype coefficient. At the fitted values, assume its bread is \(A=\begin{pmatrix}20&0\\0&8\end{pmatrix}\), and the three family score vectors are \(U_1=(1,2)^{\mathsf T}\), \(U_2=(-1,1)^{\mathsf T}\), and \(U_3=(0,-3)^{\mathsf T}\). The score vectors sum to zero, as expected at a fitted maximum-likelihood solution. These are illustrative model outputs, not observations from a real study.
The cluster-score meat is the sum of their outer products:
Since \(A^{-1}=\begin{pmatrix}1/20&0\\0&1/8\end{pmatrix}\), the genotype-coefficient variance is the lower-right element of \(A^{-1}(\sum_gU_gU_g^{\mathsf T})A^{-1}\):
The genotype coefficient in logistic regression is on the log-odds scale, so its standard error is also on that scale. Exponentiating the coefficient gives an odds ratio per dosage, but this example does not establish a reliable test: the calculation uses only three independent clusters.
How Many Clusters Are Enough?
There is no universal cutoff at which cluster-robust inference suddenly becomes reliable. Accuracy depends on the number of independent clusters, their size distribution, the leverage of individual clusters, and the design and model. As a practical principle, inference becomes more credible as \(G\) grows and no single family supplies a large share of the information. With few clusters, conventional sandwich standard errors can be biased downward, and normal-reference tests or intervals can be poorly calibrated. Report both \(n\) and \(G\), and check the small-sample method used by the analysis software rather than assuming that its default solves a small-cluster problem.
A simple design-effect calculation gives intuition for why clustering matters, although it is not a substitute for the regression sandwich. If equal-sized clusters each contain \(m\) observations and every pair within a cluster has outcome correlation \(\rho\), the variance of a sample mean is inflated relative to independent observations by the factor \(1+(m-1)\rho\). For example, with \(m=5\) and \(\rho=0.20\), this factor is \(1+4(0.20)=1.8\). The corresponding rough effective sample size for \(n=200\) is \(200/1.8\approx111\), not 200. This approximation relies on equal cluster sizes and exchangeable within-cluster correlation; actual genetic association analyses may have more complex dependence.
What Clustering Does—and Does Not—Represent
Family-clustered standard errors are useful when families can reasonably be treated as independent of one another and the main concern is dependence among participants within each family. They protect the estimated uncertainty against an unspecified within-family covariance pattern, asymptotically, while retaining the chosen regression model’s coefficient estimate.
But a cluster label is not a genetic covariance model. If participants in different recorded families are genetically related, or if degrees of relatedness vary substantially within a family, a single family indicator does not encode those pairwise relationships. Cluster-robust inference also does not repair a misspecified mean model, confounding, population structure, or a biased genotype effect estimate. Where the scientific analysis requires covariance to reflect degrees of genomic relatedness, a method that explicitly represents that covariance is needed; merely grouping observations into families is not equivalent.
Common Mistakes
- Counting participants instead of independent clusters. The sandwich’s large-sample justification concerns \(G\), not just \(n\). Many relatives in a handful of families do not provide the same independent information as the same number of unrelated participants.
- Summing individual outer products. Computing \(\sum_{ig}u_{ig}u_{ig}^{\mathsf T}\) treats people as independent. The cluster meat is \(\sum_g U_gU_g^{\mathsf T}\), where \(U_g\) first sums the individual scores within family.
- Assuming robust means assumption-free. The procedure permits general within-cluster dependence, but still requires independent clusters, a suitable estimating equation for the target, and enough clusters for its approximation to be credible.
- Claiming that clustering models kinship. Cluster-robust standard errors adjust uncertainty for clustering; they do not estimate a genetic covariance matrix or automatically correct other sources of bias.
Check Your Understanding
Use these questions to check both the calculation and its assumptions.
- In the cluster sandwich, why is the score summed within a family before taking its outer product?
- A study has 600 participants from 12 families. Which number is \(G\), and why does the participant count alone not guarantee reliable inference?
- In the linear example, what are the three family score vectors, and how do they contribute to the genotype-coefficient variance?
- What does the genotype coefficient’s standard error measure in the hypothetical logistic example?
- Give one situation in which family-clustered standard errors do not adequately represent genetic covariance.