Written and maintained by CASRAI Editorial Board
Last updated
Linkage disequilibrium (LD) is the non-random association of alleles at two or more loci in a population. This guide is for researchers who need to compute, interpret and report LD: it gives the formulas for D, D′ and r², a worked example with the arithmetic shown, a reading table, and the PLINK and LDlink commands used in practice. LD underlies the signal peaks in a Manhattan plot and the clustering of correlated variants around a genome-wide association hit.
What is linkage disequilibrium? A definition in one paragraph
Two loci are in linkage equilibrium when the allele at one locus tells you nothing about the allele at the other, so the frequency of any two-locus haplotype equals the product of its allele frequencies. They are in linkage disequilibrium when certain allele combinations occur together more (or less) often than that product predicts. The word “disequilibrium” describes the departure from independence, not a disease or an error. LD is a property of a population and of a pair of loci, and it is strongest between variants that sit close together because recombination has had little chance to separate them (Sved and Hill, 2018).
What is linkage in genetics, in simple words?
Linkage is the tendency of variants that lie near each other on the same chromosome to be inherited together. The closer two loci are, the lower the recombination fraction c (the chance that a recombination event separates them in one meiosis) and the more often they travel as a unit. Linkage describes inheritance within families; linkage disequilibrium describes the resulting association between alleles across a whole population.
What is a linkage disequilibrium haplotype?
A haplotype is the specific combination of alleles carried together on one chromosome copy. For two biallelic loci with alleles A/a and B/b there are four possible haplotypes: AB, Ab, aB and ab. LD measures whether the observed frequencies of those four haplotypes match what independent combination of the allele frequencies would give. Stretches where variants are strongly correlated and inherited together are often called haplotype blocks.
Formulas: D, D′ and r² with every symbol explained
For two biallelic loci, let pA and pB be the frequencies of alleles A and B, and pAB the frequency of the haplotype carrying both. The definitions follow Sved and Hill (2018).
- Coefficient of linkage disequilibrium, D = pAB − pA × pB. It is zero at equilibrium. Its sign depends on which alleles you label A and B, and its possible range depends on the allele frequencies, so D is rarely compared across pairs.
- D′ = D / Dmax, where Dmax is the largest value D can take given the allele frequencies. When D is positive, Dmax = min[pA(1 − pB), (1 − pA)pB]; when D is negative, Dmax = min[pA pB, (1 − pA)(1 − pB)]. Software commonly reports its magnitude, between 0 and 1.
- r² = D² / [pA (1 − pA) pB (1 − pB)]. It is the squared correlation between the two loci’s allele indicators, between 0 and 1.
Under random mating, D shrinks by a factor of (1 − c) each generation, so after t generations it is D0 × (1 − c)t; decay is slower for closely linked loci. For small c, the expected r² at equilibrium between drift and recombination is approximately 1 / (1 + 4Nₑc), where Nₑ is the effective population size (Sved and Hill, 2018).
Worked example with real numbers
This is a constructed teaching example, not data from a study. Suppose 200 haplotypes are counted: AB = 90, Ab = 30, aB = 20, ab = 60.
- Allele frequencies: pA = (90 + 30) / 200 = 0.60; pB = (90 + 20) / 200 = 0.55.
- Haplotype frequency: pAB = 90 / 200 = 0.45.
- Expected under independence: pA × pB = 0.60 × 0.55 = 0.33.
- D = 0.45 − 0.33 = 0.12.
- D is positive, so Dmax = min[0.60 × 0.45, 0.40 × 0.55] = min[0.27, 0.22] = 0.22. Then D′ = 0.12 / 0.22 = 0.545.
- Denominator for r²: 0.60 × 0.40 × 0.55 × 0.45 = 0.0594. r² = 0.12² / 0.0594 = 0.0144 / 0.0594 = 0.242 (r = 0.492).
Decay example: with c = 0.01, after 100 generations of random mating D falls to 0.99100 ≈ 0.366 of its starting value. The approximation 1 / (1 + 4Nₑc) with Nₑ = 100 and c = 0.01 gives an expected r² of 1 / (1 + 4) = 0.20.
Interpretation: reading D′ versus r²
| Measure | What it tells you | Allele-frequency dependence | Typical use |
|---|---|---|---|
| D | Raw departure from independence | Its range depends on allele frequencies | Intermediate quantity |
| D′ | Share of the maximum possible association that is present | Rescaled for allele frequencies, but inflated by rare alleles and small samples | Recombination history and block structure |
| r² | Squared correlation; how well one variant predicts the other | Pairs with different allele frequencies cannot reach r² = 1 | Tagging variants, pruning, power of association tests |
In the example above, D′ = 0.545 but r² = 0.242: the two loci show over half of the maximum possible association, yet one genotype explains only about a quarter of the variance in the other, because the allele frequencies differ (0.60 versus 0.55). Report both when the distinction matters. Any cut-off you apply, for tagging, pruning or clumping, is a design choice that you should state with the value used.
Assumptions and common mistakes
What are the 5 rules of Hardy-Weinberg equilibrium?
Hardy-Weinberg equilibrium describes genotype frequencies at one locus and assumes random mating, no mutation, no migration (gene flow), no selection, and a large population (negligible genetic drift). Under these conditions allele frequencies stay constant and genotype frequencies follow p², 2pq and q². Hardy-Weinberg is a within-locus expectation; LD is a between-locus quantity, so two loci can each be in Hardy-Weinberg proportions and still be in strong LD.
- Mixing populations. LD is population-specific; compute it in a sample whose ancestry matches your question, or use a matching reference panel.
- Treating D′ = 1 as strong evidence. With small samples or rare alleles D′ can reach 1 simply because one haplotype class is absent.
- Assuming phase is known. PLINK by default computes LD from correlations of allele counts and does not use phase; D′ requires a maximum-likelihood haplotype solution (PLINK documentation).
- Ignoring relatedness. PLINK’s default LD calculations use founders only; including relatives would distort estimates.
- Not stating the window. A reported r² is hard to interpret without the SNP pair distance, window and minor allele frequency filter used.
Tools: PLINK and LDlink
PLINK 1.9 computes pairwise LD from the command line. --r2 reports the squared correlation (--r reports the raw correlation); the modifier dprime adds D′, and --ld-window-r2 sets the minimum r² to report (default 0.2). Window options include --ld-window, --ld-window-kb and --ld-window-cm. --ld snp1 snp2 prints haplotype frequencies, r², D′ and a Hardy-Weinberg test for one pair; --indep-pairwise uses r² for pruning. Pairwise output is written to plink.ld.
plink --bfile mydata --r2 dprime --ld-window-kb 1000 --ld-window 99999 --ld-window-r2 0 --out ld_pairs
plink --bfile mydata --ld rs123 rs456
LDlink (National Cancer Institute, Division of Cancer Epidemiology and Genetics) is a web suite with the modules LDpair (two variants), LDmatrix (heatmap), LDproxy (variants in LD with a query variant) and LDpop (LD across 1000 Genomes populations). Its help page lists version 7.4.0 (2 October 2026). Choosing the population panel is the main decision: select the ancestry that matches your study sample.
How to report LD (APA-style example)
Name the measure, the population or panel, the genome build, the software with version, the window and any frequency filter. Example: “Pairwise linkage disequilibrium between rs123 and rs456 was estimated from the study genotypes (genome build GRCh38) with PLINK 1.9 (--r2 dprime); r² = .24 and D′ = .55.” APA drops the leading zero for statistics that cannot exceed 1, and the software and any reference panel should be cited.
How to calculate LD in Excel, R or Python
Excel. With haplotype counts in B1:B4 (AB, Ab, aB, ab): total in B5 =SUM(B1:B4); pA in B6 =(B1+B2)/B5; pB in B7 =(B1+B3)/B5; D in B8 =B1/B5-B6*B7; Dmax in B9 =IF(B8>=0,MIN(B6*(1-B7),(1-B6)*B7),MIN(B6*B7,(1-B6)*(1-B7))); D′ in B10 =B8/B9; r² in B11 =B8^2/(B6*(1-B6)*B7*(1-B7)).
R.
n <- c(AB=90, Ab=30, aB=20, ab=60); N <- sum(n)
pA <- unname((n["AB"]+n["Ab"])/N); pB <- unname((n["AB"]+n["aB"])/N)
D <- unname(n["AB"])/N - pA*pB
Dmax <- if (D >= 0) min(pA*(1-pB), (1-pA)*pB) else min(pA*pB, (1-pA)*(1-pB))
c(D=D, Dprime=D/Dmax, r2=D^2/(pA*(1-pA)*pB*(1-pB)))
Python.
nAB, nAb, naB, nab = 90, 30, 20, 60
N = nAB + nAb + naB + nab
pA, pB = (nAB + nAb)/N, (nAB + naB)/N
D = nAB/N - pA*pB
Dmax = min(pA*(1-pB), (1-pA)*pB) if D >= 0 else min(pA*pB, (1-pA)*(1-pB))
print(D, D/Dmax, D**2/(pA*(1-pA)*pB*(1-pB)))
All three return D = 0.12, D′ ≈ 0.545 and r² ≈ 0.242.
Frequently asked questions
What is the coefficient of linkage disequilibrium?
It is D = pAB − pA × pB: the observed frequency of a two-locus haplotype minus the frequency expected if the loci were independent. D = 0 means linkage equilibrium. Because its range depends on allele frequencies, it is usually rescaled to D′ or r².
Is LD the same as linkage?
No. Linkage is a within-family property of loci that are physically close; LD is a population-level association between alleles that reflects recombination together with drift and population history.
Why does LD matter for association studies?
A genotyped variant can show a signal for an untyped causal variant because the two are correlated, and a significant peak usually contains many correlated variants. See genome-wide significance thresholds for the p-value cut-off used in genome-wide scans, and STROBE-MR for reporting Mendelian randomisation studies.
Sources
- Sved, J. A., & Hill, W. G. (2018). One hundred years of linkage disequilibrium. Genetics, 209(3), 629-636. https://doi.org/10.1534/genetics.118.300642 (read 2026-11-07)
- PLINK 1.9 documentation, linkage disequilibrium page. https://www.cog-genomics.org/plink/1.9/ld (read 2026-11-07)
- LDlink help documentation, National Cancer Institute DCEG. https://ldlink.nih.gov/?tab=help (read 2026-11-07)







