Tutorials › Statistical Genetics › Worked Quantitative-Trait Association Calculations

Single-Variant Association Tests · Tutorial 314 of 989

Worked Quantitative-Trait Association Calculations

Learn to calculate and interpret single-variant quantitative-trait associations from genotype-group counts, means, and within-group variability.

Intermediate 10 min read

What You'll Learn

  • Calculate an additive per-allele slope from genotype counts and phenotype group means
  • Recover residual sums of squares and standard errors from group summaries
  • Estimate genotype-specific effects relative to a reference group
  • Construct confidence intervals and perform slope, contrast, and omnibus tests
  • Distinguish an additive trend from a categorical genotype association

From Genotype Summaries to Association Results

A quantitative-trait association calculation often begins with a compact summary: the number of participants in each genotype group, the mean phenotype in each group, and the within-group variability. These summaries can be enough to estimate regression effects, quantify their uncertainty, and test association. The calculation depends on the genetic model: coding genotype as a dosage estimates a linear per-allele trend, while treating genotype as a category allows each group to have its own mean.

The examples below use hypothetical data and an unadjusted analysis of one variant. The phenotype is measured in trait units. A genotype dosage \(x\) counts copies of a specified allele, so \(x=0,1,2\) for the three genotypes. The dosage model assumes the mean phenotype changes linearly with that count. The categorical model does not impose that pattern.

Definition: In an additive linear association model, \(Y_i=\beta_0+\beta_1x_i+\epsilon_i\), where \(Y_i\) is the quantitative phenotype for participant \(i\), \(x_i\) is the allele dosage, \(\beta_0\) is the mean at dosage zero, and \(\beta_1\) is the change in mean phenotype per additional allele. In a categorical genotype model, genotype is represented by indicator variables, and each genotype group can have a distinct mean.

Assumptions and Summary Formulas

For the classical standard errors, confidence intervals, and tests in this tutorial, assume participants are independent, the genotype coding is correct, and the errors have mean zero and a common variance across genotype groups. For exact small-sample \(t\) and \(F\) reference distributions, also assume normally distributed errors conditional on genotype. These assumptions concern the statistical analysis; they do not make an observational association causal.

For the additive model, write \(n_g\) for the count with dosage \(g\), \(\bar{y}_g\) for that group’s phenotype mean, and \(W_g\) for its within-group sum of squared deviations from the mean. Let \(N=n_0+n_1+n_2\), and let \(\bar{x}\) and \(\bar{y}\) be the overall means. Group summaries give the regression quantities directly:

$$ S_{xx}=\sum_{g=0}^{2}n_g(g-\bar{x})^2,\qquad S_{xy}=\sum_{g=0}^{2}n_g(g-\bar{x})(\bar{y}_g-\bar{y}),\qquad \hat{\beta}_1=\frac{S_{xy}}{S_{xx}}. $$

The fitted intercept is \(\hat{\beta}_0=\bar{y}-\hat{\beta}_1\bar{x}\). To obtain the residual sum of squares, combine the variability within genotype groups with any lack of fit of the dosage line to the three group means:

$$ SSE=\sum_{g=0}^{2}W_g+ \sum_{g=0}^{2}n_g(\bar{y}_g-\hat{\beta}_0-\hat{\beta}_1g)^2,\qquad MSE=\frac{SSE}{N-2},\qquad SE(\hat{\beta}_1)=\sqrt{\frac{MSE}{S_{xx}}}. $$

The dosage-slope test uses \(H_0:\beta_1=0\), with \(t=\hat{\beta}_1/SE(\hat{\beta}_1)\) and \(df=N-2\). A two-sided confidence interval is \(\hat{\beta}_1\pm t^*SE(\hat{\beta}_1)\), where \(t^*\) is the appropriate critical value.

