Tutorials › Statistical Genetics › Adjusting SKAT for Covariates

Kernel Tests and SKAT Methods · Tutorial 443 of 989

Adjusting SKAT for Covariates

See how covariate adjustment changes the SKAT score, its covariance, and the eigenvalue weights used for null calibration.

Advanced 10 min read

What You'll Learn

  • Define the quantitative-trait residual maker and the residual-score vector used in SKAT.
  • Derive the score covariance after fitting covariates in a binary-trait model.
  • Explain why covariate adjustment changes the null distribution, not just the observed score.
  • Calculate mixture-chi-square weights from the weighted score covariance matrix.
  • Identify assumptions and pitfalls in covariate-adjusted SKAT calibration.

Why Covariate Adjustment Is Part of the Test

A gene-level test asks whether a set of genetic variants is associated with a trait, while accounting for other measured variables that may also relate to the trait. Age, sex, ancestry variables, and study indicators are common examples of covariates. In SKAT, adjustment is not simply a preliminary step that changes the trait values: it also changes the covariance of the genetic score and therefore the null distribution used to calculate a p-value.

The central quantities are the residuals from a model with no genetic effects, the genetic score calculated from those residuals, and the covariance of that score after estimating the covariate effects. For a quantitative trait, the residual-maker matrix removes the linear contribution of the covariates. For a binary trait, the corresponding adjustment uses the fitted Bernoulli variances and the information matrix for the covariates.

