Tutorials › High-Dimensional Genomic Data Analysis › Adjusting for Ancestry With Principal Components

Population Structure, Ancestry and Relatedness · Tutorial 111 of 795

Adjusting for Ancestry With Principal Components

Use genotype principal components as covariates in association models, interpret the adjusted effect, and assess the assumptions and limits of this strategy.

Intermediate 12 min read

What You'll Learn

  • Write a genetic association model that includes genotype principal components as ancestry covariates.
  • Explain how principal-component adjustment can reduce confounding from broad ancestry differences.
  • Calculate an adjusted genotype coefficient by residualizing genotype and outcome on the covariates.
  • Check whether a small example’s residuals are consistent with the required orthogonality.
  • Interpret adjusted effects and intervals in context without making causal claims.
  • Recognize limits including inadequate ancestry representation, collinearity, and model misspecification.

Why Include Principal Components in an Association Model?

A genetic association can reflect ancestry differences rather than an effect of the genetic variant under study. If allele frequencies differ across ancestry groups, and the outcome also differs across those groups for environmental, social, or other genetic reasons, the variant and outcome may be associated even when the variant has no within-ancestry association with the outcome. This is the confounding problem described in the earlier material on ancestry confounding.

Genotype principal components (PCs) provide a compact representation of broad patterns of genetic variation among the sampled individuals. Including selected PCs as covariates aims to compare individuals who are more similar on those represented ancestry axes. The result is an association estimate conditional on the included PCs, not a guarantee that every source of population structure has been removed.

The Adjusted Association Model

Definition: For a quantitative outcome \(Y_i\), a genotype dosage \(G_i\) for individual \(i\), and the first \(K\) genotype PCs \(PC_{i1},\ldots,PC_{iK}\), the linear PC-adjusted association model is $$ Y_i=\beta_0+\beta_G G_i+\sum_{k=1}^{K}\gamma_k PC_{ik}+\epsilon_i. $$ Here \(G_i\) is usually the number of copies of a specified allele, coded 0, 1, or 2; \(\beta_G\) is the genotype association conditional on the included PCs; and \(\gamma_k\) is the coefficient for PC \(k\), holding the other model terms fixed.

For this model, the standard linear-regression assumptions include a correctly specified conditional mean, independent observations, and errors with mean zero conditional on genotype and PCs. The usual exact small-sample \(t\)-based inference additionally assumes normally distributed errors with constant variance; with large samples, robust standard errors may be used when their conditions are met. If \(Y_i\) is binary, a logistic regression can include the same genotype and PC terms, but the genotype coefficient is then a conditional log odds ratio, not a difference in outcome units.

The PC-adjusted coefficient is useful for controlling broad ancestry confounding when the included PCs adequately represent the ancestry variation that jointly relates to genotype and outcome, and the model represents the relevant relationships sufficiently well. The estimate also requires enough genotype variation at comparable PC values to distinguish the genotype term from the ancestry terms. If genotype and PCs are perfectly collinear, their separate effects cannot be estimated. If they are nearly collinear, the estimate may be unstable and imprecise.

How Adjustment Changes the Genotype Coefficient

In linear regression, the Frisch–Waugh–Lovell result gives a direct way to understand PC adjustment. First regress the outcome on an intercept and the selected PCs, and retain its residuals. Separately regress the genotype on the same intercept and PCs, and retain its residuals. Regressing the first residual vector on the second gives the same genotype coefficient as the full regression of outcome on genotype, intercept, and PCs. In effect, the model compares the parts of outcome and genotype not linearly explained by those covariates.

Key result: If \(\widetilde{Y}\) and \(\widetilde{G}\) are the residual vectors after projecting \(Y\) and \(G\) onto the intercept and included PCs, then $$ \widehat{\beta}_G= \frac{\sum_i \widetilde{G}_i\widetilde{Y}_i} {\sum_i \widetilde{G}_i^2}, \qquad \text{provided } \sum_i\widetilde{G}_i^2>0. $$

The positive denominator condition says there must be genotype variation left after accounting for the PCs. The residuals are orthogonal to the covariates used in each projection: their inner products with the intercept and each included PC equal zero. This identity describes the coefficient calculation; it does not by itself establish that the PCs suffice to control confounding.

