Skip to content

Kingman's coalescent and Watterson's estimator

22 fully proved

Elementary sums

TheoremSum of reciprocals of binomial coefficients \(\binom{k}{2}\)#✓fully proved

∑_{k=2}^n (k.choose 2)⁻¹ = 2 (1 - 1/n) for n ≥ 1 (telescoping 2/(k(k-1))).

theorem sum_inv_choose_two {n : ℕ} (hn : 1 ≤ n) :
    ∑ k ∈ Icc 2 n, ((k.choose 2 : ℕ) : ℝ)⁻¹ = 2 * (1 - 1 / n)
Used by 2

TheoremWeighted sum of reciprocals of \(\binom{k}{2}\) is twice a harmonic number#✓fully proved

∑_{k=2}^n k (k.choose 2)⁻¹ = 2 H_{n-1}.

theorem sum_mul_inv_choose_two (n : ℕ) :
    ∑ k ∈ Icc 2 n, (k : ℝ) * ((k.choose 2 : ℕ) : ℝ)⁻¹ = 2 * (harmonic (n - 1) : ℝ)
Used by 2

The holding-time model

StructureHolding times of Kingman's coalescent#✓fully proved

Kingman's coalescent for a sample of size n, through its holding times: T k is the time (in units of 2N generations) during which the genealogy has exactly k lineages, for 2 ≤ k ≤ n. These are independent, and T k is exponential with rate k.choose 2. The values of T k for k ∉ [2, n] are irrelevant.

structure KingmanTimes (μ : Measure Ω) (n : ℕ) where
  /-- `T k` is the holding time while the genealogy has `k` lineages. -/
  T : ℕ → Ω → ℝ
  /-- `T k` is exponential with rate `k.choose 2`, the number of pairs of lineages. -/
  hasLaw : ∀ k ∈ Icc 2 n, HasLaw (T k) (expMeasure (k.choose 2 : ℕ)) μ
  /-- The holding times are mutually independent. -/
  indep : iIndepFun (fun k : Icc 2 n => T k) μ
Used by 20

DefinitionTime to the most recent common ancestor#✓fully proved

Time to the most recent common ancestor of the sample.

def tmrca : Ω → ℝ := fun ω => ∑ k ∈ Icc 2 n, K.T k ω
Uses 1 · Used by 2

DefinitionTotal branch length of a coalescent genealogy#✓fully proved

Total branch length of the sample genealogy: k branches during T k.

def totalLength : Ω → ℝ := fun ω => ∑ k ∈ Icc 2 n, (k : ℝ) * K.T k ω
Uses 1 · Used by 11

LemmaPositivity of the number of pairs#✓fully proved

The number of pairs k.choose 2 is positive for k ∈ [2, n].

lemma choose_two_pos {k : ℕ} (hk : k ∈ Icc 2 n) : (0 : ℝ) < ((k.choose 2 : ℕ) : ℝ)
Used by 9

TheoremIntegrability of coalescent holding times#✓fully proved

Each holding time is integrable.

theorem integrable_T {k : ℕ} (hk : k ∈ Icc 2 n) : Integrable (K.T k) μ
Uses 3 · Used by 5

TheoremExpected coalescent holding time#✓fully proved

E[T k] = (k.choose 2)⁻¹.

theorem integral_T {k : ℕ} (hk : k ∈ Icc 2 n) : μ[K.T k] = ((k.choose 2 : ℕ) : ℝ)⁻¹
Uses 3 · Used by 4

TheoremExpected time to the most recent common ancestor#✓fully proved

The expected time to the most recent common ancestor is 2 (1 - 1/n).

theorem integral_tmrca (hn : 1 ≤ n) : μ[K.tmrca] = 2 * (1 - 1 / (n : ℝ))
Uses 5

TheoremIntegrability of the total branch length#✓fully proved

The total branch length is integrable.

theorem integrable_totalLength : Integrable K.totalLength μ
Uses 3 · Used by 1

TheoremExpected total branch length of the coalescent#✓fully proved

The expected total branch length is 2 H_{n-1}.

theorem integral_totalLength : μ[K.totalLength] = 2 * (harmonic (n - 1) : ℝ)
Uses 5 · Used by 3

TheoremVariance of the time to the most recent common ancestor#✓fully proved

The variance of the time to the most recent common ancestor is ∑_{k=2}^n ((k.choose 2)⁻¹)² (this uses independence).

theorem variance_tmrca :
    Var[K.tmrca; μ] = ∑ k ∈ Icc 2 n, (((k.choose 2 : ℕ) : ℝ)⁻¹) ^ 2
Uses 5

Watterson's estimator

TheoremExpected number of segregating sites#✓fully proved

