Tutorials › High-Dimensional Genomic Data Analysis › Low-Rank Approximations to Relationship Matrices

Mixed-Model GWAS, Relatedness and Inflation Diagnostics · Tutorial 262 of 795

Low-Rank Approximations to Relationship Matrices

Learn how to construct and evaluate a low-rank relationship matrix approximation, quantify its computational benefits, and check its effect on association tests.

Advanced 13 min read

What You'll Learn

  • Express a positive semidefinite relationship matrix through its eigenvalues and eigenvectors.
  • Construct a rank-r approximation by retaining the leading eigencomponents.
  • Compare dense and low-rank storage and factorization costs.
  • Use the Woodbury identity to understand calculations with a low-rank covariance component.
  • Quantify covariance error from discarded eigenvalues.
  • Compare exact and approximate association statistics and identify diagnostic checks.

Why Approximate a Relationship Matrix?

A genomic relationship matrix \(K\) summarizes genetic similarity among \(n\) individuals. In a linear mixed model, it contributes to the covariance of the phenotype, so operations involving that covariance can dominate computation when the cohort is large. Storing a dense \(n\times n\) matrix requires \(O(n^2)\) memory, and a generic dense factorization can require \(O(n^3)\) operations. A low-rank approximation replaces \(K\) by a matrix built from a smaller number of directions in the data. This can greatly reduce storage and some repeated computations, but it also changes the fitted covariance and can change association statistics.

The aim is not simply to make a matrix smaller. A useful approximation retains the relationship patterns that matter for the analysis while controlling the effect of discarded patterns on inference. The mixed-model framework and association tests provide the context: the approximation is to the relationship matrix, and its consequences must be assessed in the covariance model and the test statistic.

Spectral Low-Rank Approximation

Assume \(K\) is a symmetric positive semidefinite relationship matrix for the analyzed individuals. Its eigendecomposition is \(K=U\Lambda U^\mathsf{T}\), where the columns of \(U\) are orthonormal eigenvectors and the diagonal entries of \(\Lambda\) are nonnegative eigenvalues. Order them as \(\lambda_1\geq\lambda_2\geq\cdots\geq\lambda_n\geq0\). Retaining the first \(r\) eigencomponents gives a rank-at-most-\(r\) approximation.

Definition: The rank-\(r\) spectral truncation of \(K\) is \(K_r=U_r\Lambda_rU_r^\mathsf{T}\), where \(U_r\) contains the first \(r\) eigenvectors and \(\Lambda_r=\operatorname{diag}(\lambda_1,\ldots,\lambda_r)\). The discarded part is \(K-K_r=\sum_{j=r+1}^{n}\lambda_j u_j u_j^\mathsf{T}\), which is positive semidefinite.

The leading eigenvectors represent directions with the largest eigenvalues in \(K\). Truncation preserves those directions and sets the remaining eigenvalues to zero. It does not generally preserve every entry, every diagonal value, or every small-scale relationship in the original matrix. A low-rank factor \(U_r\Lambda_r^{1/2}\) is often stored instead of forming \(K_r\) explicitly.

In a standard linear mixed model, write \(y=X\beta+g+\epsilon\), with \(g\sim N(0,\sigma_g^2K)\), \(\epsilon\sim N(0,\sigma_e^2I)\), and independent random terms. Thus \(y\) has covariance \(V=\sigma_g^2K+\sigma_e^2I\). Under rank truncation, the approximate covariance is \(V_r=\sigma_g^2K_r+\sigma_e^2I\). This description assumes \(K\) is positive semidefinite, the same individuals and scaling of \(K\) are used in both models, and \(\sigma_e^2>0\). The positive residual variance ensures \(V_r\) remains positive definite, even when \(K_r\) is singular.

Worked Example: Forming a Rank-One Approximation

Suppose a hypothetical relationship matrix has eigendecomposition \(K=U\Lambda U^\mathsf{T}\), with eigenvalues \(5,2,1\) and orthonormal eigenvectors \(u_1,u_2,u_3\). Retain only the leading eigencomponent.

The rank-one approximation is \(K_1=5u_1u_1^\mathsf{T}\). The discarded component is \(K-K_1=2u_2u_2^\mathsf{T}+u_3u_3^\mathsf{T}\), so the approximation is positive semidefinite below \(K\): \(K-K_1\) is positive semidefinite.

The spectral norm error, which for a symmetric matrix is the largest absolute eigenvalue, is \(\|K-K_1\|_2=2\). The Frobenius norm error is \(\sqrt{2^2+1^2}=\sqrt{5}\approx2.236\). These measure different features: the spectral norm records the largest discarded direction, while the Frobenius norm combines the discarded eigenvalues.

Computational Savings and the Woodbury Identity

If a factor \(U_r\Lambda_r^{1/2}\) is stored, its storage is about \(nr\) numbers rather than \(n^2\) numbers for a dense matrix. When \(r\ll n\), that is a substantial reduction. Calculations with \(V_r=\sigma_e^2I+\sigma_g^2U_r\Lambda_rU_r^\mathsf{T}\) can use the Woodbury identity, which expresses the inverse through an \(r\times r\) matrix rather than requiring a dense \(n\times n\) inversion:

