Tutorials › Statistical Genetics › R-Squared as Allelic Correlation

Haplotypes and Linkage Disequilibrium · Tutorial 124 of 989

R-Squared as Allelic Correlation

Learn why squared allelic correlation is a standardized measure of how well an allele at one locus predicts an allele at another.

Intermediate 10 min read

What You'll Learn

  • Define allele indicators on a randomly selected haplotype and connect their covariance to linkage disequilibrium, D
  • Derive the formula for r-squared from the four haplotype frequencies
  • Calculate r-squared for positive, negative, zero, and perfect allelic association
  • Interpret r-squared as the fraction of variance in one allele indicator explained by linear prediction from the other
  • Recognize why r-squared is undefined at a monomorphic locus and why it does not measure classification accuracy or causation

Why Square the Allelic Correlation?

At two biallelic loci, linkage disequilibrium \(D\) records how the frequency of a particular haplotype differs from the frequency expected under independence. Its sign distinguishes excess from deficit of that haplotype, but the magnitude of \(D\) depends on the allele frequencies at both loci. Squared allelic correlation, written \(r^2\), standardizes this association by the variation available at each locus.

The result has a useful interpretation: \(r^2\) is the proportion of variation in one binary allele indicator accounted for by its best linear prediction from the other. It ranges from zero to one when both loci are polymorphic. It is not a percentage of alleles classified correctly, and it does not imply that one locus causes variation at the other.

Allele Indicators and Haplotype Frequencies

Consider two biallelic loci, with alleles \(A\) and \(a\) at the first locus and \(B\) and \(b\) at the second. A haplotype specifies one allele at each locus, so the four possible haplotypes are \(AB\), \(Ab\), \(aB\), and \(ab\). Let their population frequencies be \(p_{AB}\), \(p_{Ab}\), \(p_{aB}\), and \(p_{ab}\); they are nonnegative and sum to one.

Imagine selecting one haplotype at random from this population. Define \(X=1\) if it carries \(A\), and \(X=0\) if it carries \(a\). Define \(Y=1\) if it carries \(B\), and \(Y=0\) if it carries \(b\). These are binary random variables on the same haplotype. Their means are the allele frequencies \(p_A=P(X=1)=p_{AB}+p_{Ab}\) and \(p_B=P(Y=1)=p_{AB}+p_{aB}\).

Definition: For two biallelic loci, the allelic correlation \(r\) is the Pearson correlation between the allele indicators \(X\) and \(Y\) on a randomly selected haplotype. When both loci are polymorphic, its square is $$ r^2=\frac{D^2}{p_A(1-p_A)p_B(1-p_B)}, \qquad D=p_{AB}-p_Ap_B. $$ Here \(D\) is the linkage-disequilibrium coefficient for the \(AB\) haplotype. The squared correlation \(r^2\) is dimensionless, whereas \(r\) retains the sign of \(D\).

The definition requires \(0<p_A<1\) and \(0<p_B<1\), so that both allele indicators have positive variance. If either locus is monomorphic, its indicator has zero variance and a correlation with it is undefined. The population-level definition concerns haplotypes; it does not require Hardy–Weinberg equilibrium of diploid genotypes. In particular, the correlation here is not automatically the correlation between two genotype counts in a diploid sample.

Deriving the Formula

Because \(X\) and \(Y\) equal one together exactly for the \(AB\) haplotype, their product has expectation \(E(XY)=p_{AB}\). The covariance is therefore the observed joint frequency minus the product of the marginal frequencies:

$$ \operatorname{Cov}(X,Y) =E(XY)-E(X)E(Y) =p_{AB}-p_Ap_B =D. $$

A binary indicator with probability \(p\) of being one has variance \(p(1-p)\). Thus \(\operatorname{Var}(X)=p_A(1-p_A)\) and \(\operatorname{Var}(Y)=p_B(1-p_B)\). Substituting these variances and the covariance into the definition of Pearson correlation gives:

