Tutorials › High-Dimensional Genomic Data Analysis › Residual Diagnostics For Quantitative-Trait GWAS

Single-Variant GWAS · Tutorial 231 of 795

Residual Diagnostics For Quantitative-Trait GWAS

Use three diagnostic plots to assess quantitative-trait SNP model fit, identify influential observations, and separate model concerns from evidence about the SNP effect.

Intermediate 12 min read

What You'll Learn

  • State the assumptions behind ordinary least-squares diagnostics for a quantitative-trait SNP model.
  • Read residual-versus-fitted plots for systematic structure and possible mean-model misspecification.
  • Use a residual Q-Q plot to assess departures from the normal-error approximation.
  • Calculate leverage and Cook’s distance to flag potentially influential observations.
  • Explain why a diagnostic pattern does not by itself establish or refute SNP association.
  • Distinguish graphical diagnostics from formal tests and alternative analysis strategies.

Why Diagnose a Quantitative-Trait SNP Model?

A quantitative-trait SNP test fits a regression model to ask whether the phenotype changes with the coded genotype after accounting for specified covariates. A small p-value for the genotype coefficient is evidence against its null hypothesis under the fitted model and its assumptions. It does not show that the model describes the data adequately. Conversely, a pattern in a diagnostic plot can reveal a problem with the model without showing that the SNP is associated with the trait.

Residual diagnostics examine the differences between observed and fitted phenotypes, as well as how those differences relate to the fitted values and to the predictor configuration. The three plots considered here answer related but distinct questions: does the residual pattern suggest a misspecified conditional mean, are the residuals reasonably compatible with a normal-error approximation, and does one observation have disproportionate influence on the fitted regression?

Model and Diagnostic Assumptions

Definition: For individuals \(i=1,\ldots,n\), let \(Y_i\) be a quantitative phenotype, \(G_i\) the coded SNP genotype, and \(C_{ij}\) the \(j\)th included covariate. The additive linear model is $$ Y_i=\beta_0+\beta_G G_i+\sum_{j=1}^{q}\beta_j C_{ij}+\varepsilon_i. $$ The fitted value is \(\widehat{Y}_i\), and the ordinary least-squares residual is \(e_i=Y_i-\widehat{Y}_i\). The coefficient \(\beta_G\) is the expected change in phenotype units per one-unit increase in the genotype code, conditional on the included covariates, if the model is appropriate.

The model requires a suitably specified conditional mean: the expected phenotype given the genotype and covariates should follow the stated linear form. For the usual ordinary least-squares standard errors to have their standard interpretation, errors are also assumed to have conditional mean zero, to be independent across individuals, and to have constant conditional variance. Exact small-sample t-based inference additionally uses normally distributed errors conditional on the predictors. The model’s genotype coding and covariates must match the scientific question; plots cannot repair an inappropriate coding choice or an important omitted covariate.

Least-squares residuals are constrained by the fitted model. In a model with an intercept, they sum to zero and are orthogonal to every included predictor. These are algebraic properties of the fit, not proof that the model is correct. For plots, residuals may be displayed in phenotype units or scaled, for example by an estimate of the residual standard deviation. The vertical scale should be identified so that unusually large deviations are interpreted in context.

Residuals Versus Fitted Values

Plot \(e_i\) on the vertical axis against \(\widehat{Y}_i\) on the horizontal axis, and include a horizontal reference line at zero. If the conditional mean is adequately represented, the points should fluctuate around zero without a systematic curve or other structure. A smooth curve that bends away from zero can suggest a nonlinear mean relationship, a missing term, or an inappropriate coding of a predictor. A fan-shaped spread can suggest that residual variability changes with the fitted mean; this raises a variance concern, although the plot alone does not establish its cause.

In a SNP model, fitted values combine genotype and covariate contributions. A residual pattern can therefore reflect a problem with any part of the phenotype model, not necessarily with the SNP term. Looking at residuals against individual covariates or genotype can help localize a pattern, but it does not replace checking the model specification. A residual plot that looks irregular is not a test of the SNP null hypothesis.

Worked Example: Checking a Residual Pattern Against the OLS Fit

Consider hypothetical data from a linear model containing an intercept, a coded genotype \(G_i\), and a covariate \(C_i\). Suppose the six fitted values are \(10,12,14,16,18,20\) trait units, the genotype codes are \(0,0,0,1,1,1\), and the residuals are \(1,-1,0,0,-1,1\) trait units. The observed phenotypes are fitted value plus residual: \(11,11,14,16,17,21\) trait units.

