Why a Matrix Is Needed
At two biallelic loci, one value of \(D\) summarizes the departure of haplotype frequencies from independence; the other three deviations follow from it. With more than two alleles at either locus, there are multiple allele combinations, and their departures need not have the same size or direction. A single number for one chosen allele pair can therefore leave much of the joint pattern unseen.
The natural representation is a matrix: each entry compares the frequency of one haplotype with the frequency expected from its two allele frequencies under independence. The matrix records positive and negative departures together. A joint summary can then combine all its entries, rather than selecting one pair and treating it as representative.
The product \(p_{i.}p_{.j}\) is the frequency expected for \(A_iB_j\) if alleles at the two loci are independent in the population. Thus \(D_{ij}>0\) means that haplotype is more frequent than the independence expectation, while \(D_{ij}<0\) means it is less frequent. The deviations are expressed in frequency units, not as percentages unless multiplied by 100.
Constraints and Degrees of Freedom
The entries in \(D\) cannot vary independently. Summing across a row gives \(\sum_j D_{ij}=\sum_j p_{ij}-p_{i.}\sum_j p_{.j}=p_{i.}-p_{i.}=0\), because the allele frequencies at locus \(B\) sum to one. Similarly, every column sums to zero. These constraints are useful checks on a calculation: a matrix whose rows or columns do not sum to zero has an arithmetic error, subject only to rounding.
When all allele frequencies are positive, these row and column constraints leave \((r-1)(c-1)\) free deviations. For example, once the entries in the first \(r-1\) rows and first \(c-1\) columns are known, the remaining entries are fixed by the zero-sum constraints. This matches the degrees of freedom in a contingency table association test. Alleles with zero frequency contribute no observed haplotypes and are ordinarily omitted from the table.
Worked Example: Building a Three-by-Two LD Matrix
Consider a hypothetical sample of 100 independently sampled haploid chromosomes from one population. Suppose the haplotype counts are as follows.
| \(B_1\) | \(B_2\) | Total | |
|---|---|---|---|
| \(A_1\) | 30 | 10 | 40 |
| \(A_2\) | 20 | 20 | 40 |
| \(A_3\) | 10 | 10 | 20 |
| Total | 60 | 40 | 100 |
The row frequencies are \(p_{1.}=0.40\), \(p_{2.}=0.40\), and \(p_{3.}=0.20\); the column frequencies are \(p_{.1}=0.60\) and \(p_{.2}=0.40\). For \(A_1B_1\), the observed frequency is \(30/100=0.30\), and the independence expectation is \(0.40(0.60)=0.24\). Therefore \(D_{11}=0.30-0.24=0.06\). Applying the same calculation to each cell gives
Each row and column sums to zero. The positive deviation for \(A_1B_1\) is paired with a negative deviation for \(A_1B_2\): given \(A_1\), the two \(B\) alleles are not represented in the independence proportions. This pattern describes a relationship in the haplotype frequencies; by itself it does not establish a causal effect.
A Joint Summary Across Allele Combinations
The matrix is the most complete description of the multiallelic pattern, but it can be useful to summarize the overall departure from independence. One standard choice is based on the Pearson chi-square measure for a contingency table. For population frequencies with positive marginal frequencies, define \(S=\sum_i\sum_j D_{ij}^2/(p_{i.}p_{.j})\). Every allele combination contributes to this sum, and squaring ensures that positive and negative departures do not cancel.
For a sample of \(n\) independent haploid observations, let \(n_{ij}=np_{ij}\) and let the expected count under independence be \(np_{i.}p_{.j}\). The Pearson statistic is \(\sum_{ij}(n_{ij}-np_{i.}p_{.j})^2/(np_{i.}p_{.j})=nS\). Under the null hypothesis of independence, it is approximately chi-square distributed with \(df=(r-1)(c-1)\), provided the sampling model is appropriate and expected counts are sufficiently large for the approximation. Cramér’s \(V\) is a standardized effect-size summary of the table, not a p-value. For samples with two chromosomes per person, the chromosomes may not be independent observations; the sampling design must be considered before using this test calibration.
Worked Example: Summarizing a Three-by-Two Association
Use the hypothetical table above. Its independence expected counts are 24, 16, 24, 16, 12, and 8. All exceed 5, and the example stipulated independent haploid observations, so the usual Pearson approximation is reasonable for illustration. From the deviations, the frequency-scale measure is
Here \(\min(r-1,c-1)=\min(2,1)=1\), so \(V=\sqrt{0.06250/1}=0.2500\). The corresponding Pearson statistic is \(nS=100(0.06250)=6.250\), with \(df=(3-1)(2-1)=2\); its approximate p-value is 0.0439. In this hypothetical sample, the data provide evidence against independence at the 0.05 level. Cramér’s \(V=0.2500\) describes the standardized overall association in this table; it is not a probability that the loci are linked or a measure of causal effect.
Checking a Three-by-Three Matrix
The arithmetic is especially important for larger tables: one incorrect entry can invalidate the entire matrix and any joint summary computed from it. The next example shows the calculation of a small haplotype frequency against its independence expectation, then verifies all the resulting deviations.
Worked Example: A Rare Haplotype and the Full LD Matrix
Consider a hypothetical population with \(100{,}000\) haplotypes and the following counts.
| \(B_1\) | \(B_2\) | \(B_3\) | Total | |
|---|---|---|---|---|
| \(A_1\) | 50 | 19,950 | 20,000 | 40,000 |
| \(A_2\) | 14,950 | 5,050 | 10,000 | 30,000 |
| \(A_3\) | 15,000 | 15,000 | 0 | 30,000 |
| Total | 30,000 | 40,000 | 30,000 | 100,000 |
The marginals are \(p_{1.}=0.40\), \(p_{2.}=0.30\), \(p_{3.}=0.30\), and \(p_{.1}=0.30\), \(p_{.2}=0.40\), \(p_{.3}=0.30\). For \(A_1B_1\), \(p_{11}=50/100{,}000=0.0005\), whereas the independence expectation is \(0.40(0.30)=0.12\). Thus \(D_{11}=0.0005-0.12=-0.1195\), not \(-0.07\). Computing every cell gives
For instance, \(D_{12}=0.1995-0.40(0.40)=0.0395\), and \(D_{21}=0.1495-0.30(0.30)=0.0595\). The first row sums to \(-0.1195+0.0395+0.0800=0\); the other rows and all three columns also sum to zero. This confirms that the revised entries are consistent with the margins.
The joint measure is obtained from all nine cells:
Since \(\min(r-1,c-1)=2\), \(V=\sqrt{0.400286/2}=0.4474\). This summary reflects the complete table, including the large negative deviation for \(A_1B_1\) and the compensating deviations in its row and column. It does not imply that every allele pair has the same strength or direction of association.
How the Biallelic Case Fits
With two alleles at each locus, the zero-sum constraints force the deviations into the familiar pattern \(D,-D,-D,D\). The multiallelic matrix therefore extends the one-\(D\) description rather than contradicting it. For a two-by-two table, \(S=D^2/[p_{1..}(1-p_{1..})p_{.1}(1-p_{.1})]\), which is the squared correlation \(r^2\) between the two allele-indicator variables. For larger tables, Cramér’s \(V\) remains an omnibus association summary; it should not be casually labeled the squared correlation for a particular pair of alleles.
Worked Example: Recovering the Biallelic Pattern
Suppose a hypothetical sample of 200 haplotypes has counts 60, 20, 20, and 100 in the \(A_1B_1\), \(A_1B_2\), \(A_2B_1\), and \(A_2B_2\) cells. Both first-allele marginals are \(80/200=0.40\). The observed frequency of \(A_1B_1\) is \(60/200=0.30\), so \(D=0.30-(0.40)(0.40)=0.14\). The constraints give the full matrix
The joint measure is \(S=0.14^2/(0.16)+0.14^2/(0.24)+0.14^2/(0.24)+0.14^2/(0.36)=0.3403\). Here \(V=\sqrt{0.3403}=0.5833\), and \(r^2=S=0.3403\). This equality is specific to the biallelic case. The four matrix entries represent one underlying departure, not four independent pieces of evidence.
Interpretation and a Common Pitfall
The matrix answers allele-specific questions: which haplotypes are overrepresented or underrepresented relative to independence, and by how much in frequency units? The joint summary answers a different question: how much overall departure from independence is present across the whole allele table? Both views matter. Two tables can have the same \(V\) while having different matrices and therefore different allele-specific patterns.
- Pitfall: inspecting one cell and generalizing to the whole locus pair. A large positive \(D_{ij}\) does not show that every allele at locus \(A\) is positively associated with every allele at locus \(B\). The zero-sum constraints require compensating deviations elsewhere.
- Pitfall: adding signed deviations and treating the result as overall LD. The sum of all entries of \(D\) is always zero, including when there is strong association. The joint measure squares and scales deviations, so that positive and negative patterns both contribute.
- Pitfall: interpreting \(V\) as an allele-pair effect. Cramér’s \(V\) is a normalized summary of the complete contingency table. To describe a particular haplotype, report its \(D_{ij}\) and its observed and independence-expected frequencies.
Check Your Understanding
Try these questions using the definitions and constraints above.
- If \(p_{i.}=0.25\), \(p_{.j}=0.40\), and \(p_{ij}=0.13\), calculate \(D_{ij}\) and interpret its sign.
- Why must every row and every column of a multiallelic \(D\) matrix sum to zero?
- A locus pair has three observed alleles at one locus and two at the other. What are the degrees of freedom for the Pearson independence test, and what denominator is used to standardize \(S\) in Cramér’s \(V\)?
- Why is the sum of the signed \(D_{ij}\) values not a useful overall measure of LD?
- In what specific case does the joint measure \(S\) equal the usual biallelic \(r^2\)?