$$ r=\frac{\operatorname{Cov}(X,Y)} {\sqrt{\operatorname{Var}(X)\operatorname{Var}(Y)}} =\frac{D}{\sqrt{p_A(1-p_A)p_B(1-p_B)}}. $$

Squaring this expression yields the stated formula for \(r^2\). The denominator adjusts the covariance for the amount of variation possible at each locus. Consequently, two pairs of loci can have the same \(D\) but different \(r^2\) if their allele frequencies differ.

Worked Examples

Worked Example: Positive Allelic Correlation

Suppose a hypothetical population has haplotype frequencies \(p_{AB}=0.42\), \(p_{Ab}=0.18\), \(p_{aB}=0.08\), and \(p_{ab}=0.32\). These frequencies are nonnegative and sum to \(1.00\). Calculate \(r^2\).

First find the allele frequencies: \(p_A=0.42+0.18=0.60\) and \(p_B=0.42+0.08=0.50\). Then \(D=p_{AB}-p_Ap_B=0.42-(0.60)(0.50)=0.12\).

Substitute into the formula:

$$ r^2= \frac{(0.12)^2}{(0.60)(0.40)(0.50)(0.50)} =\frac{0.0144}{0.0600} =0.240. $$

The corresponding signed correlation is \(r=\sqrt{0.240}\approx 0.490\), because \(D\) is positive. In this population, the linear prediction of the \(B\)-allele indicator from the \(A\)-allele indicator accounts for 24.0% of the variance in that indicator.

Worked Example: Negative Correlation and the Same Squared Measure

In a second hypothetical population, let \(p_{AB}=0.10\), \(p_{Ab}=0.40\), \(p_{aB}=0.35\), and \(p_{ab}=0.15\). The frequencies sum to \(1.00\). Calculate \(r\) and \(r^2\), and interpret their signs and magnitudes.

The marginal frequencies are \(p_A=0.10+0.40=0.50\) and \(p_B=0.10+0.35=0.45\). Thus \(D=0.10-(0.50)(0.45)=-0.125\). The denominator of \(r^2\) is \((0.50)(0.50)(0.45)(0.55)=0.061875\), so:

$$ r^2=\frac{(-0.125)^2}{0.061875} =\frac{0.015625}{0.061875} \approx 0.253, \qquad r\approx-\sqrt{0.253}\approx-0.503. $$

The negative \(r\) indicates that \(A\) and \(B\) occur together less often than expected under independence. Squaring removes that direction: \(r^2\approx0.253\) says that the linear prediction accounts for about 25.3% of the variance in the \(B\)-allele indicator. The value of \(r^2\) alone would not distinguish this negative association from a positive association of equal magnitude.

Worked Example: Perfect Allelic Prediction

Suppose a hypothetical population contains only \(AB\) and \(ab\) haplotypes, with frequencies \(p_{AB}=0.35\) and \(p_{ab}=0.65\); the other two haplotype frequencies are zero. Both loci are polymorphic. Here \(p_A=p_B=0.35\) and \(D=0.35-(0.35)(0.35)=0.2275\).

The squared correlation is:

$$ r^2= \frac{(0.2275)^2}{(0.35)(0.65)(0.35)(0.65)} =1. $$

Every haplotype carrying \(A\) also carries \(B\), and every haplotype carrying \(a\) carries \(b\). In fact, \(X=Y\) on every haplotype, so \(r=1\). This is perfect prediction of one allele indicator from the other in this population. It does not mean that the loci are causally related.

Worked Example: Independence and Zero Correlation

For a final hypothetical population, let the haplotype frequencies be \(0.30\) for \(AB\), \(0.20\) for \(Ab\), \(0.30\) for \(aB\), and \(0.20\) for \(ab\). They sum to \(1.00\), and \(p_A=0.50\), \(p_B=0.60\). The expected \(AB\) frequency under independence is \((0.50)(0.60)=0.30\), exactly the observed frequency.

Therefore \(D=0.30-0.30=0\), and

$$ r^2=\frac{0^2}{(0.50)(0.50)(0.60)(0.40)}=0. $$