For a categorical model with dosage zero as the reference, the fitted means can be written \(\mu_0\), \(\mu_0+\delta_1\), and \(\mu_0+\delta_2\) for genotypes 0, 1, and 2. The estimates are \(\hat{\mu}_0=\bar{y}_0\), \(\hat{\delta}_1=\bar{y}_1-\bar{y}_0\), and \(\hat{\delta}_2=\bar{y}_2-\bar{y}_0\). The common residual variance estimate is \(MSE=\sum_g W_g/(N-3)\). The standard error for a difference from the reference is \(\sqrt{MSE(1/n_g+1/n_0)}\). The omnibus test of equal genotype means uses an \(F\) statistic with 2 and \(N-3\) degrees of freedom.

Worked Calculations

Worked Example: Additive Per-Allele Effect

In a hypothetical sample, the phenotype summaries are:

Dosage \(g\)Count \(n_g\)Mean \(\bar{y}_g\) (trait units)Within-group sum \(W_g\) (trait units squared)
0201019
1301229
210149

There are \(N=60\) participants. The dosage mean is \(\bar{x}=(0(20)+1(30)+2(10))/60=0.8333\), and the phenotype mean is \(\bar{y}=(20(10)+30(12)+10(14))/60=11.667\). Thus,

$$ S_{xx}=20(0-0.8333)^2+30(1-0.8333)^2+10(2-0.8333)^2=28.333, $$
$$ S_{xy}=20(0-0.8333)(10-11.667)+30(1-0.8333)(12-11.667)+10(2-0.8333)(14-11.667)=56.667. $$

Therefore, \(\hat{\beta}_1=56.667/28.333=2.000\) trait units per additional allele. The intercept is \(11.667-2.000(0.8333)=10.00\) trait units. The three group means lie exactly on the fitted dosage line, so the between-group lack-of-fit component of \(SSE\) is zero. The residual sum of squares is \(19+29+9=57\), giving \(MSE=57/(60-2)=0.9828\) and:

$$ SE(\hat{\beta}_1)=\sqrt{0.9828/28.333}=0.1862\text{ trait units per allele}. $$

The test statistic is \(t=2.000/0.1862=10.74\), with 58 degrees of freedom and a two-sided \(p\)-value below 0.0001. Using \(t^*\approx2.002\), the 95% confidence interval is \(2.000\pm2.002(0.1862)=[1.627,2.373]\) trait units per allele. Under the additive model, the estimated mean increases by about 2 trait units for each additional copy of the allele.

Worked Example: Categorical Effects and an Omnibus Test

In a second hypothetical sample, each genotype group has 12 participants. The phenotype means are 5, 7, and 6 trait units for dosages 0, 1, and 2, respectively, and each group has within-group sum of squares \(W_g=11\). The categorical model uses dosage zero as the reference.

The estimated effects relative to dosage zero are \(\hat{\delta}_1=7-5=2\) trait units and \(\hat{\delta}_2=6-5=1\) trait unit. There are \(N=36\) participants, so \(MSE=(11+11+11)/(36-3)=1.000\) trait unit squared. For either reference-group contrast, the standard error is:

$$ SE=\sqrt{1.000(1/12+1/12)}=0.4082\text{ trait units}. $$

For dosage 1 versus dosage 0, \(t=2/0.4082=4.899\), with 33 degrees of freedom. The 95% interval, using \(t^*\approx2.034\), is \(2\pm2.034(0.4082)=[1.170,2.830]\) trait units. For dosage 2 versus dosage 0, \(t=1/0.4082=2.449\); the corresponding interval is \(1\pm2.034(0.4082)=[0.170,1.830]\) trait units. These are individual contrast tests and intervals, not a single test of all genotype differences.

For the omnibus test, the overall mean is \((5+7+6)/3=6\) trait units. The between-group sum of squares is \(12[(5-6)^2+(7-6)^2+(6-6)^2]=24\). Thus \(F=(24/2)/1=12.00\), with 2 and 33 degrees of freedom; the \(p\)-value is approximately 0.00012. This test rejects equal means across the three genotype groups. It does not require the group means to follow a per-allele linear trend.

Checking the Calculations and Choosing the Interpretation

The additive slope is a weighted linear trend across the three dosage means, not necessarily the difference between any particular pair of groups. One way to verify the summary calculation is to note that the fitted line passes through \((\bar{x},\bar{y})\), and its slope is the phenotype–dosage cross-product divided by the dosage sum of squares. For residual variability, a group mean that falls away from the fitted line contributes additional squared error beyond the variation among participants within that group.