Definition: Let \(n\) be the number of individuals, \(m\) the number of variants, \(G\) the \(n \times m\) genotype matrix, and \(X\) the \(n \times p\) covariate design matrix. The rows of \(G\) and \(X\) refer to the same individuals. The matrix \(X\) includes an intercept when the model requires one. Let \(W\) be a specified \(m \times m\) diagonal matrix of nonnegative variant weights. The covariate-adjusted SKAT statistic is \(Q=U'WU\), where \(U\) is the residual-score vector under the null model.

This tutorial treats \(W\) as fixed and focuses on how covariate adjustment determines \(U\) and its null covariance. The weights are not selected by looking at the observed association statistic.

Quantitative Traits: Residualize Both the Trait and the Genotypes

For a quantitative trait, use the linear model \(y=X\alpha+G\beta+\varepsilon\), where \(y\) is the \(n\)-vector of trait values, \(\alpha\) is the \(p\)-vector of covariate coefficients, and \(\beta\) is the \(m\)-vector of genetic effects. Under the null hypothesis \(H_0:\beta=0\), assume \(\varepsilon\sim N(0,\sigma^2 I_n)\), with independent errors, constant variance, and a full-column-rank \(X\). The covariate effects are estimated under this null model.

Define the ordinary least-squares projection onto the columns of \(X\) and the residual-maker matrix as follows. The latter is symmetric and removes any component lying in the covariate space.

$$ H_X=X(X'X)^{-1}X', \qquad M_X=I_n-H_X. $$

The null-model residual vector is \(e=M_Xy\). Since \(M_XX=0\), these residuals contain no fitted linear component from the columns of \(X\). The SKAT residual-score vector is \(U=G'e\). Equivalently, \(U=(M_XG)'y\): the same score results from first residualizing each genotype column against the covariates and then relating those residualized genotypes to the trait.

Here \(U\) is the unscaled residual-score vector. In a Gaussian likelihood, the score for \(\beta\) is \(U/\sigma^2\); the unscaled convention makes the variance factor explicit in the covariance and in the null distribution below.

Result: Under \(H_0\) and the stated Gaussian model, \(U\) has mean zero and covariance \(\operatorname{Cov}(U)=\sigma^2G'M_XG\). Consequently, if \(\sigma^2\) is known, the null distribution of \(Q=U'WU\) is a weighted sum of independent \(\chi^2_1\) variables. Its weights are the eigenvalues of \(\sigma^2W^{1/2}G'M_XGW^{1/2}\).

The factor \(\sigma^2\) is essential. The weights are eigenvalues of the covariance of the weighted score, not just of the genotype information matrix. Omitting this factor would give the wrong scale unless \(\sigma^2=1\).

Worked Example: A Quantitative-Trait Score With One Covariate

Suppose four hypothetical individuals have quantitative trait values \(y=(1,2,2,5)'\), a covariate \(x=(-1,-1,1,1)'\), and one variant with genotype vector \(g=(0,1,1,2)'\). Let \(X\) contain an intercept and \(x\), assume the null error variance is known to be \(\sigma^2=2\), and set the single variant weight to \(w=1\). These assumptions give a full-rank \(X\) and the specified Gaussian null model.

The intercept and \(x\) are orthogonal, each with squared length 4. Fitting them gives fitted trait values \((1.5,1.5,3.5,3.5)'\), so \(e=M_Xy=(-0.5,0.5,-1.5,1.5)'\). The score and statistic are

$$ U=g'e=(0)(-0.5)+(1)(0.5)+(1)(-1.5)+(2)(1.5)=2, \qquad Q=wU^2=(1)(2^2)=4. $$

The genotype residual after adjustment is \(M_Xg=(-0.5,0.5,-0.5,0.5)'\), whose squared length is 1. Thus \(g'M_Xg=1\), and \(\operatorname{Var}(U)=\sigma^2g'M_Xg=2\). The sole mixture weight is therefore 2, so \(Q\) has the null distribution \(2\chi^2_1\). The observed value corresponds to \(Q/2=2\), giving the nominal upper-tail p-value \(P(\chi^2_1\geq 2)\approx0.157\). This is not evidence of a statistically significant association at \(\alpha=0.05\).

If the covariates were ignored, the residuals, score covariance, and reference distribution would all be different. In particular, the weight 2 here follows from the adjusted genotype information and the stated error variance.

Why the Quantitative-Trait Null Is a Mixture

The mixture representation follows directly from normality and a symmetric-matrix decomposition. Under \(H_0\), \(U=G'M_X\varepsilon\) is multivariate normal with covariance \(\Sigma_U=\sigma^2G'M_XG\). Let \(A=W^{1/2}\Sigma_UW^{1/2}\), and write \(Q=(W^{1/2}U)'(W^{1/2}U)\). Diagonalize the symmetric positive-semidefinite matrix \(A\) as \(A=V\Lambda V'\), where \(V\) is orthogonal and \(\Lambda\) has eigenvalues \(\lambda_1,\ldots,\lambda_m\), including any zeros.

An orthogonal transformation preserves the squared length of a vector. The transformed, standardized normal coordinates are independent standard normal variables \(Z_1,\ldots,Z_m\). Therefore the quadratic form has the stated mixture representation.

$$ Q\ \overset{d}{=}\ \sum_{j=1}^{m}\lambda_j Z_j^2, \qquad Z_j\ \text{independent with}\ Z_j\sim N(0,1), \qquad \lambda_j=\operatorname{eigenvalues}\!\left(\sigma^2W^{1/2}G'M_XGW^{1/2}\right). $$

This argument also explains what happens if some variants become redundant after adjustment: zero eigenvalues contribute zero to the sum. If \(\sigma^2\) is estimated rather than known, a common calibration substitutes the null-model estimate into the eigenvalues. That plug-in procedure is not the same exact known-variance distribution; its accuracy depends on the sample size and model conditions.

Binary Traits: Use the Logistic Null Model's Information Projection

For a binary trait, write \(Y_i\in\{0,1\}\) and fit a logistic null model with linear predictor \(X_i'\alpha\) and fitted probability \(\hat{\mu}_i\). The model assumes independent Bernoulli outcomes conditional on the covariates, with \(\operatorname{logit}(\mu_i)=X_i'\alpha\). Assume the null fit is finite and \(X'VX\) is invertible, where \(V=\operatorname{diag}\{\hat{\mu}_i(1-\hat{\mu}_i)\}\). The invertibility condition ensures that the covariate coefficients have estimable information.

Let \(e=Y-\hat{\mu}\) be the fitted null residual vector. At the null-model maximum-likelihood estimate, \(X'e=0\), so the observed genetic score is \(U=G'e\). However, its covariance for testing genetic effects must account for estimating \(\alpha\). The relevant information projection is

$$ P_X=V-VX(X'VX)^{-1}X'V. $$

This matrix adjusts the Bernoulli variance information for the covariate parameters. It is generally not an ordinary idempotent residual-maker like \(M_X\). The covariance of the efficient genetic score is \(\operatorname{Cov}(U)\approx G'P_XG\); the approximation refers to the usual score-test, large-sample normal approximation.

Result: For a binary trait, the covariate-adjusted SKAT statistic is \(Q=U'WU\), with \(U=G'(Y-\hat{\mu})\) at the fitted null model and score covariance \(G'P_XG\). Under the score-test approximation, the mixture weights are the eigenvalues of \(W^{1/2}G'P_XGW^{1/2}\), not generally the eigenvalues of \(G'P_XG\) alone.

Worked Example: Binary-Trait Covariance After Covariate Adjustment

Consider four hypothetical individuals with outcomes \(Y=(0,1,0,1)'\), covariate vector \(x=(-1,-1,1,1)'\), and genotype vector \(g=(0,1,1,2)'\). Let \(X\) contain an intercept and \(x\). The null logistic fit has \(\hat{\mu}_i=0.5\) for all four individuals: the residuals sum to zero and their inner product with \(x\) is zero, satisfying the null-model score equations. Thus \(V=0.25I\), and \(X'VX\) is invertible.

For this balanced design, \(X'X=4I_2\), so the adjusted information projection is \(P_X=0.25M_X\). The residualized genotype is \(M_Xg=(-0.5,0.5,-0.5,0.5)'\), with squared length 1. Hence \(g'P_Xg=0.25\). The observed residual-score and statistic, with \(w=2\), are

$$ U=g'(Y-\hat{\mu})=0+0.5-0.5+1=1, \qquad Q=wU^2=2(1^2)=2. $$

The single mixture weight is \(w g'P_Xg=2(0.25)=0.5\). Under the score-test approximation, \(Q\) is compared with \(0.5\chi^2_1\), so its nominal upper-tail p-value is \(P(\chi^2_1\geq 2/0.5)=P(\chi^2_1\geq4)\approx0.0455\). This calculation illustrates the adjustment algebra; a sample of four individuals is far too small to rely on the large-sample calibration for a real analysis.

Several Variants: The Full Weighted Covariance Matters

With multiple variants, the score components need not be independent. Correlation can arise because variants are correlated in the sample, because their genotype columns overlap after covariate adjustment, or both. The correct calibration uses the eigenvalues of the entire weighted score covariance matrix. Using the eigenvalues of the unweighted covariance alone discards the effect of \(W\); using the genotype information alone for a quantitative trait also discards \(\sigma^2\).

Worked Example: Two Quantitative-Trait Mixture Weights

Use the four-individual covariate design \(X=(\mathbf{1},x)\), with \(x=(-1,-1,1,1)'\), and trait values \(y=(1,2,2,5)'\). Let the two hypothetical genotype columns be \(g_1=(0,1,1,2)'\) and \(g_2=(1,0,0,1)'\). Take \(\sigma^2=2\) as known and \(W=\operatorname{diag}(1,4)\). Each genotype column is residualized against the intercept and \(x\), giving \(M_Xg_1=(-0.5,0.5,-0.5,0.5)'\) and \(M_Xg_2=(0.5,-0.5,-0.5,0.5)'\). Their squared lengths are both 1 and their inner product is 0; consequently \(G'M_XG=I_2\).

The null residuals are \(e=(-0.5,0.5,-1.5,1.5)'\). The two score components are \(U_1=g_1'e=2\) and \(U_2=g_2'e=1\). Thus

$$ Q=U'WU=(2)(2^2)+(4)(1^2)=12. $$

The covariance is \(\sigma^2G'M_XG=2I_2\). After applying the weights, the eigenvalues are those of \(W^{1/2}(2I_2)W^{1/2}=\operatorname{diag}(2,8)\). The null distribution is therefore \(2Z_1^2+8Z_2^2\), not a mixture with weights 1 and 1 or 2 and 2. The observed statistic 12 must be calibrated against this weighted mixture; it is not valid to compare it to a single ordinary chi-square distribution without accounting for the eigenvalues.

Practical Checks and a Common Mistake

The adjustment matrices encode which parts of the data remain informative about genetic effects after the covariates have been fitted. If a genotype column is fully explained by the covariates, its adjusted quantitative information is zero. For a binary trait, the analogous loss of information is reflected in \(G'P_XG\). Such a variant cannot contribute independent evidence beyond the covariate model.

A common error is to calculate \(Q\) from an adjusted score but use unadjusted eigenvalues, or to use the eigenvalues of \(\operatorname{Cov}(U)\) without incorporating \(W\). For quantitative traits, another frequent error is to omit the residual variance scale. The correction is to form the covariance appropriate to the fitted null model first, then form the weighted covariance and obtain its eigenvalues.

1
Fit the null model.
For a quantitative trait, fit \(y\) on \(X\). For a binary trait, fit the logistic model using \(X\), and check that the fitted probabilities and information matrix are well behaved.
2
Calculate the residual score and covariance.
Use \(U=G'M_Xy\) and \(\sigma^2G'M_XG\) for the stated quantitative model; use \(U=G'(Y-\hat{\mu})\) and \(G'P_XG\) for the binary score approximation.
3
Apply the variant weights to the covariance.
Find the eigenvalues of \(W^{1/2}\operatorname{Cov}(U)W^{1/2}\), not merely those of \(\operatorname{Cov}(U)\).
4
Calibrate the observed quadratic form.
Compare \(Q=U'WU\) with the mixture whose weights are those eigenvalues, using a calibration appropriate to the trait model and sample-size conditions.

The essential distinction is between the observed score and its null reference distribution. Covariates affect both. A p-value computed from an unadjusted covariance does not become valid simply because the observed residuals were adjusted.

Check Your Understanding

Answer each question by identifying both the adjustment and its effect on the SKAT null calibration.

  1. In the quantitative linear model, what matrix removes the fitted covariate component, and what is the covariance of the unscaled residual-score vector under \(H_0\)?
  2. For a quantitative trait with known \(\sigma^2\), which matrix supplies the mixture weights for \(Q=U'WU\)? Why must the variance scale appear?
  3. In a logistic null model, define \(P_X\) and explain why it is generally not the same kind of projection as \(M_X\).
  4. A two-variant analysis has \(\operatorname{Cov}(U)=I_2\) and \(W=\operatorname{diag}(1,4)\). What are the mixture weights for \(Q\)?
  5. Why does fitting covariates only to the trait, while calibrating with an unadjusted score covariance, produce an inconsistent test?
Clinical Biostats