Before interpreting the plot, check that the proposed residuals could arise from this least-squares fit. Their sum is $$ 1-1+0+0-1+1=0. $$ Their inner product with the genotype column is $$ 0(1)+0(-1)+0(0)+1(0)+1(-1)+1(1)=0. $$ Their inner product with the fitted-value column is $$ 10(1)+12(-1)+14(0)+16(0)+18(-1)+20(1)=0. $$ Thus the residuals satisfy the intercept, genotype, and fitted-direction orthogonality constraints. A covariate column equal to the displayed fitted-value direction, together with the intercept and genotype, gives a model design for which these fitted values and residuals are consistent.

On a residual-versus-fitted plot, the points lie above zero at fitted values 10 and 20, below zero at 12 and 18, and on zero at 14 and 16. The sequence may prompt a closer look for structure, but six points are too few to establish a curved mean pattern. The plot diagnoses a possible concern about the phenotype model; it does not show whether \(\beta_G\) is zero.

Residual Q-Q Plots

A normal Q-Q plot compares ordered, scaled residuals with the corresponding theoretical quantiles of a standard normal distribution. If the conditional errors are approximately normal, the plotted points should lie roughly along a straight reference line. Systematic curvature can indicate skewness; pronounced departures at the ends can indicate heavier or lighter tails than the normal reference. A few points away from the line are not, by themselves, decisive evidence of nonnormality, especially when the sample is small.

The Q-Q plot concerns the shape of the error distribution conditional on the predictors. It is not a plot of GWAS test statistics across variants and does not diagnose genome-wide calibration. Residuals are estimated quantities constrained by the regression fit, so their plotted shape is an imperfect view of the underlying errors. Normality matters most for the usual exact small-sample inference; departures do not automatically imply biased least-squares coefficient estimates, but can affect the accuracy of conventional inference.

Worked Example: Interpreting a Residual Q-Q Plot

Suppose a hypothetical additive genotype model has \(n=8\) individuals and two fitted parameters: an intercept and a genotype coefficient. There are two individuals at each of genotype codes 0 and 2, and four at code 1. The residuals within the genotype groups are respectively \((-1.4,1.4)\), \((-0.8,-0.4,0.4,0.8)\), and \((-1,1)\) trait units. Each group’s residuals sum to zero, so the residuals are orthogonal to both the intercept and genotype columns.

The residual sum of squares is $$ SSE=2(1.4^2)+2(1^2)+2(0.8^2)+2(0.4^2) =3.92+2+1.28+0.32=7.52. $$ The residual degrees of freedom are \(df=n-2=6\), so the residual mean square is \(7.52/6=1.253\), and its square root is approximately \(1.120\) trait units. Dividing the ordered residuals by this scale gives approximately \(-1.250,-0.893,-0.714,-0.357,0.357,0.714,0.893,1.250\).

These scaled residuals are symmetric about zero, so a Q-Q plot would show no obvious asymmetry from this feature alone. The conclusion is not that normality has been demonstrated: with eight observations, the plot has little power to distinguish many plausible error distributions. In practice, inspect the plotted points and the scientific data-generating context together.

Leverage and Influence

A residual measures vertical discrepancy from the fitted regression, while leverage measures how unusual an observation’s predictor values are relative to the rest of the design. An observation can have a large residual but ordinary leverage, or high leverage but a small residual. Influence describes how much the fitted model could change when an observation is removed; it depends on both discrepancy and leverage.

For a least-squares model with \(p\) fitted parameters, including the intercept, let \(h_{ii}\) be the leverage of observation \(i\), the \(i\)th diagonal element of the hat matrix. One commonly used summary is Cook’s distance:

$$ D_i=\frac{e_i^2}{p\,MSE}\frac{h_{ii}}{(1-h_{ii})^2}, \qquad MSE=\frac{\sum_{i=1}^{n}e_i^2}{n-p}. $$

A large Cook’s distance flags an observation whose removal could materially change the fitted coefficients. Rules of thumb, such as comparing \(D_i\) with \(4/(n-p)\) or checking whether it is near or above 1, are prompts for investigation, not universal rejection thresholds. High leverage alone does not prove influence, and an influential point is not automatically erroneous or appropriate to remove.

Worked Example: Calculating Cook’s Distance

Suppose a hypothetical fitted quantitative-trait SNP model has \(n=10\), \(p=3\) parameters, \(MSE=4\) trait-units-squared, and an observation with residual \(e_i=3\) trait units and leverage \(h_{ii}=0.60\). Its Cook’s distance is $$ D_i=\frac{3^2}{3(4)}\frac{0.60}{(1-0.60)^2} =\frac{9}{12}\frac{0.60}{0.16} =0.75(3.75)=2.813. $$