Infinite-sites mutation at rate θ/2 per lineage per unit time: if the number of segregating sites S is integrable and has conditional mean (θ/2) L given the genealogy σ-algebra m, then E S = θ H_{n-1}. (Integrability matters: Mathlib's conditional expectation of a non-integrable function is 0.)

theorem integral_segSites (hm : m ≤ mΩ) [SigmaFinite (μ.trim hm)] (hSi : Integrable S μ)
    (hS : μ[S | m] =ᵐ[μ] fun ω => θ / 2 * K.totalLength ω) :
    μ[S] = θ * (harmonic (n - 1) : ℝ)
Uses 3 · Used by 2

TheoremIntegrability of Watterson's estimator#✓fully proved

Watterson's estimator S / H_{n-1} is integrable when S is.

theorem integrable_watterson (hSi : Integrable S μ) :
    Integrable (fun ω => S ω / (harmonic (n - 1) : ℝ)) μ

TheoremWatterson's estimator is unbiased#✓fully proved

E[S / H_{n-1}] = θ for a sample of size n ≥ 2.

theorem watterson_unbiased (hm : m ≤ mΩ) [SigmaFinite (μ.trim hm)] (hSi : Integrable S μ)
    (hS : μ[S | m] =ᵐ[μ] fun ω => θ / 2 * K.totalLength ω) (hn : 2 ≤ n) :
    μ[fun ω => S ω / (harmonic (n - 1) : ℝ)] = θ
Uses 3 · Used by 1

A concrete model

DefinitionCanonical probability space for Kingman holding times#✓fully proved

The canonical probability space for the Kingman holding times of a sample of size n: the product of the exponential laws Exp (k.choose 2), 2 ≤ k ≤ n.

def piMeasure (n : ℕ) : Measure (Icc 2 n → ℝ) :=
  Measure.pi fun k : Icc 2 n => expMeasure ((k : ℕ).choose 2 : ℕ)
Used by 1

DefinitionKingman coalescent from coordinate projections#✓fully proved

The coordinate projections of piMeasure n form a Kingman coalescent; in particular KingmanTimes is inhabited for every sample size.

MathlibExt.Biology.PopulationGenetics.Coalescent.KingmanTimes.ofPi · 18 lines
def KingmanTimes.ofPi (n : ℕ) : KingmanTimes (piMeasure n) n where
  T k ω := if h : k ∈ Icc 2 n then ω ⟨k, h⟩ else 0
  hasLaw k hk := by
    have hT : (fun ω : Icc 2 n → ℝ => if h : k ∈ Icc 2 n then ω ⟨k, h⟩ else 0)
        = fun ω => ω ⟨k, hk⟩ := by
      funext ω
      simp [hk]
    rw [hT]
    exact (measurePreserving_eval (fun i : Icc 2 n => expMeasure (((i : ℕ).choose 2 : ℕ) : ℝ))
      ⟨k, hk⟩).hasLaw
  indep := by
    have hT : (fun k : Icc 2 n => fun ω : Icc 2 n → ℝ =>
        if h : (k : ℕ) ∈ Icc 2 n then ω ⟨k, h⟩ else 0) = fun k ω => id (ω k) := by
      funext k ω
      simp [k.2]
    rw [hT]
    exact iIndepFun_pi (μ := fun i : Icc 2 n => expMeasure (((i : ℕ).choose 2 : ℕ) : ℝ))
      (fun _ => aemeasurable_id)
Uses 3

Wright–Fisher → Kingman

DefinitionProbability of no coalescence in one Wright–Fisher generation#✓fully proved

In a Wright–Fisher population of M gene copies, the probability that k lineages, choosing their parents independently and uniformly, have k distinct parents.

def noCoalProb (M k : ℕ) : ℝ := ∏ i ∈ range k, (1 - (i : ℝ) / M)
Used by 6

TheoremNo-coalescence probability as a falling factorial ratio#✓fully proved

noCoalProb M k is the falling factorial M (M-1) ⋯ (M-k+1) divided by M ^ k.

theorem noCoalProb_eq_descFactorial_div {M : ℕ} (hM : 0 < M) (k : ℕ) :
    noCoalProb M k = (M.descFactorial k : ℝ) / (M : ℝ) ^ k
Uses 1 · Used by 1

TheoremNo-coalescence probability tends to one#✓fully proved

noCoalProb M k → 1 as M → ∞.

theorem tendsto_noCoalProb_one (k : ℕ) :
    Tendsto (fun M : ℕ => noCoalProb M k) atTop (𝓝 1)
Uses 1 · Used by 3

TheoremKingman's coalescence rate#✓fully proved

For M gene copies (M = 2N), the per-generation probability that some of k lineages coalesce is (k.choose 2) / M + o(1/M); i.e. in time units of M generations, coalescences occur at rate k.choose 2.

theorem tendsto_coalescence_rate (k : ℕ) :
    Tendsto (fun M : ℕ => (M : ℝ) * (1 - noCoalProb M k)) atTop (𝓝 (k.choose 2 : ℕ))
Uses 2 · Used by 2

TheoremWright–Fisher coalescence times converge to exponential laws#✓fully proved

After ⌊t M⌋ Wright–Fisher generations (t ≥ 0 coalescent time units), the probability that k lineages have not coalesced tends to exp (-(k.choose 2) t), the survival function of the exponential law with rate k.choose 2.

theorem tendsto_noCoalProb_pow_floor (k : ℕ) {t : ℝ} (ht : 0 ≤ t) :
    Tendsto (fun M : ℕ => noCoalProb M k ^ ⌊t * M⌋₊) atTop
      (𝓝 (Real.exp (-((k.choose 2 : ℕ) : ℝ) * t)))
Uses 3 · Used by 1

The dependency explorer needs JavaScript and its graph data.

Download the complete graph data.