Worked Example: Removing a Broad Ancestry Association

Consider four hypothetical individuals with a quantitative outcome \(Y\), genotype dosage \(G\), and one ancestry PC. Suppose the PC and genotype values are \((-1,-1,1,1)\) and \((0,1,1,2)\), respectively. Suppose the outcomes are \((5,7,15,17)\). These data follow \(Y=9+2G+4PC\) exactly, so the constructed conditional genotype coefficient is 2 outcome units per additional allele dosage unit.

The unadjusted slope includes the association between genotype and PC. The means are \(\bar{G}=1\) and \(\bar{Y}=11\). Thus $$ \widehat{\beta}_{G,\mathrm{unadjusted}} =\frac{\sum_i(G_i-\bar{G})(Y_i-\bar{Y})} {\sum_i(G_i-\bar{G})^2} =\frac{(-1)(-6)+(0)(-4)+(0)(4)+(1)(6)} {(-1)^2+0^2+0^2+1^2} =\frac{12}{2}=6. $$ The unadjusted association is 6 outcome units per dosage unit, not the conditional value of 2.

For the adjusted coefficient, first center the vectors. The centered genotype is \((-1,0,0,1)\), and the centered outcome is \((-6,-4,4,6)\). Regressing each on the PC, whose centered sum of squares is 4, gives projection slopes $$ \frac{(-1)(-1)+(-1)(0)+(1)(0)+(1)(1)}{4}=\frac{2}{4}=0.5 \quad\text{and}\quad \frac{(-1)(-6)+(-1)(-4)+(1)(4)+(1)(6)}{4}=\frac{20}{4}=5. $$ Therefore the residuals are \(\widetilde{G}=(-0.5,0.5,-0.5,0.5)\) and \(\widetilde{Y}=(-1,1,-1,1)\). Their inner product is 2 and the genotype residual sum of squares is 1, so \(\widehat{\beta}_G=2/1=2\). The PC-adjusted coefficient recovers the conditional association specified in these hypothetical data. The example has no random error and does not demonstrate that adjustment will remove confounding in an actual study.

Worked Example: Checking Residual Orthogonality

Suppose, in a second hypothetical calculation, the PC values are \((-1,1,-1,1)\). After regressing the outcome and genotype on an intercept and this PC, suppose the residual vectors are \(\widetilde{Y}=(-1,-1,1,1)\) and \(\widetilde{G}=(-0.5,-0.5,0.5,0.5)\). Check that these vectors are valid residuals for that projection and calculate the adjusted genotype coefficient.

Both vectors sum to zero, so each is orthogonal to the intercept. Their inner products with the PC are $$ \widetilde{Y}^{\mathsf T}PC=(-1)(-1)+(-1)(1)+(1)(-1)+(1)(1)=1-1-1+1=0, $$ $$ \widetilde{G}^{\mathsf T}PC=(-0.5)(-1)+(-0.5)(1)+(0.5)(-1)+(0.5)(1)=0.5-0.5-0.5+0.5=0. $$ Thus both residual vectors are orthogonal to the intercept and PC, as required. The numerator is $$ \sum_i\widetilde{G}_i\widetilde{Y}_i =(0.5)+(0.5)+(0.5)+(0.5)=2, $$ and the denominator is $$ \sum_i\widetilde{G}_i^2=4(0.5^2)=1. $$ Therefore the PC-adjusted coefficient is \(2/1=2\) outcome units per dosage unit. Orthogonality is a necessary check on the stated residuals; it is not enough to show that the statistical model’s confounding assumptions hold.

Worked Example: Interpreting an Adjusted Estimate

Suppose a hypothetical linear association analysis of gene expression reports \(\widehat{\beta}_G=0.35\) with \(SE=0.12\), after including selected genotype PCs and other prespecified covariates. Assume expression is measured on a log base 2 scale, genotype is coded as allele dosage, and the large-sample normal approximation is appropriate.

