Why Derive the Score?
A gene-level score test begins with a model for how several variant effects contribute to a phenotype. In a burden model, variant effects are combined into a single direction; a variance-component model instead allows their effects to vary around zero. The score for that variance component reveals exactly how the genotype data, variant weights, and departures from the null phenotype model combine in the test.
This derivation uses a Gaussian phenotype model with a linear mean and a variance component for variant effects. It establishes the score and its residual and trace terms. It does not require the variance component to be estimated under the alternative: a score test evaluates the derivative of the likelihood at the null value, where the variant-effect variance is zero.
The columns of \(G\) contain the observed genotype counts, conventionally coded as 0, 1, or 2 copies of an allele, subject to the chosen analysis coding. The weight \(w_j\) sets the relative variance assigned to variant \(j\)'s effect. Thus, if \(w_j=0\), that variant contributes no random-effect variance in this model. The matrix \(W\) describes effect variance, not observed genotype variation.
From Variant Effects to a Phenotype Covariance
Marginalizing over the random vector \(b\) gives a model for the phenotype alone. Since \(E(b)=0\), the marginal mean is \(X\gamma\). Independence of \(b\) and \(\varepsilon\), together with their covariance matrices, gives
The \(n\times n\) matrix \(K\) is the covariance pattern contributed by the variants before multiplication by the variance-component parameter \(\tau\). Its entry for individuals \(i\) and \(i'\) is \(K_{ii'}=\sum_{j=1}^m w_jG_{ij}G_{i'j}\). This identity follows by multiplying the matrices in \(GWG^\mathsf{T}\); it also shows why both the genotypes and the weights determine the covariance.
Under \(H_0\), \(\tau=0\), so the variants do not add a covariance component and the phenotype model reduces to the null model with mean \(X\gamma\) and residual variance \(\sigma^2\). Define the null-model residuals as \(r=y-X\hat\gamma_0\), where \(\hat\gamma_0\) is the null-model estimate of the covariate coefficients. The residuals are not generally the raw phenotypes: covariate-associated mean structure must first be accounted for.
Worked Example: Constructing the Variant Covariance Matrix
Suppose three hypothetical individuals have two genotype columns and the variant-effect weights are \(w_1=1\) and \(w_2=0.25\):
The rows of \(G\) are the genotype vectors \((0,1)\), \((1,0)\), and \((1,1)\). First multiply each genotype column by its corresponding weight through \(W\), then form \(K=GWG^\mathsf{T}\):
For example, the covariance-pattern entry for individuals 1 and 3 is \(K_{13}=1(0)(1)+0.25(1)(1)=0.25\). The diagonal entry for individual 3 is \(K_{33}=1(1)^2+0.25(1)^2=1.25\). These values describe the covariance pattern associated with a unit of \(\tau\); the actual added covariance is \(\tau K\).
Deriving the Likelihood Score
Write \(V(\tau)=\sigma^2I+\tau K\). If the mean \(X\gamma\) were known, the Gaussian log likelihood, apart from a constant, would be \(-\tfrac12\{\log|V|+(y-X\gamma)^\mathsf{T}V^{-1}(y-X\gamma)\}\). Differentiating with respect to \(\tau\) uses \(\frac{d}{d\tau}\log|V|=\operatorname{tr}(V^{-1}K)\) and \(\frac{d}{d\tau}V^{-1}=-V^{-1}KV^{-1}\). Therefore, at any \(\tau\), the derivative is
The first term rewards alignment between the phenotype departures and the covariance pattern \(K\); the trace term accounts for the increase in covariance that the model would impose even when the data do not show such alignment. A score test evaluates this derivative under the null model, using null estimates of nuisance parameters.
When covariate coefficients are estimated, the exact trace term depends on the likelihood formulation. For ordinary likelihood with the mean profiled out, define \(P=V^{-1}-V^{-1}X(X^\mathsf{T}V^{-1}X)^{-1}X^\mathsf{T}V^{-1}\), assuming \(X\) has full column rank. The profiled likelihood score is
In particular, the quadratic term uses \(P\), but the trace term remains \(\operatorname{tr}(V^{-1}K)\). Restricted maximum likelihood (REML) uses a different likelihood, based on contrasts that remove the fixed-effect mean. Its score is
These are distinct score formulas. The REML trace term is not obtained by merely replacing \(V^{-1}\) by \(P\) in the ordinary profiled-likelihood score; it comes from differentiating the restricted likelihood. Keeping the distinction explicit prevents a seemingly small algebraic change from combining terms from two different likelihoods.
The Null Score and the SKAT Quadratic Component
At \(\tau=0\), \(V=\sigma^2I\), and \(P=\sigma^{-2}M\), where \(M=I-X(X^\mathsf{T}X)^{-1}X^\mathsf{T}\) is the residual-maker matrix. It projects a vector onto the space orthogonal to the columns of \(X\). Under REML, let \(r=My\). Substitution into the REML score gives
The first term, \(r^\mathsf{T}Kr\), is the central phenotype-genotype quadratic component. To see its variant-level form, substitute \(K=GWG^\mathsf{T}\):
where \(G_j\) is column \(j\) of \(G\). Thus, each variant contributes its weight times the square of its null-model residual score. Unlike a signed sum of variant scores, this quadratic component does not cancel simply because some variant scores are positive and others are negative.
The full likelihood score also contains a centering term. Under REML, that term is \(\sigma^2\operatorname{tr}(MK)\) in the displayed null expression; it is the null expectation of \(r^\mathsf{T}Kr\) when the Gaussian residual covariance is \(\sigma^2M\). In many presentations, the SKAT quadratic statistic is written \(Q=r^\mathsf{T}Kr\), while its null calibration accounts for the null distribution of that quadratic form. The score derivation explains where \(Q\) comes from; the centered likelihood score and the reported quadratic statistic should not be silently treated as identical quantities.
Worked Example: Computing a REML Score With an Intercept
Use the \(G\), \(W\), and \(K\) from the first example. Suppose the hypothetical phenotypes are \(y=(2,0,1)^\mathsf{T}\), the only covariate is an intercept, and the null residual variance is \(\sigma^2=1\). The fitted null mean is \(\bar{x}=1\), so \(r=(1,-1,0)^\mathsf{T}\). The intercept residual-maker is \(M=I-\mathbf{1}\mathbf{1}^\mathsf{T}/3\).
First compute the quadratic component. From the displayed \(K\), \(Kr=(0.25,-1,-0.75)^\mathsf{T}\), hence \(r^\mathsf{T}Kr=(1)(0.25)+(-1)(-1)+(0)(-0.75)=1.25\). For the trace term, \(\operatorname{tr}(K)=0.25+1+1.25=2.5\), and the sum of all entries of \(K\) is \(5\). Therefore \(\operatorname{tr}(MK)=\operatorname{tr}(K)-\tfrac13\mathbf{1}^\mathsf{T}K\mathbf{1}=2.5-\tfrac53=\tfrac56\).
The REML score is consequently \(U_{\mathrm{REML},0}=\tfrac12\{1.25-\tfrac56\}=\tfrac{5}{24}\approx0.2083\). This positive derivative indicates that, at the null value, the REML log likelihood initially increases as \(\tau\) moves in the positive direction.
For contrast, with the same \(\sigma^2=1\), the ordinary likelihood profiled over the intercept has score \(\tfrac12\{r^\mathsf{T}Kr-\operatorname{tr}(K)\}=\tfrac12(1.25-2.5)=-0.625\). The different trace terms produce different numerical scores here. This is not an arithmetic discrepancy: one calculation differentiates the restricted likelihood and the other differentiates the ordinary likelihood with its mean profiled out.
Worked Example: One Variant and the Direction of the Score
Consider a simplified hypothetical model with no covariates, one variant, \(G=(0,1)^\mathsf{T}\), weight \(w_1=1\), and \(\sigma^2=1\). Let \(y=(0,2)^\mathsf{T}\). Then \(K=GWG^\mathsf{T}=\begin{pmatrix}0&0\\0&1\end{pmatrix}\), and the variant score is \(G^\mathsf{T}y=2\).
The quadratic component is \(Q=y^\mathsf{T}Ky=(G^\mathsf{T}y)^2=4\), while \(\operatorname{tr}(K)=1\). With the mean specified and no covariates, the likelihood score at \(\tau=0\) is \(U_{\tau,0}=\tfrac12\{Q-\operatorname{tr}(K)\}=\tfrac12(4-1)=1.5\). The positive derivative points toward an increase in likelihood for a small positive variance component.
If instead \(y=(0,0)^\mathsf{T}\), then \(Q=0\) and the score is \(\tfrac12(0-1)=-0.5\). This negative derivative does not imply a negative variance estimate: the model restricts \(\tau\geq0\), so a negative score at the boundary points away from the allowed positive direction. The example also makes clear that the likelihood score includes a trace correction even when the quadratic component alone is zero.
Assumptions, Interpretation, and a Common Pitfall
The derivation assumes the specified Gaussian model, independent residual errors with covariance \(\sigma^2I\), a correctly specified null mean \(X\gamma\), and a random variant-effect vector with mean zero and covariance \(\tau W\). The weights are fixed for the test, and \(W\) must be positive semidefinite for it to define a valid covariance. The genotype matrix and phenotype residuals must refer to the same individuals in the same row order. If residual covariance is not \(\sigma^2I\), the corresponding null covariance must be modeled and used in \(V\) and \(P\), rather than applying the identity-covariance expressions without adjustment.
A score is a local likelihood derivative, not an estimated effect size and not, by itself, a p-value. A positive value means the chosen likelihood initially rises in the positive-\(\tau\) direction at the null; it does not establish causation, identify an associated variant, or quantify a phenotype change per allele. The test evaluates a gene-level variance component, and its calibration must reflect the null distribution of the statistic.
Common pitfall: A frequent error is to write the profile-likelihood quadratic term with \(P\) and then replace the trace term by \(\operatorname{tr}(PK)\), as though both changes followed from profiling out the mean. They do not. For ordinary likelihood with the mean profiled out, the score is \(\tfrac12\{y^\mathsf{T}PKPy-\operatorname{tr}(V^{-1}K)\}\). The score with \(\operatorname{tr}(PK)\) is the REML score, derived from the restricted likelihood. State which likelihood is being differentiated before using its formula.
A second related error is to call \(Q=r^\mathsf{T}Kr\) the entire likelihood score. It is the quadratic component that connects residual variant scores to the SKAT statistic, but the variance-component likelihood score also has a trace term and a scale factor. Keeping these objects distinct clarifies both the derivation and the role of null calibration.
Check Your Understanding
Answer each question by referring to the model and formulas above.
- What dimensions do \(G\), \(W\), and \(K=GWG^\mathsf{T}\) have when there are \(n\) individuals and \(m\) variants?
- In the random-effects model, what does \(w_j\) control, and what does \(\tau\) control?
- Why does \(r^\mathsf{T}Kr\) equal a weighted sum of squared variant residual scores?
- For ordinary likelihood with the mean profiled out, what trace term belongs in the score? How does the REML trace term differ?
- Does a negative score at \(\tau=0\) mean the fitted variance component should be negative? Explain in relation to the parameter space.