Justification: Within group \(g\), write each phenotype as \(Y_i=\bar{y}_g+(Y_i-\bar{y}_g)\). The residual from the fitted line is the sum of \((Y_i-\bar{y}_g)\) and \((\bar{y}_g-\hat{\beta}_0-\hat{\beta}_1g)\). When squared and summed within that group, the cross-product is zero because \(\sum_i(Y_i-\bar{y}_g)=0\). The remaining terms are \(W_g+n_g(\bar{y}_g-\hat{\beta}_0-\hat{\beta}_1g)^2\); summing over groups gives the stated \(SSE\) formula.

Worked Example: A Trend Can Differ From Group-Specific Effects

A third hypothetical sample has 10 participants at each dosage, phenotype means 4, 7, and 7 trait units, and \(W_g=18\) trait units squared in every group. The overall means are \(\bar{x}=1\) and \(\bar{y}=6\). The additive sums of squares are \(S_{xx}=10(1+0+1)=20\) and \(S_{xy}=10[(-1)(-2)+0(1)+1(1)]=30\). Hence \(\hat{\beta}_1=30/20=1.500\) trait units per allele and \(\hat{\beta}_0=6-1.500(1)=4.500\) trait units.

The fitted means are 4.5, 6.0, and 7.5. Their differences from the observed group means are \(-0.5\), \(1.0\), and \(-0.5\). The lack-of-fit sum is \(10[(-0.5)^2+1.0^2+(-0.5)^2]=15\), so \(SSE=54+15=69\), \(MSE=69/(30-2)=2.464\), and \(SE(\hat{\beta}_1)=\sqrt{2.464/20}=0.3510\) trait units per allele. The slope test gives \(t=1.500/0.3510=4.274\), with 28 degrees of freedom and a two-sided \(p\)-value of about 0.0002. Its 95% interval is \(1.500\pm2.048(0.3510)=[0.781,2.219]\) trait units per allele.

The categorical model has residual sum of squares \(54\) and \(MSE=54/(30-3)=2.000\). Its between-group sum of squares is \(10[(4-6)^2+(7-6)^2+(7-6)^2]=60\), so \(F=(60/2)/2=15.00\), with 2 and 27 degrees of freedom. The categorical test asks whether all three means are equal; the slope test asks whether the linear dosage trend is zero. They are different hypotheses. Here the group means show a rise followed by a plateau, so the slope summarizes an average trend rather than reproducing every group mean.

Common Pitfalls and Practical Interpretation

  • Treating the dosage slope as every genotype contrast. A slope of 1.5 trait units per allele does not assert that each adjacent pair of genotype means differs by exactly 1.5. That interpretation follows only when the additive mean model is appropriate.
  • Using a categorical model but reporting an additive effect. Categorical coefficients are differences from the chosen reference group. They are not per-allele slopes.
  • Omitting the lack-of-fit component. In the additive model, adding only the within-group sums \(W_g\) gives the correct \(SSE\) only when the observed group means lie exactly on the fitted dosage line.
  • Interpreting a small \(p\)-value as a large effect or as causation. A \(p\)-value measures compatibility of the data with a specified null model; it does not give the size or practical importance of an effect and does not establish that the variant causes the trait.

For an additive result, report the estimated change in phenotype units per allele, its standard error or confidence interval, and the test used. For a categorical result, report the reference genotype, each contrast in phenotype units, and—when the question concerns any genotype association—the omnibus test. State the genetic coding and analysis assumptions so the meaning of the estimate is clear.

Check Your Understanding

Use the definitions and calculations above to answer these questions.

  1. In the additive model, what does a slope of \(-0.8\) phenotype units per allele mean in context?
  2. Why can the additive-model \(SSE\) exceed the sum of the within-genotype sums of squares?
  3. In a categorical model with dosage zero as the reference, what does the coefficient for dosage two represent?
  4. What null hypothesis is tested by the categorical omnibus \(F\) test?
  5. Why are the additive slope test and categorical omnibus test not interchangeable?
Clinical Biostats