There is no linear association between the two allele indicators in this population. For two biallelic loci, \(D=0\) also means the haplotype frequencies factor into the product of the allele frequencies, so the indicators are independent.

Why \(r^2\) Is a Prediction Measure

The linear-prediction interpretation follows directly from regression with an intercept. Regress \(Y\), the indicator for \(B\), on \(X\), the indicator for \(A\). The least-squares slope is \(\operatorname{Cov}(X,Y)/\operatorname{Var}(X)\), and the fitted value is the conditional mean of \(Y\) at each value of \(X\). The variance of those fitted values is:

$$ \operatorname{Var}(\widehat{Y}) =\left(\frac{\operatorname{Cov}(X,Y)}{\operatorname{Var}(X)}\right)^2 \operatorname{Var}(X) =\frac{\operatorname{Cov}(X,Y)^2}{\operatorname{Var}(X)}. $$

In a linear regression with an intercept, \(R^2\) is the fitted-value variance divided by the outcome variance. Hence:

$$ R^2 =\frac{\operatorname{Var}(\widehat{Y})}{\operatorname{Var}(Y)} =\frac{\operatorname{Cov}(X,Y)^2} {\operatorname{Var}(X)\operatorname{Var}(Y)} =r^2. $$

This derivation establishes the interpretation for predicting the binary indicator \(Y\) linearly from \(X\). The same result applies with the roles of the two loci reversed. It does not say that a stated fraction of individual haplotypes will be classified correctly: a proportion of variance explained and a classification accuracy are different summaries.

Range, Limits, and Common Pitfalls

For polymorphic loci, the correlation inequality \(|r|\leq1\) implies \(0\leq r^2\leq1\). At the lower endpoint, \(r^2=0\) means \(D=0\), which for two biallelic loci is independence of the allele indicators. At the upper endpoint, \(r^2=1\) means a perfect linear relationship between the two binary indicators: one is either identical to the other or is its complement on every haplotype with positive frequency.

The sign is important when describing the direction of association. \(D\) and \(r\) are positive when the \(AB\) haplotype is more frequent than expected under independence, and negative when it is less frequent. Since \(r^2\) is nonnegative, report the sign separately when direction matters. Also state the population and the alleles being compared: changing which allele is coded as one reverses the sign in the relevant way, while \(r^2\) remains unchanged.

  • Wrong: “\(r^2=0.25\) means the allele at one locus correctly predicts 25% of haplotypes.” Correction: It means that 25% of the variance in one binary indicator is accounted for by linear prediction from the other, not that classification accuracy is 25%.
  • Wrong: “The positive value of \(r^2\) shows that \(A\) and \(B\) are positively associated.” Correction: Squaring discards direction; use the sign of \(D\) or \(r\) to describe whether the association is positive or negative.
  • Wrong: “\(r^2=1\) shows that one allele causes the other.” Correction: It describes perfect allelic prediction in the specified population, not a causal relationship.
  • Wrong: “\(r^2\) can be calculated even if one locus is fixed.” Correction: A fixed allele has zero variance, making the correlation denominator zero; \(r^2\) is undefined.

Squared allelic correlation is useful because it gives a standardized summary of how informative one biallelic locus is about another in a defined population. Its value depends on haplotype frequencies and marginal allele frequencies, so it should be interpreted in that population rather than as an intrinsic, population-free property of the two loci.

Check Your Understanding

Use the definitions and derivation above to answer these questions.

  1. For a randomly selected haplotype, define \(X\) and \(Y\) as allele indicators. Why is \(\operatorname{Cov}(X,Y)=D\)?
  2. If \(D=-0.08\), what can be concluded about the sign of \(r\)? What can be concluded about the sign of \(r^2\)?
  3. Why is \(r^2\) undefined if \(p_A=0\) or \(p_A=1\)?
  4. In a polymorphic two-locus population, what does \(r^2=0\) imply about the two allele indicators?
  5. Explain why \(r^2=0.40\) is not, by itself, a statement that 40% of haplotypes are classified correctly.
Clinical Biostats