In my population genetics book (see reference at bottom) they define them as:

  • Nucleotide polymorphism (θ): proportion of nucleotide sites that are expected to be polymorphic in any sample of size 5 from this region. Of the genome. $\hat{θ}$ equals the proportion of nucleotide polymorphism observes in the sample (S) divided by $a_1 = \sum_{i=1}^{n-1} \frac{1}{I}$. If n= 5, $a_1 = \frac{1}{1}+ \frac{1}{2}+ \frac{1}{3}+ \frac{1}{4}+ \frac{1}{5}=2.083$
  • Nucleotide diversity is the average proportion of nucleotide differences between all possible pairs of sequences in the sample. In R, I came up with that code which is in accordance with what is in the book.

       data # Only polymorphisms
       total.snp # This is the total number of sites that were looked (e.g. 16 might be polymorphic over the 500 sites that we've looked at. So 484 sites are monomorphic)
       n = nrow(data) # Number of samples
       pwcomp = n*(n-1)/2 # Number of pairwise comparisons
       for(i in 1:n.col){ # Compute the number of differences in the samples that are polymorphic
         t.v = as.vector(table(data[,i]))
         z = outer(t.v,t.v,'*')
         temp= c(temp,sum(z[lower.tri(z)]))
       pi.hat = sum(temp)/(pwcomp*total.snp) # Nb of different pairwise comparison/(nb all pairwise comparison * total nb of loci (polymorphic or not))

In the book, they say

On the other hand, there is a theoretical relation between θ and π that is expected under simplifying assumption that the alleles are invisible to natural selection.

In summary θ = π with this assumption and large sample sizes.

  1. So what is the difference in the
  2. Why are we calculating both (what could they tell us)?

Hartl, D. L., & Clark, A. G. (1997). Principles of Population Genetics (3rd ed.). Sinauer Associates Incorporated.


1 Answer 1


You are also confusing definition of these terms with their expected values (typically computed from coalescent theory). Let's look at an example.

Consider a haploid population of 6 individuals. We will represent these individuals with 5 sites that can take values 0 or 1.



In this population there are $S=2$ polymorphic sites. In other words, there are two sites for which different individuals take different values in the population. Over these 5 sites, the fraction of polymorphic sites is $\frac{2}{5}$. You use $\theta$ for this quantity but to me, $\theta$ is typically used as a short hand for $2 N \mu$ (or $4 N \mu$ for diploid populations).

Under an infinite allele model, in a single panmictic haploid population (without selection and other assumptions), $E[S] = 2 N \mu a$, where $a = \sum_{i=1}^{k-1} \frac{1}{i}$, where $k$ is the sample size.

Genetic diversity

Genetic diversity is also known as expected heterozygosity. While it is most often called $\pi$, I will call it $H$ to avoid confusion. Imagine, you randomly sample two individuals in the population, what is the probability that there have different alleles at a given locus?

  • At locus 1, $H = 0$
  • At locus 2, $H = 0$
  • At locus 3, $H = 0$
  • At locus 4, $H = 2 \frac{2}{5} \frac{3}{5} = \frac{12}{25}$
  • At locus 5, $H = 2 \frac{1}{5} \frac{4}{5} = \frac{8}{25}$

You can average over all loci if you want.

The expected heterozygosity in panmictic population (without selection and other assumptions), $E[H] = \frac{4 N \mu}{1 + 4 N \mu}$. You should notice a relationship between $H$ and $F_{ST}$ here!

Nucleotide diversity

The nucleotide diversity is the equivalent of $D$ from Nei and Li (1979) and is highly related to $D_{XY}$ (Nei, 1987). Once you've managed to demonstrate that the expected coalesence time is $N$ (I won't do the demonstration here), then under an infinite site model, the number of mismatch between two individuals is logically $E[D] = 2 N \mu$ (it is the number of mutations that has happened in both lineages since the the coalescence event). For diploid population, multiply everything by 2.

Relatedness between $D$ and $S$

Under a neutral model $\frac{S}{a} = D$. Actually the standardize difference between $\frac{S}{a}$ and $D$ is what is used in Tajima's $D$ tests.

Source of information

Hartl and Clarck is good IMO but I would also like to recommend reading Population Genetics: A Concise Guide by Gillespie who explain all of that wonderfully.

  • $\begingroup$ Thanks! Actually, $S = nb.polymorphic.sites / total.nb.loci $. In my example θ = $S/a_1$. This is what you say is $S/a =D$. So in this case, it's not exactly $4Nμ$. And I guess here $μ$ is the mutation rate. Thanks for the book! I'm going to read this carefully. $\endgroup$ Dec 29, 2017 at 16:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .