Tutorials › Statistical Genetics › Mixed Models for Population Structure Control

Population Stratification Control · Tutorial 190 of 989

Mixed Models for Population Structure Control

Fit and interpret a genetic association linear mixed model that represents genome-wide similarity through a random effect with covariance proportional to a genomic relationship matrix.

Intermediate 10 min read

What You'll Learn

  • Specify a phenotype model with a tested genotype as a fixed effect and a genomic relationship matrix as a random-effect covariance.
  • Explain how the relationship matrix induces covariance between individuals with similar genetic backgrounds.
  • Estimate fixed effects using generalized least squares conditional on variance components.
  • Calculate and interpret a Wald test and confidence interval for a SNP effect.
  • Recognize the assumptions and limits of mixed-model adjustment for population structure.

Why Model Genetic Similarity?

A genetic association analysis can be distorted when individuals with similar ancestry also tend to share phenotype-related genetic or environmental factors. Their outcomes may therefore be correlated, while their allele frequencies may differ from those of other ancestry groups. Treating all observations as independent can make the uncertainty in a SNP association estimate too small and can produce misleading evidence of association.

A linear mixed model addresses this dependence by including a random effect whose covariance across individuals is specified using a genomic relationship matrix. The tested SNP remains a fixed effect: its coefficient describes the estimated phenotype difference associated with one additional effect allele, conditional on the other terms in the model. The relationship matrix instead describes how much background similarity is expected between each pair of individuals.

Definition: A genetic association linear mixed model represents a continuous phenotype as a sum of fixed effects, a mean-zero random genetic background effect, and residual error. If \(K\) is an \(n \times n\) genomic relationship matrix, the random effect has covariance proportional to \(K\). Consequently, individuals with greater genomic similarity are modeled as having more similar background effects.

Model and Interpretation

For \(n\) individuals, let \(y\) be the vector of continuous phenotypes, \(g\) the vector of dosages for the SNP being tested, and \(C\) a matrix of measured covariates such as age or sex. Dosage is commonly coded as the number of copies of a specified allele, from 0 to 2. Write the fixed-effect design matrix as \(X=[\mathbf{1}, C, g]\), with corresponding coefficient vector \(\beta\). The model is

$$ y = X\beta + u + e,\qquad u \sim N(0,\sigma_g^2 K),\qquad e \sim N(0,\sigma_e^2 I). $$

Here \(u\) is the random background genetic effect, \(e\) is residual error, and \(I\) is the \(n \times n\) identity matrix. The standard model assumes \(u\) and \(e\) are independent, both have mean zero, and the residual errors have equal variance and are mutually independent. The relationship matrix \(K\) is treated as known for the association fit and must be positive semidefinite. Its scale depends on how it was constructed; often its diagonal entries are near 1, but this is not guaranteed.

The fixed effects describe the conditional mean, while the random effect describes covariance around that mean. Specifically, the model implies

$$ E(y \mid X)=X\beta,\qquad \operatorname{Cov}(y \mid X)=V=\sigma_g^2 K+\sigma_e^2 I. $$

For different individuals \(i\) and \(j\), the modeled covariance is \(V_{ij}=\sigma_g^2 K_{ij}\). A larger \(K_{ij}\) therefore implies greater covariance in their background effects, when \(\sigma_g^2\) is positive. The diagonal elements of \(V\) give the modeled phenotype variances. The tested SNP's coefficient, denoted \(\beta_g\), is interpreted in the phenotype's units per one additional copy of the effect allele, conditional on the included covariates and the modeled background structure. It is an association estimate, not by itself evidence of a causal effect.

Worked Example: Translating a Relationship Matrix Into Covariance

Suppose three hypothetical individuals have the relationship matrix

$$ K = \begin{pmatrix} 1 & 0.6 & 0.1\\ 0.6 & 1 & 0.2\\ 0.1 & 0.2 & 1 \end{pmatrix}, $$

and suppose the fitted background variance component is \(\sigma_g^2=4\) phenotype-units squared, while \(\sigma_e^2=1\) phenotype-units squared. Assume the stated \(K\) is positive semidefinite and the model's independent random-effect and residual assumptions hold. Then

$$ V=4K+I = \begin{pmatrix} 5 & 2.4 & 0.4\\ 2.4 & 5 & 0.8\\ 0.4 & 0.8 & 5 \end{pmatrix}. $$

For individuals 1 and 2, the modeled covariance is \(4(0.6)=2.4\) phenotype-units squared. For individuals 1 and 3, it is \(4(0.1)=0.4\) phenotype-units squared. Each modeled variance is \(4(1)+1=5\) phenotype-units squared. Thus their modeled correlations are \(2.4/5=0.480\) and \(0.4/5=0.0800\), respectively. These are correlations implied by this fitted covariance model, not observed correlations that must hold exactly in a finite sample.

Estimating and Testing the SNP Effect

The variance components \(\sigma_g^2\) and \(\sigma_e^2\) are generally estimated from the data, commonly by maximum likelihood or restricted maximum likelihood. Once estimates are available, they determine an estimated covariance matrix \(\hat V\). The fixed effects can then be estimated by generalized least squares (GLS). GLS gives less independent weight to observations that are modeled as strongly correlated, rather than treating every phenotype as an independent contribution.

For a specified positive-definite covariance matrix \(V\), the GLS estimate and its covariance are

$$ \hat\beta=(X^\mathsf{T}V^{-1}X)^{-1}X^\mathsf{T}V^{-1}y,\qquad \operatorname{Cov}(\hat\beta \mid X,V)=(X^\mathsf{T}V^{-1}X)^{-1}. $$

In practice, variance components are estimated, so association software substitutes \(\hat V\) and typically reports an estimated standard error. To test the SNP association, the hypotheses are \(H_0:\beta_g=0\) and \(H_a:\beta_g\ne 0\). A common large-sample Wald statistic is \(z=\hat\beta_g/SE(\hat\beta_g)\); under the null and the model assumptions, it is approximately standard normal. A two-sided p-value is \(2P(Z\ge |z|)\) for \(Z\sim N(0,1)\). A corresponding approximate 95% confidence interval is \(\hat\beta_g \pm 1.96SE(\hat\beta_g)\).

This large-sample calibration is not an automatic guarantee of valid inference. It relies on an adequate mean and covariance model, suitable estimation of variance components, and sufficient information for the approximation being used. The model is normally used for quantitative phenotypes; binary phenotypes require a model appropriate to a binary outcome rather than simply assuming a normally distributed continuous response.

Worked Example: GLS Association Estimate With Known Variance Components

Consider a deliberately small hypothetical illustration with two individuals, phenotype values \(y=(10,14)^\mathsf{T}\) units, genotype dosages \(g=(0,2)^\mathsf{T}\), and an intercept in the fixed effects. Let \(K_{12}=0.6\), both diagonal entries of \(K\) be 1, and suppose the variance components are known to be \(\sigma_g^2=4\) and \(\sigma_e^2=1\), in squared phenotype units. Under the model's independent random and residual effects, the covariance matrix is

$$ V = \begin{pmatrix} 5 & 2.4\\ 2.4 & 5 \end{pmatrix}. $$

The design matrix has an intercept column and a genotype column. With two observations and two distinct dosages, the fixed-effect equations fit both phenotype values exactly: \(\hat\beta_0=10\) and \(\hat\beta_g=(14-10)/(2-0)=2\) phenotype-units per allele. For this symmetric \(V\), the GLS slope is the same difference-over-dosage calculation. Its variance follows from the contrast between the two observations:

$$ \operatorname{Var}(\hat\beta_g) =\frac{V_{11}+V_{22}-2V_{12}}{(2-0)^2} =\frac{5+5-2(2.4)}{4} =1.3. $$

Thus \(SE(\hat\beta_g)=\sqrt{1.3}=1.140\) phenotype-units per allele, and the Wald statistic is \(z=2/1.140=1.754\). Its approximate two-sided normal p-value is \(2P(Z\ge1.754)\approx0.0794\). This toy calculation shows how positive covariance changes uncertainty in a contrast. It is not a practically useful study: two observations cannot support reliable estimation of variance components, and the known variance values were stipulated rather than estimated. The p-value here is illustrative of a Wald calculation under known covariance, not a claim that this tiny dataset supports a dependable association analysis.

Why the Covariance Term Helps With Structure

Ancestry can create genetic similarity across many markers, not just at the SNP under test. When this background similarity is also associated with phenotype, the random effect \(u\) gives the model a way to represent correlated phenotype deviations among genetically similar individuals. The SNP coefficient is then estimated using the covariance-weighted information in the sample, rather than using the independent-observation assumption.

This adjustment is not equivalent to asserting that ancestry has no relationship with phenotype, nor does it guarantee that every source of population confounding has been removed. It relies on \(K\) representing relevant background similarity and on the random-effect covariance being an adequate description of how that similarity relates to phenotype. A poorly constructed or poorly scaled matrix, an inadequate mean model, or a mismatch between the assumed and actual covariance can leave residual confounding or give unreliable standard errors. The relationship-matrix preparation and diagnostics matter as much as the choice to use a mixed model.

Worked Example: Interpreting a Fitted Mixed-Model Result

Suppose a hypothetical study analyzes a quantitative biomarker, measured in milligrams per litre, for 600 unrelated-at-the-record level individuals. It fits the model above with an intercept, age, sex, and one tested SNP as fixed effects. The genomic relationship matrix has diagonal entries near 1, and the fitted variance components are \(\hat\sigma_g^2=0.30\) and \(\hat\sigma_e^2=0.70\), in squared milligrams per litre. Suppose the SNP estimate is \(\hat\beta_g=0.18\) milligrams per litre per effect allele, with \(SE(\hat\beta_g)=0.06\) in the same units. Assume the model is adequately specified and the large-sample Wald approximation is appropriate.

The test statistic is \(z=0.18/0.06=3.00\), giving a two-sided normal p-value of approximately \(0.00270\). The approximate 95% confidence interval is

$$ 0.18 \pm 1.96(0.06) =0.18\pm0.1176 =[0.0624,\,0.2976]\ \text{milligrams per litre per allele}. $$

At the 0.05 significance level, the result is evidence against \(H_0:\beta_g=0\) under the fitted model. The estimated conditional association is an increase of 0.18 milligrams per litre per additional effect allele, with the stated approximate interval. The p-value is not the probability that the null hypothesis is true. Nor does this result establish causation: it is an association conditional on the modeled covariates and genomic covariance structure.

Deriving the GLS Estimate

The GLS formula follows by treating the phenotype vector as multivariate normal with mean \(X\beta\) and covariance \(V\), for fixed \(V\). Up to a constant, its log-likelihood as a function of \(\beta\) is

$$ \ell(\beta)=-\frac12(y-X\beta)^\mathsf{T}V^{-1}(y-X\beta)+\text{constant}. $$

Differentiating with respect to \(\beta\) and setting the derivative to zero gives

$$ \frac{\partial\ell}{\partial\beta} =X^\mathsf{T}V^{-1}(y-X\beta)=0 \quad\Longrightarrow\quad X^\mathsf{T}V^{-1}X\beta=X^\mathsf{T}V^{-1}y. $$

If \(X^\mathsf{T}V^{-1}X\) is invertible, solving these normal equations yields the GLS estimate stated above. Its covariance is \((X^\mathsf{T}V^{-1}X)^{-1}\), conditional on \(X\) and known \(V\); in applications, replacing \(V\) with an estimate makes the reported uncertainty an approximation that also depends on variance-component estimation.

Common Pitfall and Practical Interpretation

  • Wrong reasoning: “The model includes a relationship matrix, so ancestry confounding is automatically eliminated.” Correction: The matrix specifies a covariance pattern. Control depends on whether that pattern and the fixed-effect mean model adequately represent the relevant structure.
  • Wrong reasoning: “A large random-effect variance means the SNP has a large effect.” Correction: \(\sigma_g^2\) describes variation in the background random effect under the chosen \(K\) scale; \(\beta_g\) is the tested SNP's fixed-effect association coefficient. They are different quantities.
  • Wrong reasoning: “The random effect is another covariate, so its coefficient is an ancestry effect.” Correction: The random effect has a covariance model across individuals; it is not a single fixed ancestry coefficient with a direct per-unit interpretation.
  • Wrong reasoning: “A significant Wald test proves that the tested allele changes the phenotype.” Correction: The test assesses evidence for a nonzero conditional association under the specified model. It does not by itself establish a causal effect.
Key takeaway: In a genetic association linear mixed model, the tested genotype enters the mean as a fixed effect, while the genomic relationship matrix enters the covariance through \(V=\sigma_g^2K+\sigma_e^2I\). This lets the model account for related background deviations, provided its covariance and mean assumptions are reasonable.

Check Your Understanding

Use the model and assumptions in this tutorial to answer the following questions.

  1. In \(V=\sigma_g^2K+\sigma_e^2I\), what determines the modeled covariance between two different individuals?
  2. Why is the tested SNP coefficient a fixed effect, while the background genetic contribution is modeled as random?
  3. If the estimated SNP coefficient is 0.12 units per allele with standard error 0.04, calculate its Wald statistic and state the two-sided approximate normal test being used.
  4. What does a 95% confidence interval for the SNP coefficient describe, and what does it not establish?
  5. Give one reason a mixed model with a genomic relationship matrix might fail to control all ancestry-related confounding.
Clinical Biostats