The common comparison value \(4/(n-p)\) is \(4/7\approx0.5714\), so this observation merits investigation. Its internally scaled residual is \(3/\sqrt{4(1-0.60)}=3/\sqrt{1.6}\approx2.372\), while its leverage is also high. The combination explains why the point may be influential. Check phenotype measurement, genotype calls, covariate values, and data processing; then assess whether the SNP coefficient changes substantially in a documented sensitivity analysis. The calculation does not justify deleting the observation or establish association.

Using the Plots Together

1
Check the residual-versus-fitted plot.
Look for curvature, grouping, or changing spread that may indicate a problem with the conditional mean or variance assumptions.
2
Inspect the Q-Q plot.
Look for systematic departures from the normal reference, especially substantial skewness or tail deviations, while recognizing the limits of the sample size.
3
Review leverage and influence.
Identify observations with unusual predictor configurations and determine whether their residuals make them influential.
4
Return to the scientific model.
Check coding, measurements, covariates, and the intended phenotype model before deciding what sensitivity analysis or alternative model is justified.

These views are complementary, not interchangeable. A formal test for a particular assumption can supplement graphical assessment, but it tests a specified feature and can be sensitive to sample size. A plot can reveal structure a single test does not target, but visual judgment is subjective. If a variance pattern is apparent, the usual standard errors may be unreliable; the appropriate treatment of heteroskedasticity is a separate modeling decision, not a conclusion supplied by the plot. Robust or alternative models should be selected to address the identified problem and reported transparently.

DiagnosticMain questionWhat it does not establish
Residual versus fittedIs there structure suggesting a misspecified mean or changing spread?Whether the SNP coefficient is nonzero
Residual Q-QAre residuals reasonably compatible with a normal-error approximation?Genome-wide test calibration or normality with certainty
Leverage and influenceCould an unusual predictor configuration and residual materially affect the fit?That an observation is erroneous or should be deleted
Genotype coefficient testIs the fitted genotype effect distinguishable from its null value under the model?That all model assumptions are adequate

Common Pitfalls and Limitations

  • Calling a diagnostic pattern association evidence. A curved residual pattern concerns model fit; it is not a test of \(H_0:\beta_G=0\). Test the genotype coefficient under an appropriate model.
  • Treating a straight Q-Q plot as proof of normality. Many distributions can look nearly linear in a modest sample. Report the diagnostic as an assessment, not a certification.
  • Deleting an influential observation automatically. Influence is a reason to verify and investigate. Exclusion requires a defensible data or scientific reason, not merely a change in the p-value.
  • Assuming residuals must look perfectly patternless. Random variation can produce visible irregularities, particularly with few observations. Interpret shape in light of sample size and the full predictor structure.
  • Confusing phenotype residuals with association-scan quantiles. These residual plots examine one fitted phenotype model. They are not summaries of test statistics across many SNPs.

Diagnostics are limited by the observed sample and by the model that generated them. They cannot identify every omitted variable, resolve confounding, or establish that a genotype association is causal. A useful conclusion is specific: name the pattern, state which assumption or modeling component it raises concern about, and describe what was checked next.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. A residual-versus-fitted plot shows a smooth U-shaped pattern around zero. What model feature might be inadequate, and does the pattern establish SNP association?
  2. A Q-Q plot has a few points departing from the reference line at both ends, but the sample is small. What is a defensible conclusion?
  3. An observation has high leverage but a residual close to zero. Is it necessarily influential? Explain.
  4. For \(n=20\), \(p=4\), \(MSE=2\), \(e_i=2\), and \(h_{ii}=0.50\), calculate Cook’s distance and compare it with \(4/(n-p)\).
  5. Why should an observation with a large Cook’s distance not be removed solely because the SNP p-value changes when it is omitted?

Solutions. (1) The conditional mean may be nonlinear or a term may be missing; the pattern is a model-fit warning, not evidence that the SNP effect is nonzero. (2) Note possible tail departures but acknowledge that a small sample gives limited evidence; the plot neither proves nor rules out normal errors. (3) No. High leverage describes an unusual predictor configuration; with a residual near zero, its influence may be limited, so inspect a combined measure such as Cook’s distance. (4) \(D_i=[2^2/(4\cdot2)]\,[0.50/(1-0.50)^2]=0.5(2)=1.000\). The comparison value is \(4/16=0.2500\), so the observation is a strong investigation flag, not an automatic exclusion. (5) A p-value change does not show the observation is erroneous. Verify the data and report a justified sensitivity analysis; exclusion requires an independent, defensible reason.

Clinical Biostats