$$ V_r^{-1}=\frac{1}{\sigma_e^2}I-\frac{1}{\sigma_e^2}U_r \left(\Lambda_r^{-1}+\frac{\sigma_g^2}{\sigma_e^2}I_r\right)^{-1} \frac{\sigma_g^2}{\sigma_e^2}U_r^\mathsf{T}. $$

This form assumes the retained eigenvalues are positive; zero eigenvalues can be omitted from \(U_r\). It is an algebraic identity for positive \(\sigma_e^2\), not an approximation beyond the replacement of \(K\) by \(K_r\). When the factor is fixed and many calculations are needed, the smaller matrix can make repeated solves much cheaper. The time to obtain the factor itself, data movement, and any costs of estimating variance components still matter.

Worked Example: Comparing Storage and Factorization Costs

Consider a hypothetical cohort of \(n=10{,}000\) individuals and a retained rank \(r=200\). A dense matrix has \(10{,}000^2=100{,}000{,}000\) entries. A factor with \(nr=2{,}000{,}000\) entries uses one fiftieth as many stored values, ignoring smaller auxiliary matrices and implementation overhead.

For scale, a generic dense factorization has a leading operation count near \(n^3/3\), or \(3.33\times10^{11}\) operations. A low-rank strategy involving work on the order of \(nr^2+r^3\) has \(10{,}000(200)^2+(200)^3=408{,}000{,}000\) operations at that scale. The ratio of these leading counts is about \(3.33\times10^{11}/4.08\times10^8\approx816\).

This is an order-of-growth comparison, not a promised runtime speedup: constants, memory access, the method used to obtain eigenvectors, and the number of solves all affect actual time. In particular, computing a full eigendecomposition of a dense \(K\) can itself be expensive, so large-scale methods often need an efficient route to the retained eigenspace.

What Truncation Does to the Covariance

In the eigenbasis of \(K\), the exact covariance has eigenvalues \(\sigma_e^2+\sigma_g^2\lambda_j\). The rank-\(r\) covariance has the same values for \(j\leq r\) and \(\sigma_e^2\) for \(j>r\). Therefore \(V-V_r=\sigma_g^2(K-K_r)\) is positive semidefinite: truncation removes covariance in the discarded directions and does not add covariance there.

The largest absolute covariance eigenvalue error is \(\sigma_g^2\lambda_{r+1}\), and the total squared Frobenius error is \(\sigma_g^4\sum_{j=r+1}^{n}\lambda_j^2\). These are useful matrix diagnostics, but neither alone guarantees that an association test is accurate. The phenotype and tested genotype may align especially strongly with a discarded direction, and a small covariance change can matter for a statistic near a decision threshold.

For each discarded direction \(j>r\), the exact inverse-covariance eigenvalue is \(1/(\sigma_e^2+\sigma_g^2\lambda_j)\), while the approximate one is \(1/\sigma_e^2\). Their difference is

$$ \frac{1}{\sigma_e^2}-\frac{1}{\sigma_e^2+\sigma_g^2\lambda_j} =\frac{\sigma_g^2\lambda_j}{\sigma_e^2(\sigma_e^2+\sigma_g^2\lambda_j)}. $$

This shows why a large residual variance can dampen the effect of a discarded eigenvalue on the inverse covariance, while a relatively large genetic variance or a substantial omitted eigenvalue can make the discrepancy more consequential. It is not, by itself, a bound on a \(p\)-value or on a test statistic with fixed-effect adjustment.

Assessing Association-Test Error

For a single variant with genotype vector \(x\), a score test under the null model uses the covariance \(V\) and fixed-effect design \(X\). Define \(P_V=V^{-1}-V^{-1}X(X^\mathsf{T}V^{-1}X)^{-1}X^\mathsf{T}V^{-1}\), assuming \(X\) has full column rank. With the null-model residual vector \(y\), the score statistic is \(Q=(x^\mathsf{T}P_Vy)^2/(x^\mathsf{T}P_Vx)\), provided the denominator is positive. The approximate test substitutes \(V_r\) to form \(P_{V_r}\) and \(Q_r\). Under the null and the model’s regularity conditions, the score statistic is commonly compared with a chi-square distribution with one degree of freedom.

The two statistics need not be close just because \(K_r\) explains a high proportion of the matrix’s total eigenvalue sum. The test depends on the genotype direction, the phenotype residuals, and the fixed-effect adjustment. A direct assessment compares \(Q_r\) with \(Q\) on representative variants for which an exact or higher-rank calculation is feasible. It is useful to compare effect estimates, standard errors, and \(p\)-values as well, especially near the study’s reporting threshold.

Worked Example: Comparing Exact and Approximate Score Statistics

