Appendix S2. The diffusion approximation
In L9 and L10 every result came from an exact calculation on a discrete model: a recursion for the heterozygosity, a first-event argument for the fixation probability. Each needed its own trick. For a large population there is a single tool. The frequency \(x=n/N\) moves in steps of \(1/N\), and over many steps it looks like a continuous random motion. The master equation of L2 becomes a partial differential equation for the density \(P(x,t)\) of the frequency. This appendix derives it and uses it.
Why a continuous description
Two orders are possible. Solve the discrete model at finite \(N\) and \(t\), then take \(N\) large: this is what L9 did, as in \(\langle H(t)\rangle=H(0)(1-1/N)^t\). Or take \(N\) large first and solve the limiting equation. The second route is the diffusion approximation.
The heterozygosity suggests how to take the limit. It depends on time only through \(t/N\): for \(N\to\infty\) at fixed \(t\) nothing happens, so the right time scale is \(N\) generations. On that scale \(x\) makes many small steps, as a particle in a fluid.
Kramers–Moyal expansion
Let \(x\) be continuous, with \(W(x'\mid x)\) the rate of a jump from \(x\) to \(x'\). The master equation (gain minus loss, as in L2) is
\[ \frac{\partial P(x,t)}{\partial t}=\int dx'\,\bigl[W(x\mid x')\,P(x',t)-W(x'\mid x)\,P(x,t)\bigr]. \]
Write the rates in terms of the jump \(y=x'-x\), \(W(x+y\mid x)=w(y\mid x)\). In the gain term the jump is \(y=x-x'\), from \(x-y\); in the loss term it is \(y=x'-x\), from \(x\):
\[ \frac{\partial P(x,t)}{\partial t}=\int dy\,\bigl[w(y\mid x-y)\,P(x-y,t)-w(y\mid x)\,P(x,t)\bigr]. \]
Expand the gain term in the shift \(-y\) of the starting point, keeping the size \(y\) of the jump fixed:
\[ w(y\mid x-y)\,P(x-y,t)=\sum_{n=0}^\infty\frac{(-y)^n}{n!}\,\frac{\partial^n}{\partial x^n}\bigl[w(y\mid x)\,P(x,t)\bigr]. \]
The \(n=0\) term cancels the loss term. Exchanging the sum and the integral,
\[ \boxed{\ \frac{\partial P}{\partial t}=\sum_{n=1}^\infty\frac{(-1)^n}{n!}\,\frac{\partial^n}{\partial x^n}\bigl[\alpha_n(x)\,P(x,t)\bigr],\qquad \alpha_n(x)=\int dy\;y^n\,w(y\mid x)\ } \]
the Kramers–Moyal expansion. The \(\alpha_n\) are the moments of the jump per unit time: \(\alpha_1\) is the mean displacement per unit time, \(\alpha_2\) the mean squared displacement per unit time. The expansion is exact. It is useful only if it can be cut.
For jumps of \(\pm\Delta x\) at rates \(T^\pm(x)\), \(w(y\mid x)=T^+(x)\,\delta(y-\Delta x)+T^-(x)\,\delta(y+\Delta x)\) and
\[ \alpha_n(x)=\bigl[T^+(x)+(-1)^nT^-(x)\bigr]\,\Delta x^n . \]
Truncation and the Fokker–Planck equation
Take the steps small, \(\Delta x\to0\). If the result is to describe a motion, the mean and the variance of the displacement per unit time must stay finite:
- \(\alpha_2=(T^++T^-)\,\Delta x^2\) finite: the total rate grows as \(1/\Delta x^2\);
- \(\alpha_1=(T^+-T^-)\,\Delta x\) finite: the bias \(T^+-T^-\) grows only as \(1/\Delta x\), a fraction \(\sim\Delta x\) of the total rate.
Then \(\alpha_n\sim(T^++T^-)\,\Delta x^n\sim\Delta x^{n-2}\to0\) for \(n>2\). Board 15.3 makes the same argument for a general jump distribution of width \(\Delta x^\beta\) and shift \(a(x)\,\Delta x^\alpha\): the first two moments stay finite only if \(\beta=\alpha/2\), and then all the others vanish. Keeping \(n=1,2\),
\[ \boxed{\ \frac{\partial P}{\partial t}=-\frac{\partial}{\partial x}\bigl[A(x)\,P\bigr]+\frac12\,\frac{\partial^2}{\partial x^2}\bigl[B(x)\,P\bigr],\qquad A=\alpha_1,\quad B=\alpha_2\ } \]
the Fokker–Planck equation (Kolmogorov’s forward equation). \(A\) is the drift, the deterministic part, and \(B\) the diffusion, the noise.
Example 1. Random walk
Steps of \(\pm\Delta x\), both at rate \(d\): \(\alpha_1=0\), \(\alpha_2=2d\,\Delta x^2\), \(\alpha_n=2d\,\Delta x^n\) for even \(n\). With \(D=d\,\Delta x^2\) fixed as \(\Delta x\to0\), \(\alpha_n=2D\,\Delta x^{n-2}\to0\) for \(n>2\), and
\[ \frac{\partial P}{\partial t}=D\,\frac{\partial^2P}{\partial x^2}, \]
the heat equation. With different rates to the right and to the left one gets a drift as well (exercise 1).
Example 2. Moran model
Steps of \(\pm1/N\), with the rates of L10, \(T^\pm=Nf_\pm\,x(1-x)\) per generation, \(f_+=f_A=1+s\), \(f_-=f_a=1\):
\[ \alpha_1=\frac{T^+-T^-}{N}=s\,x(1-x),\qquad \alpha_2=\frac{T^++T^-}{N^2}=\frac{(f_A+f_a)\,x(1-x)}{N}\simeq\frac{2\,x(1-x)}N , \]
\(\alpha_3=s\,x(1-x)/N^2\), \(\alpha_4\simeq2x(1-x)/N^3\), and so on. The terms with \(n\ge3\) are smaller than \(\alpha_2\) by powers of \(1/N\). The two first terms are of the same order when \(Ns=O(1)\), on time scales of \(N\) generations, as anticipated. The neutral Moran model gives
\[ \frac{\partial P}{\partial t}=\frac1N\,\frac{\partial^2}{\partial x^2}\bigl[x(1-x)\,P\bigr], \]
and with \(\tau=t/N\), \(\partial_\tau P=\partial_x^2[x(1-x)P]\) (board 15.5).
Example 3. Wright–Fisher
Here one generation is one jump, and the jump \(x'-x\) has the central moments of the binomial distribution, divided by \(N^n\):
\[ \alpha_1=0,\qquad \alpha_2=\frac{x(1-x)}N,\qquad \alpha_3=\frac{x(1-x)(1-2x)}{N^2},\qquad \alpha_4=\frac{3x^2(1-x)^2}{N^2}+O(N^{-3}). \]
In general the \(n\)-th central moment of the binomial is of order \(N^{\lfloor n/2\rfloor}\), so \(\alpha_n=O(N^{-\lceil n/2\rceil})\) and again only \(n\le2\) survive. Selection adds \(\alpha_1=s\,x(1-x)/(1+sx)\simeq s\,x(1-x)\). Replacing \(P(t+1)-P(t)\) by \(\partial_tP\) is fine on time scales of \(N\) generations.
Both models give the same equation, with \(A=s\,x(1-x)\). They differ only in the noise: \(B=2x(1-x)/N\) for Moran, \(B=x(1-x)/N\) for Wright–Fisher. For large \(N\) a Wright–Fisher population of \(N\) individuals behaves as a Moran population of \(2N\). From here on we use the Moran model,
\[ \frac{\partial P}{\partial t}=-\frac{\partial}{\partial x}\bigl[s\,x(1-x)\,P\bigr]+\frac1N\,\frac{\partial^2}{\partial x^2}\bigl[x(1-x)\,P\bigr]. \]
For Wright–Fisher, replace \(N\to2N\) in every formula below, except in \(x=1/N\), the frequency of a single individual.
The Fokker–Planck equation
Probability current and boundaries
The equation is a continuity equation,
\[ \frac{\partial P}{\partial t}=-\frac{\partial J}{\partial x},\qquad J(x,t)=A(x)\,P-\frac12\,\frac{\partial}{\partial x}\bigl[B(x)\,P\bigr]. \]
On \([a,b]\), \(\frac{d}{dt}\int_a^bP\,dx=J(a,t)-J(b,t)\): probability is lost or gained only through the boundaries. Three kinds of boundary:
- natural: \(x\in\mathbb R\), with \(P\to0\) at infinity;
- reflecting: \(J(a,t)=J(b,t)=0\), nothing leaves;
- absorbing: \(P(a,t)=P(b,t)=0\) in the continuum. Probability flows out and \(\int_a^bP\,dx<1\); what is missing is the probability of having been absorbed.
For drift, \(x=0\) and \(x=1\) are absorbing: once a type is lost or fixed, nothing changes. At those points \(B\) itself vanishes, since there is no noise without variation.
What \(A\) and \(B\) mean
Multiply by \(x\) and integrate by parts (boundary terms vanish):
\[ \frac{d\langle x\rangle}{dt}=\langle A(x)\rangle . \]
The mean moves with the average of \(A\), which equals \(A(\langle x\rangle)\) only if \(A\) is linear: the same remark as for the mean of a nonlinear birth–death process in L2. In the same way,
\[ \frac{d\operatorname{var}(x)}{dt}=2\bigl\langle(x-\langle x\rangle)\,A(x)\bigr\rangle+\langle B(x)\rangle . \]
\(B\) is the source of variance; \(A\) can increase it or decrease it. For neutral drift, \(A=0\), \(d\langle x\rangle/dt=0\) and \(d\langle x^2\rangle/dt=\langle B\rangle=2\langle x(1-x)\rangle/N\). So \(d\langle H\rangle/dt=-\frac2N\langle H\rangle\): the decay of L9.
Solution by eigenfunctions
As for the Schrödinger equation, look for \(P(x,t)=\sum_nc_n\,\psi_n(x)\,e^{-\lambda_nt}\), with
\[ -\frac{d}{dx}\bigl[A\,\psi_n\bigr]+\frac12\,\frac{d^2}{dx^2}\bigl[B\,\psi_n\bigr]=-\lambda_n\,\psi_n . \]
For neutral drift the eigenfunctions are polynomials (Gegenbauer) and \(\lambda_n=n(n+1)/N\), \(n=1,2,\dots\) (Kimura 1955). Check the first two with \(\frac1N\frac{d^2}{dx^2}[x(1-x)\psi]\): \(\psi=1\) gives \(-2/N\), and \(\psi=1-2x\) gives \(-6/N\) times \(\psi\). The slowest mode, \(\lambda_1=2/N\), is the decay of the heterozygosity. With absorbing boundaries the solution also has masses at the two ends (McKane & Waxman 2007):
\[ P(x,t\mid x_0)=\Pi_0(t)\,\delta(x)+\Pi_1(t)\,\delta(1-x)+\rho(x,t), \]
where \(\rho\to0\), \(\Pi_1(t)\to x_0\) and \(\Pi_0(t)\to1-x_0\) for \(t\to\infty\): the fixation probability of L9.
Stationary distribution
If \(P(x,t)\to P^*(x)\), then \(\partial_xJ^*=0\) and the current is constant. With reflecting boundaries it is zero:
\[ A\,P^*=\frac12\,\frac{d}{dx}\bigl[B\,P^*\bigr]. \]
With \(Q=B\,P^*/2\) this is \(Q'=(2A/B)\,Q\), so
\[ \boxed{\ P^*(x)=\frac{C}{B(x)}\exp\Bigl(2\int^x dy\,\frac{A(y)}{B(y)}\Bigr)\ } \]
with \(C\) fixed by normalization. If \(A=-U'(x)\) and \(B=2k_BT\) is constant, \(P^*\propto e^{-U/k_BT}\): the Boltzmann distribution, with \(A\) the force and \(B\) the temperature.
For neutral drift, \(A=0\) and \(P^*\propto1/[x(1-x)]\), which cannot be normalized. There is no stationary distribution inside \((0,1)\), because the boundaries are absorbing: the stationary state is all the mass at 0 and 1.
In more dimensions, \(\partial_tP=-\nabla\cdot\mathbf J\), and a stationary state needs only \(\nabla\cdot\mathbf J^*=0\). Zero flux through the boundary no longer implies \(\mathbf J^*=0\): currents can circulate inside.
Mutation and drift, the Beta distribution
Two alleles in the Moran model (board 16): at each birth \(A\) mutates to \(a\) with probability \(u\) and \(a\) to \(A\) with probability \(v\). Then, per generation,
\[ n\to n+1:\ N\bigl[x(1-x)(1-u)+(1-x)^2v\bigr],\qquad n\to n-1:\ N\bigl[x(1-x)(1-v)+x^2u\bigr]. \]
The first is an \(A\) born without mutation, or an \(a\) born and mutated, replacing an \(a\); the second is the converse. The jump moments are
\[ A(x)=v-(u+v)\,x,\qquad B(x)=\frac1N\bigl[2x(1-x)+v(1-x)^2+ux^2-(u+v)\,x(1-x)\bigr]\simeq\frac{2x(1-x)}N . \]
The interesting regime is \(Nu,Nv=O(1)\). Then \(A\) is of order \(1/N\), like \(B\), and the mutation terms inside \(B\) are smaller by a factor \(u\) or \(v\): \(B\) keeps only its drift part. With \(2A/B=N\,[v/x-u/(1-x)]\),
\[ \boxed{\ P^*(x)=\frac{\Gamma(Nu+Nv)}{\Gamma(Nu)\,\Gamma(Nv)}\;x^{Nv-1}(1-x)^{Nu-1}\ } \]
a Beta distribution. Its moments are
\[ \langle x\rangle=\frac{v}{u+v},\qquad \langle H\rangle=\langle2x(1-x)\rangle=\frac{2Nuv}{(u+v)(Nu+Nv+1)} , \]
and for \(u=v\), \(\langle H\rangle=Nu/(2Nu+1)\).
- \(Nu,Nv\ll1\): U-shaped, almost all the mass near 0 and 1, \(H\to0\). Drift wins.
- \(Nu=Nv=1\): uniform.
- \(Nu,Nv\gg1\): peaked at \(v/(u+v)\), \(H\to1/2\) for \(u=v\). Mutation wins.
For Wright–Fisher the exponents are \(2Nv-1\) and \(2Nu-1\). With the effective size of L9, \(N\to N_e\).
\(m\) alleles. If each allele mutates to each of the others with probability \(u/(m-1)\), a given allele against all the rest is the two-allele case with \(v=u/(m-1)\). Then \(\langle H\rangle=1-m\langle x^2\rangle=Nu/[Nu\,m/(m-1)+1]\). For \(m\to\infty\), every mutation is new and \(\langle H\rangle=Nu/(Nu+1)=\theta/(1+\theta)\) with \(\theta=Nu\): the result of L9, obtained there from the equation for the probability of identity.
Backward equation
The forward equation evolves \(P(x,t\mid x_0)\) in the final point \(x\). Questions about the fate of a mutation (“where does it end, and when?”) are questions about the initial point. Start from the Chapman–Kolmogorov equation, valid for any intermediate time \(t\):
\[ P(x',t'\mid x_0,0)=\int dx\;P(x',t'\mid x,t)\,P(x,t\mid x_0,0). \]
The left side does not depend on \(t\). Differentiate in \(t\), use the forward equation for \(\partial_tP(x,t\mid x_0,0)\), and integrate by parts to move the \(x\)-derivatives onto \(P(x',t'\mid x,t)\):
\[ 0=\int dx\;\Bigl[\frac{\partial}{\partial t}+A(x)\,\frac{\partial}{\partial x}+\frac12B(x)\,\frac{\partial^2}{\partial x^2}\Bigr]P(x',t'\mid x,t)\;P(x,t\mid x_0,0). \]
This holds for every \(x_0\), so the bracket vanishes:
\[ \boxed{\ -\frac{\partial}{\partial t}P(x',t'\mid x,t)=A(x)\,\frac{\partial P}{\partial x}+\frac12\,B(x)\,\frac{\partial^2P}{\partial x^2}\ } \]
the backward equation. The derivatives act on the starting point, and \(A\) and \(B\) sit outside the derivatives.
Fixation probability
Let \(\Pi(x)\) be the probability of reaching 1 before 0, starting from \(x\). In a short time \(dt\), \(x\) moves by \(dx\), with \(\langle dx\rangle=A\,dt\) and \(\langle dx^2\rangle=B\,dt\), and the probability of fixation from the new point is the same function: \(\Pi(x)=\langle\Pi(x+dx)\rangle\). This is the first-event argument of L9 in the continuum. Expanding to second order,
\[ A(x)\,\Pi'(x)+\frac12\,B(x)\,\Pi''(x)=0,\qquad \Pi(0)=0,\quad \Pi(1)=1 . \]
Board 17.3 gets the same equation from the backward equation for the first-passage density, integrated over time. It is first order in \(\Pi'\): \(\Pi'\propto\psi(x)=\exp\bigl(-2\int^xA/B\bigr)\), and
\[ \Pi(x)=\frac{\int_0^x\psi(y)\,dy}{\int_0^1\psi(y)\,dy} . \]
With \(A=s\,x(1-x)\) and \(B=2x(1-x)/N\), \(2A/B=Ns\) and \(\psi=e^{-Nsx}\):
\[ \boxed{\ \Pi(x)=\frac{1-e^{-Nsx}}{1-e^{-Ns}}\ } \]
Kimura 1962. For \(s\to0\), \(\Pi=x\). For a single mutant, \(x=1/N\) and \(Ns\gg1\), \(\Pi\simeq s\). It is the continuum limit of the exact result of L10: \(r^{-n}=e^{-n\ln(1+s)}\simeq e^{-Nsx}\). For Wright–Fisher, \(N\to2N\) in the exponents gives \(\Pi\simeq2s\) for a single mutant.
Times to fixation
The mean time \(T(x)\) to reach either boundary obeys the same argument with one more step: \(T(x)=dt+\langle T(x+dx)\rangle\), so
\[ A\,T'+\frac12\,B\,T''=-1,\qquad T(0)=T(1)=0 . \]
For neutral drift, \(T''=-N/[x(1-x)]\), and
\[ T(x)=-N\bigl[x\ln x+(1-x)\ln(1-x)\bigr]. \]
From \(x=1/2\) this is \(N\ln2\simeq0.7\,N\) generations. From a single new mutant, \(x=1/N\), it is \(\simeq1+\ln N\): most new mutations are lost quickly.
Conditional on fixation. Let \(T_1(x)\) be the mean time to fixation of the mutations that do fix. The product \(\tau=\Pi\,T_1\) obeys \(A\tau'+\frac12B\tau''=-\Pi\), with \(\tau(0)=\tau(1)=0\). This is the \(n=1\) case of board 17.4: the moments \(T_n\) of the first-passage time to a boundary, weighted by the probability of reaching it, obey \(A\,T_n'+\frac12B\,T_n''+n\,T_{n-1}=0\), with \(T_0=\Pi\). For neutral drift, \(\tau''=-N/(1-x)\), so \(\tau=-N(1-x)\ln(1-x)\) and
\[ T_1(x)=-N\,\frac{(1-x)\ln(1-x)}{x}\ \xrightarrow{\ x\to0\ }\ N \]
(Kimura & Ohta 1969). A new neutral mutation that fixes takes on average \(N\) generations. In Wright–Fisher it takes \(2N\).
Exercises
- Biased random walk. Steps of \(\pm\Delta x\) at rates \(T^\pm\). Show that the limit \(\Delta x\to0\) with \(V=(T^+-T^-)\,\Delta x\) and \(D=(T^++T^-)\,\Delta x^2/2\) fixed gives \(\partial_tP=-V\,\partial_xP+D\,\partial_x^2P\). Solve it from \(P(x,0)=\delta(x)\).
- Wright–Fisher jump moments. From the central moments of the binomial distribution, compute \(\alpha_1,\dots,\alpha_4\) for neutral Wright–Fisher, and show that \(\alpha_3/\alpha_2\) and \(\alpha_4/\alpha_2\) vanish as \(1/N\).
- With \(B=2k_BT\) constant and \(A=-U'(x)\), show that \(P^*\propto e^{-U/k_BT}\).
- Eigenfunctions of neutral drift. Show that \(\psi=1\) and \(\psi=1-2x\) are eigenfunctions of \(\frac1N\frac{d^2}{dx^2}[x(1-x)\psi]\), and find the next one, a polynomial of degree 2.
- Times. For the neutral Moran model with \(N=10^4\), compute the mean time to fixation of a new mutant that fixes, and the mean time to loss of one that is lost. (Hint: the mean time to loss conditional on loss is \(T_0(x)=-N\,x\ln x/(1-x)\); show it.)
- Beta distribution. For \(u=v\), sketch \(P^*\) for \(Nu=0.2\), \(1\), \(5\), and compute \(\langle H\rangle\). In L9’s simulator, set \(N=100\), \(s=0\) and \(\mu\) such that \(N\mu\) crosses 1, and watch the histogram.
References
- M. Kimura, Solution of a process of random genetic drift with a continuous model, PNAS 41, 144 (1955).
- M. Kimura, On the probability of fixation of mutant genes in a population, Genetics 47, 713 (1962).
- M. Kimura, T. Ohta, The average number of generations until fixation of a mutant gene in a finite population, Genetics 61, 763 (1969).
- W. J. Ewens, Mathematical Population Genetics I (Springer, 2nd ed. 2004), ch. 4–5.
- R. A. Blythe, A. J. McKane, Stochastic models of evolution in genetics, ecology and linguistics, J. Stat. Mech. P07018 (2007).
- A. J. McKane, D. Waxman, Singular solutions of the diffusion equation of population genetics, J. Theor. Biol. 247, 849 (2007).
- C. W. Gardiner, Stochastic Methods: A Handbook for the Natural and Social Sciences (Springer, 4th ed. 2009), ch. 3 and 5.
- N. G. van Kampen, Stochastic Processes in Physics and Chemistry (North-Holland, 3rd ed. 2007), ch. VIII.