Why diagonalize the covariance?
In a single-kernel linear mixed model, genetic similarity between individuals makes their phenotypes correlated. The covariance matrix is usually dense, so evaluating likelihoods by repeatedly manipulating that matrix can be costly. An eigendecomposition offers a useful alternative: when the covariance consists of a genetic relationship matrix multiplied by a variance component, the kernel’s eigenvectors also diagonalize the full covariance. In those coordinates, the likelihood is a sum of contributions from scalar variances rather than a calculation requiring a general matrix inverse at every parameter value.
This change of coordinates does not alter the statistical model or discard observations. It separates the likelihood into directions of genetic variation, each with its own variance. The same representation also helps explain how fixed effects are fitted and how a candidate SNP is tested while accounting for polygenic covariance.
The model and its eigendecomposition
After integrating out \(g\), the marginal model is \(y\sim N(X\beta,V)\), with \(V=\sigma_g^2K+\sigma_e^2I\). The assumption \(\sigma_e^2>0\) ensures that \(V\) is positive definite even when \(K\) has zero eigenvalues. Because \(K\) is symmetric, it has an orthogonal eigendecomposition \(K=U\Lambda U^\mathsf{T}\), where \(U^\mathsf{T}U=I\) and \(\Lambda=\operatorname{diag}(\lambda_1,\ldots,\lambda_n)\). Positive semidefiniteness means each \(\lambda_i\geq 0\).
Rotate the observations and design matrix into the eigenvector coordinates: \(z=U^\mathsf{T}y\) and \(W=U^\mathsf{T}X\). Orthogonal rotation preserves the information in the data, but changes how that information is expressed. In particular, \(z\sim N(W\beta,D)\), so the coordinates \(z_i\) are independent conditional on the fixed effects, with means \(w_i^\mathsf{T}\beta\) and variances \(d_i\). Here \(w_i^\mathsf{T}\) is row \(i\) of \(W\).
Worked Example: Turning a Kernel into Scalar Variances
Suppose a hypothetical two-individual analysis uses \(K=\begin{pmatrix}1&-1\\-1&1\end{pmatrix}\), with phenotype vector \(y=(3,1)^\mathsf{T}\). The vectors \(u_1=(1,1)^\mathsf{T}/\sqrt{2}\) and \(u_2=(1,-1)^\mathsf{T}/\sqrt{2}\) are orthonormal eigenvectors of \(K\), with eigenvalues 0 and 2. Take \(\sigma_e^2=1\) and \(\sigma_g^2=0.5\), and for this example suppose the mean is known to be zero.
The transformed observations and their variances are \(z_1=u_1^\mathsf{T}y=4/\sqrt{2}=2\sqrt{2}\) and \(z_2=u_2^\mathsf{T}y=2/\sqrt{2}=\sqrt{2}\), with \(d_1=1+0.5(0)=1\) and \(d_2=1+0.5(2)=2\). Thus the two transformed observations are independent under the model. Their quadratic contribution is \((2\sqrt{2})^2/1+(\sqrt{2})^2/2=8+1=9\).
The log determinant of \(V\) is \(\log(d_1d_2)=\log 2\). Therefore the marginal log likelihood at these specified parameters and zero mean is \(-\tfrac12[2\log(2\pi)+\log 2+9]\), approximately \(-6.684\). The unequal eigenvalues of the kernel have produced unequal variances in the rotated coordinates.
Likelihood as a sum of weighted terms
For any fixed \(\beta,\sigma_g^2,\sigma_e^2\), the Gaussian log likelihood is \(-\tfrac12[n\log(2\pi)+\log|V|+(y-X\beta)^\mathsf{T}V^{-1}(y-X\beta)]\). The decomposition gives \(|V|=|D|=\prod_i d_i\) and \(V^{-1}=UD^{-1}U^\mathsf{T}\). Substituting \(z=U^\mathsf{T}y\) and \(W=U^\mathsf{T}X\) yields:
Each direction contributes a log-variance term and a squared residual weighted by the reciprocal variance. Directions with larger \(d_i\) contribute less to the quadratic term for the same residual size. The formula is exact, not an approximation. Its direct use requires the covariance to have the stated single-kernel form and the kernel eigendecomposition to be valid; if a separate covariance component is added, the same eigenvectors need not diagonalize the resulting covariance.
Fitting fixed effects and restricted likelihood
For fixed variance components, maximizing the likelihood over \(\beta\) is weighted least squares in the transformed coordinates. Define \(D=\operatorname{diag}(d_1,\ldots,d_n)\); then the generalized least-squares estimate is:
This requires \(W\) to have full column rank, which follows from full column rank of \(X\) because \(U\) is invertible. The expression weights each transformed residual according to its variance. Substituting \(\hat{\beta}\) into the log likelihood gives the profile likelihood for the variance components; optimizing it over \(\sigma_g^2\geq0\) and \(\sigma_e^2>0\) is one route to maximum-likelihood estimation.
Restricted maximum likelihood (REML) accounts for estimating fixed effects by using error contrasts: linear combinations of the data that remove \(X\beta\). If \(X\) has rank \(p\), the restricted log likelihood, up to constants independent of the variance parameters, is:
where \(P=V^{-1}-V^{-1}X(X^\mathsf{T}V^{-1}X)^{-1}X^\mathsf{T}V^{-1}\). In eigenvector coordinates, the matrix terms are obtained from \(D\) and \(W\): \(|V|=|D|\), \(X^\mathsf{T}V^{-1}X=W^\mathsf{T}D^{-1}W\), and \(y^\mathsf{T}Py=z^\mathsf{T}[D^{-1}-D^{-1}W(W^\mathsf{T}D^{-1}W)^{-1}W^\mathsf{T}D^{-1}]z\). Thus REML also uses the scalar variances \(d_i\), while still accounting for the fixed-effect design.
Worked Example: Profiling an Intercept in Transformed Coordinates
Use the hypothetical data and kernel from the previous example, now with an unknown intercept as the only fixed effect: \(X=(1,1)^\mathsf{T}\). The transformed design is \(W=(\sqrt{2},0)^\mathsf{T}\), and \(z=(2\sqrt{2},\sqrt{2})^\mathsf{T}\). At \(\sigma_e^2=1,\sigma_g^2=0.5\), the weights are \(1/d_1=1\) and \(1/d_2=1/2\).
The weighted least-squares estimate of the intercept is \(\hat{\beta}=[(\sqrt{2})^2(1)]^{-1}[(\sqrt{2})(2\sqrt{2})(1)]=4/2=2\). The fitted transformed mean is \((2\sqrt{2},0)^\mathsf{T}\), so the transformed residual is \((0,\sqrt{2})^\mathsf{T}\). Its weighted quadratic is \(0^2/1+(\sqrt{2})^2/2=1\), not 9 as in the known-zero-mean example.
Consequently the profiled log likelihood at these same variance components is \(-\tfrac12[2\log(2\pi)+\log 2+1]\), approximately \(-2.684\). This is the likelihood at the specified variance components after fitting the intercept; it does not claim those components maximize the likelihood.
Using the representation for SNP association
A candidate SNP can be included as an additional fixed effect while the single-kernel covariance accounts for polygenic correlation. Let \(X\) contain the baseline fixed effects under the null hypothesis, and let \(x\) be the candidate genotype dosage vector. Under the alternative, the mean is \(X\beta+x\gamma\), where \(\gamma\) is the phenotype change per dosage unit, conditional on the model. For fixed covariance parameters, define \(P\) as above. The generalized least-squares estimate and its model-based standard error are:
These expressions require \(x^\mathsf{T}Px>0\): after accounting for the baseline design, the genotype must contain information not explained by \(X\). With the variance components treated as known, the Wald statistic \(\hat{\gamma}/SE(\hat{\gamma})\) has a standard normal distribution under \(H_0:\gamma=0\), and its square has a chi-square distribution with one degree of freedom. In practice, variance components are often estimated under the null and substituted into these calculations; the resulting test uses an approximation whose calibration depends on the model assumptions.
In transformed coordinates, replace \(x,y,X\) by \(U^\mathsf{T}x,z,W\), and use \(D^{-1}\) for the covariance weighting. For example, the null-model score numerator is \(x^\mathsf{T}Py\), equivalently the weighted transformed association after removing the baseline fixed effects. The eigendecomposition therefore supports association testing without treating genetically correlated individuals as independent.
Worked Example: A Weighted SNP Test with an Intercept
Consider four hypothetical individuals, a diagonal kernel with eigenvalues \((0,1,0,1)\), and known variance components \(\sigma_e^2=1,\sigma_g^2=1\). Because the kernel is diagonal here, the eigenvector matrix is the identity. The variances are \(d=(1,2,1,2)\), so the weights are \(w=(1,0.5,1,0.5)\). Let the phenotype be \(y=(1,2,2,4)^\mathsf{T}\), the genotype dosage be \(x=(0,0,1,1)^\mathsf{T}\), and the null design be an intercept.
For an intercept, the weighted projection removes weighted means. The required weighted sums are \(\sum w_i=3\), \(\sum w_ix_i=1.5\), \(\sum w_iy_i=6\), \(\sum w_ix_i^2=1.5\), and \(\sum w_ix_iy_i=4\). Hence \(x^\mathsf{T}Px=1.5-(1.5)^2/3=0.75\) and \(x^\mathsf{T}Py=4-(1.5)(6)/3=1\).
The estimated dosage effect is \(\hat{\gamma}=1/0.75=1.333\) phenotype units per additional dosage, with \(SE=1/\sqrt{0.75}=1.155\) phenotype units per dosage. The Wald statistic is \(1.333/1.155=1.155\), so its square is \(1.333\). Using the one-degree-of-freedom chi-square reference distribution gives a two-sided p-value of approximately 0.248. At a 0.05 significance level, this test does not provide evidence against the null hypothesis for this hypothetical data set. This conclusion is conditional on the stated covariance model and known variance components.
Why the transformation matters—and a common pitfall
Once \(U\) and the kernel eigenvalues are available, likelihood evaluation at each proposed pair of variance components reduces to updating \(d_i=\sigma_e^2+\sigma_g^2\lambda_i\), summing \(\log d_i\), and forming weighted sums. The same diagonal weights feed the fixed-effect and association calculations. This is especially useful when the same kernel is used across many likelihood evaluations or candidate-variant tests. The transformation does not make the initial eigendecomposition free; its practical value is that the decomposition can be reused as the variance components change.
A key distinction is between the transformed observations and residuals after fitting fixed effects. The transformed observations \(z_i\) are independent under the Gaussian model conditional on their means. But estimating \(\beta\) imposes shared constraints across coordinates, so the fitted residuals \(z-W\hat{\beta}\) are generally correlated. It is incorrect to treat those fitted residuals as independent observations with no adjustment for fixed effects.
- Wrong reasoning: “The covariance is diagonal after rotation, so fitting the intercept can be done separately for each coordinate.”
- Correction: The likelihood has independent coordinate contributions before fitting, but the intercept is a shared parameter. Estimate it jointly by weighted least squares using \(W^\mathsf{T}D^{-1}W\).
- Wrong reasoning: “A SNP test in the rotated data is just an unweighted correlation of \(U^\mathsf{T}x\) and \(z\).”
- Correction: The test must use the weights \(D^{-1}\) and remove the baseline fixed effects. The relevant quantities are \(x^\mathsf{T}Px\) and \(x^\mathsf{T}Py\).
Check Your Understanding
Use the definitions and formulas in the tutorial to answer these questions.
- Why does \(\sigma_e^2>0\) ensure that every transformed variance \(d_i\) is positive when \(K\) is positive semidefinite?
- In the transformed likelihood, which term corresponds to the log determinant of the covariance matrix?
- Why are transformed observations independent conditional on the fixed effects, while fitted transformed residuals need not be independent?
- What condition must hold for the single-variant coefficient estimate to be defined after adjustment for baseline fixed effects?
- For a SNP association test, why is an unweighted correlation between the transformed genotype and phenotype generally not the correct test statistic?