The estimated association is an increase of 0.35 log2 expression units per additional allele dosage unit, conditional on the included covariates. A 95% approximate confidence interval is $$ 0.35\pm 1.96(0.12)=0.35\pm 0.2352=(0.1148,0.5852). $$ Under repeated sampling and the model assumptions, this interval procedure would cover the conditional coefficient about 95% of the time. It does not mean there is a 95% probability that this fixed coefficient lies in this particular interval. The estimate and interval describe association conditional on the model; they do not establish that changing the genotype would cause the expression difference.

Assumptions, Diagnostics, and Alternatives

PC adjustment is most defensible when the PCs are estimated from genotype data that represent the study sample’s broad ancestry variation, the chosen components capture the confounding-relevant directions, and the association model accommodates the way ancestry relates to outcome. The number of PCs is a modeling choice: too few may leave important broad structure unrepresented, while adding many can reduce precision, absorb genotype variation, or adjust for variation that is not a confounder. The PCs should be chosen using a reasoned analysis plan rather than selected solely to produce a preferred association result.

A useful diagnostic is to compare genotype-effect estimates and their uncertainty under prespecified models with and without PC covariates, while also checking that genotype variation remains after adjustment. A substantial coefficient change can be consistent with confounding control, but is not proof that confounding has been eliminated. Conversely, a small change is not proof that ancestry is irrelevant. Residual ancestry patterns may remain, and detailed diagnosis of those patterns is a separate task. Instability, large standard errors, or near-zero residual genotype variation can signal that genotype and PCs are difficult to separate in the available sample.

PC covariates are not the only strategy. An ancestry-stratified analysis estimates associations within groups and can make comparisons less dependent on between-group differences, but may lose precision and requires adequate within-group genotype variation. A study design that recruits comparable ancestry groups or uses within-family comparisons can address some sources of confounding by design, though each has its own sampling and generalizability constraints. More complex models can represent additional dependence or structure, but they require their own assumptions and are not automatically superior. The choice should follow the scientific question, sample structure, and available data.

Common Mistakes and Limitations

  • Calling the adjusted coefficient a causal effect. PC adjustment controls only the ancestry variation adequately represented by the modeled PCs under the other assumptions. It does not remove all confounding by itself.
  • Assuming any number of PCs works. Too few may leave relevant structure; too many may consume information or make the genotype coefficient unstable. The choice needs justification.
  • Ignoring overlap and collinearity. If genotype dosage is determined by the PC values in the sample, no separate adjusted genotype coefficient is identifiable. Near-determination can produce very uncertain estimates.
  • Claiming residuals are orthogonal without checking. A residual vector from regression on an intercept and PC must sum to zero and have zero inner product with that PC, up to numerical precision.
  • Interpreting a change after adjustment as a verdict. A changed estimate is informative about model dependence, not a definitive test that confounding has or has not been controlled.
Key takeaway: Genotype PCs are covariates that can control broad ancestry-related confounding when they capture the relevant structure and the association model is adequate. The adjusted coefficient uses genotype variation left after accounting for those PCs; its validity still depends on model assumptions, adequate overlap, and appropriate interpretation.

Check Your Understanding

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

  1. In a linear model with genotype dosage and three PCs, what does the genotype coefficient represent?
  2. Why can the adjusted genotype coefficient not be estimated if genotype is an exact linear combination of the intercept and PCs?
  3. A PC residual vector for four individuals is \((1,0,-1,0)\), and the PC values are \((-1,1,-1,1)\). Is the residual vector orthogonal to the PC?
  4. Give one reason a large change between unadjusted and PC-adjusted estimates does not prove that confounding was fully removed.
  5. What is one trade-off between PC adjustment and ancestry-stratified analysis?

Solutions. (1) It is the expected outcome difference per additional dosage unit, conditional on the three PCs and other included covariates. (2) The residual genotype sum of squares is zero, so the data contain no genotype variation independent of those terms; the separate coefficient is not identifiable. (3) Yes: the inner product is \((1)(-1)+(0)(1)+(-1)(-1)+(0)(1)=0\), so it is orthogonal to this PC; it also sums to zero and is therefore orthogonal to the intercept. (4) Other structure may remain, the PC and outcome models may be misspecified, or the estimate change may reflect reduced precision or other model dependence. (5) PCs can use information across the sample but may inadequately represent ancestry; stratification can make within-group comparisons but may have less precision or insufficient genotype variation within groups.

Clinical Biostats