Consider a hypothetical two-individual model with an intercept, genotype vector \(x=(0,1)^\mathsf{T}\), phenotype vector \(y=(0,1)^\mathsf{T}\), and diagonal covariance \(V=\operatorname{diag}(3,3)\). Suppose a rank-one truncation produces \(V_1=\operatorname{diag}(3,2)\). These covariances can arise from residual variance 2 and a diagonal relationship matrix with two unit eigenvalues, retaining the first individual’s eigencomponent. The example is deliberately small to show the test calculation, not to represent a realistic GWAS.

For a two-observation model with an intercept and diagonal covariance \(\operatorname{diag}(v_1,v_2)\), the intercept-adjusted matrix is

$$ P_V=\frac{1}{v_1+v_2} \begin{pmatrix}1&-1\\-1&1\end{pmatrix}. $$

Here \(x^\mathsf{T}P_Vy=1/(v_1+v_2)\) and \(x^\mathsf{T}P_Vx=1/(v_1+v_2)\), so \(Q=1/(v_1+v_2)\). For the exact covariance, \(Q=1/(3+3)=1/6\approx0.1667\). For the approximation, \(Q_1=1/(3+2)=0.2000\). The approximate statistic is larger because the truncation reduced the covariance for one observation. Comparing each statistic with \(\chi^2_1\) gives approximate two-sided tail probabilities of \(0.683\) and \(0.655\), respectively. The difference is modest here, but this small example does not establish that the approximation is safe for other variants or larger studies.

Diagnostics, Alternatives, and Limitations

A practical approximation assessment has both matrix-level and test-level checks. At the matrix level, inspect the retained eigenvalue spectrum, the residual eigenvalues, and quantities such as \(\lambda_{r+1}\) and \(\sum_{j>r}\lambda_j^2\). At the test level, compare exact or higher-rank results against the proposed rank on a subset of variants. Include variants with different allele frequencies and association strengths, and examine discrepancies in statistics and standard errors rather than only whether a significance threshold is crossed.

1
Choose a candidate rank.
Retain enough leading components to represent the major relationship structure, while recording the omitted eigenvalue tail.
2
Check covariance error.
Evaluate the largest omitted eigenvalue and the cumulative squared tail, scaled by the fitted genetic variance when assessing \(V\).
3
Check inferential error.
On a feasible set of variants, compare approximate statistics with exact or higher-rank statistics and investigate material differences.

Several failure modes deserve attention. If eigenvalues decay slowly, a small \(r\) may discard meaningful covariance. If the retained subspace is computed for a different set or ordering of individuals, the factor does not represent the intended \(K\). If variance components are estimated using the approximate model, differences between tests reflect both covariance approximation and changed parameter estimates; comparing with fixed common variance components can help isolate the matrix approximation itself. Finally, a high fraction of total eigenvalue mass retained is not a universal guarantee of accurate association inference.

A dense exact approach preserves the specified relationship matrix but may be computationally infeasible. Low-rank approximation is attractive when a relatively small number of directions capture the covariance features needed for the analysis, but it introduces truncation error. Sparse representations instead exploit many zero or negligible entries; that is a different structural approximation, not another name for spectral truncation. These approaches have different error patterns and computational trade-offs, so the suitable method depends on the matrix structure and the required accuracy.

A common mistake is to argue, “The first \(r\) components explain 99% of the eigenvalue sum, so the association \(p\)-values must be accurate.” The eigenvalue sum is a global matrix summary. An individual test depends on how its genotype and phenotype residual align with the discarded directions, so the conclusion does not follow. The correction is to treat eigenvalue summaries as screening diagnostics and directly assess test-level differences on a suitable validation set. A low-rank approximation is a computational model choice, not an automatic guarantee of calibrated inference.

Key takeaway: Spectral truncation replaces \(K\) with its leading eigencomponents, reducing storage and enabling smaller-matrix calculations. Its covariance error is quantifiable from discarded eigenvalues, but association-test accuracy must be checked in the test calculations themselves.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. If the largest omitted eigenvalue is \(0.4\) and \(\sigma_g^2=2\), what is the spectral norm error in the covariance \(V\) from truncation?
  2. For \(n=6{,}000\) and \(r=150\), what is the ratio of the factor’s \(nr\) stored entries to the dense matrix’s \(n^2\) entries?
  3. Why does retaining 95% of the eigenvalue sum not establish that every association statistic is accurate?
  4. In the two-observation worked example, what is the approximate score statistic when the covariance is \(\operatorname{diag}(3,2)\)?

Solutions. (1) The covariance error norm is \(\sigma_g^2\lambda_{r+1}=2(0.4)=0.8\). (2) The ratio is \(nr/n^2=r/n=150/6{,}000=0.025\), so the factor stores 2.5% as many entries, ignoring overhead. (3) The eigenvalue sum is a global summary; a particular genotype and phenotype residual can align with omitted directions, so test-level comparisons are needed. (4) With an intercept, \(Q_1=1/(3+2)=0.2000\).

Clinical Biostats