Download Q: Why should recursions have anything to do with derivatives?

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Orientation: where are we and where
are we going?
Plan of attack:
• develop matrix formalism
• use matrix formalism to derive forward / backward diffusion
equations
• apply forward/backward equations to several examples
We’re most of the way toward the forward/backward diffusion (Kolmogorov)
equations:
• right now we have discrete forward/backward recursion equations (last 3
slides).
• Discrete equations are a pain to solve. Our goal now is to make the
forward/backward equations continuous. This will allow us to solve seminal
problems in population genetics.
• Another way to say this is that we want to turn discrete difference equations
into continuous (partial) differential equations.
The next slides are rather formal. But try and keep your eye on the prize: the goal is
to get rid of the recursive terms and replace them with derivatives. Read on…
Q: Why should recursions have
anything to do with derivatives?
A: Taylor expansion!
f(x+∆x) = f(x) + df(x)/dx·∆x + ½d2f(x)/dx2·(∆x)2 + …
For example, our old friend ln(1+x) =
0 + x – x2/2 + x3/3 - …
Now:
P(x|x0,t + ∆t) = P(x|x0,t) + dP(x|x0,t)/dt·∆t + O(∆t2)
So we immediately connect recursion (left) with
differention (right).
-- making forward/backward equations pretty:
1. substituting for T(x|x) -Recall the forward equation:
(copied from 3 slides ago)
I think we can all agree that this is clunky to look at. In the next few slides, we’ll do some
tricks to make it prettier and more useful.
1st, recall that for 1-step processes (like Moran),
T(x|x) = 1- T(x+1/N|x) – T(x-1/N|x).
In other words, “you absolutely must jump left, right, or stay still”
Also, T(x|x-1/N)= T+(x-1/N). And, T(x|x+1/N)= T-(x+1/N). This notation helps a bit:
-- making forward/backward equations pretty:
2. continuum time limit-strategy: trade some of the recursive terms for derivatives. Recall the definition of a
derivative from CALC101:
message: think of derivatives as (small) differences (like numerator above)
Now consider the forward equation (copied from previous slide)
Subtract P(x|xo,t) from both sides and divide by 1:
-- making forward/backward equations pretty:
3. continuum limit of x-strategy: trade some of the recursive terms for second derivatives. From calc101:
or,
(assuming Δx→0)
Whoa! Second derivatives?
Yes, grasshopper, they emerge naturally from unbiased
diffusions. Call D the per-capita rate of movement
between adjacent values of x. (In Moran, D = x(1-x).)
dP(x*|x0,t)/dt = +DdP(x*-dx)/dx - DdP(x*+dx)/dx
=D[dP(x*-dx)/dx - dP(x*+dx)/dx] = Dd2P(x*|x0,t)/dx2
dP(x*+dx)/dx
dP(x*-dx)/dx
P(x|x0,t)
x*-dx x* x*+dx
x
(If 2nd derivative of P wrt x is 0, then the “spread” from each side
is equal to the spread to each side and diffusion stops.)
-- making forward/backward equations pretty:
3. continuum limit of x-strategy: trade some of the recursive terms for second derivatives. From calc101:
or,
(assuming Δx→0)
Now we’re going to do some sneaky tricks in order to make the right-hand-side (RHS) of the
forward equation look like the RHS of the equation directly above. Obviously you won’t be
tested on this trickery.
•
•
•
•
Write T+(x-1/N|xo)P(x-1/N|xo) as ½ T+(x-1/N|xo) P(x-1/N|xo) +½ T+(x-1/N|xo) P(x-1/N|xo)
Write T-(x+1/N|xo) P(x+1/N|xo) as ½ T-(x+1/N|xo) P(x+1/N|xo) +½ T-(x+1/N|xo) P(x+1/N|xo)
Add ½ T+(x+1/N|xo)P(x+1/N|xo) add subtract ½ T+(x+1/N|xo)P(x+1/N|xo) .
Add ½ T-(x-1/N|xo) P(x-1/N|xo) and subtract ½ T-(x-1/N|xo) P(x-1/N|xo)
This all seems cruel and pointless, but it makes the RHS of forward equation look like
derivatives… see next slide
-- making forward/backward equations pretty:
4. continuum limit of x (cont’d)-1
2
3
4
1
2
3
4
And what about first derivatives?
They emerge naturally from biased transitions. Call M
the per-capita rate of movement from x to x+dx.
dP(x*|x0,t)/dt = -MdP(x*)/dx
dP(x*)/dx
P(x|x0,t)
x*-dx x* x*+dx
Take 1 minute to explain the minus sign.
x
-- making forward/backward equations pretty:
5. introducing <Δx> and <(Δx)2>
We’ve made it all the way to this fine looking equation! It’s pretty useful as is,
but ordinarily it’s written a bit differently
The terms involving T± can be further simplified/interpreted:
<Δx>= average change in x during 1 time unit.
<(Δx)2>= average change in x2 during 1 time unit
What’s the deal with the funny-looking derivatives (∂ )? Answer: nothing much!
They’re called “partial derivatives” and there’s nothing to them– just take the
derivative like you normally would. (look this up if you want to know more).
This is called a “partial differential equation” (PDE). Contrast with an “ordinary
differential equation,” which has only 1 independent variable (e.g. only x or only t).
** Finally, the forward diffusion equation: **
general forward equation
What does this do for you?
• inputs:
• average change in x during 1 time unit (we’ll do an example in a few slides)
• average change in x2 during 1 time unit (related to variance in x during 1 time unit)
• initial condition: P(x|xo, t=0) = some function of x (usually a spike at xo)
• output: time-dependent probability density P(x|xo, t) (≈ everything you’d want to
know)
• names:
• “Forward Kolmogorov equation”
• “Forward diffusion equation”
• “Fokker-Planck equation”
• uses:
• myriad applications in physics/chemistry (e.g. sedimentation, molecular dynamics)
• Quantum mechanics: Shrodinger’s equation (but it has complex #’s)
• pricing financial products (e.g. “derivatives”; Black-Shoals equation)
• population genetics (of course!)
** There’s a “backward diffusion equation” too: **
You can play the same set of “derivative tricks” in order to turn the backward
recursion equation into a backward diffusion equation. I recommend going through
the song and dance yourself, for practice.
general backward equation
The output of the forward and backward diffusion equations is exactly the
same: P(x|xo, t). Often times, one or the other is far more convenient,
depending on the problem you want to solve (we’ll see examples of both).
Technical differences between the two:
• <Δx> and <(Δx)2> are outside the derivatives in the backward equation
• derivatives are with respect to xo in backward eq, x in forward eq.
• <Δx> and <(Δx)2> should be thought of as functions of x in the forward
equation, but functions of xo in the backward equation.
• + sign in front of the first derivative in backward eq. - sign in forward eq.
aside: P(x|xo, t) is now a probability density,
because we’ve approximated x as continuous
• In reality, x is not continuous: it must equal the discrete values {0,1/N, 2/N, … 1}
• But when we traded recursive terms for derivatives, we approximated x by a
continuous variable: x∈[0,1] (good appx. if Δx=1/N is small, i.e. N is large-ish).
• One consequence is that now we have to think about P(x) in a more
sophisticated way. If we ask: “what is the probability that x=0.23934234234… “
we’re asking such a specific question that the answer must be zero.
• The right question to ask is: what is the probability that x lies in some range of
values. To answer this, we just “sum” P(x) across the range of interest:
prob(x is b/w xlow and xhigh ) =
• One consequence is that P(x) can be larger than one. But
prob(x b/w xlow and xhigh ) cannot exceed 1 (of course). This issue arises all the
time when dealing with probabilities (not just in popgen…)
Conceptual difference between forward
and backward recursion/diffusion?
** Two ways to think about P(x|xo, t)=Tt: Recursion **
1: “forward equation ”
2: “backward equation”
• From previous slides, P(x|xo, t+1)= TP(x|xo, t).
• In words: To advance P forward in time, multiply by the matrix T, on the left
• This means we sum “horizontally” across T, from left to right
In matrix algebra, time goes from right to left. So left-multiplication is
like adding things in forward time order.
** Two ways to think about P(x|xo, t)=Tt: Recursion **
1: “forward equation ”
2: “backward equation”
•
•
•
•
Just as P(x|xo, t+1)= TP(x|xo, t), we can also write P(x|xo, t+1)= P(x|xo, t)T
In words: To advance P forward in time, multiply by the matrix T, on the right
This means we sum “vertically” down T, from top to bottom
I.e. the “start” and ”end” points are reversed, compared to the forward equation.
In matrix algebra, time goes from right to left. So right-multiplication is
like adding things in reverse time order.
Conceptual difference between forward
and backward recursion/diffusion?
The forward and backward equations from Wednesday are examples of “recursion equations.”
Time
• Forward: expresses P(x|xo, t+1) in terms of P(x| xo, t), P(x-1/x| xo, t), and P(x+1/x| xo, t)
• Backward: expresses P(x|xo, t+1) in terms of P(x| xo, t), P(x| xo-1/xo , t), and , P(x| xo+1/xo , t)
Forward
Backward
Backward
Forward
• So the forward provides us with the distribution of x as a function of x0 and t, while the
backwards gives us the distribution of x0 as a function of x and t. Recall the establishment
probability problem. We found P(0|1,∞) = d/b. But in its most general form we can think of
it as asking, Given that the population goes extinct, what’s the probability that it started
with 1 copy, 2 copies, 3 copies, etc? In fact, that’s part of today’s homework!
• In both cases, we usually “start” with 100% of the probability at some x. As time proceeds
(forward or backward) the distribution of x spread out in almost exactly the same way.
** How to interpret the forward diffusion equation**
: general forward equation
If <Δx> >0, this term causes P to slide to the right, with
speed <Δx> (we previously called this “translation”.
We’ll see that this term corresponds to natural
selection.
“diffusion term”: represents a random
walk. causes P(x) to become broader
and shorter through time.. We’ll see
that this term represents “genetic
drift.”
cartoon/example, x is on horizontal axis and xo=0.
diffusion and translation
pure translation <(Δx)2>=0)
0.4
0.4
0.35
0.35
0.4
t=0
t=1
t=3
0.3
0.25
0.25
0.15
0.2
0.15
0.1
0.1
0.05
-4
-2
0
2
4
6
0
-6
0.2
0.15
0.1
0.05
0
-6
P(x)
0.3
0.25
0.2
t=0
t=1
t=3
0.35
0.3
P(x)
P(x)
pure diffusion (<Δx>=0)
0.05
-4
-2
0
2
4
6
0
-6
-4
-2
0
2
4
6
So, <(Δx)2> tells us how strong diffusion (drift) is and <Δx> says how strong translation (selection)
is.