Applied Stochastic Calculas 2
Applied Stochastic Calculas 2
Stochastic Differential
Equations
In this lecture. . .
1
By the end of this lecture you will be able to
2
Introduction
3
Manipulating stochastic differential equations
dG = a (G, t) dt + b (G, t) dX
4
So if for example we have a random walk
5
We have previously considered Itô’s lemma to obtain the change
in a function f (X ) when X → X + dX , where X is a standard
Brownian motion.
df d2f
df = dX + 1
2 dX 2 dt (2)
dX
limdt→0 dX 2 = dt.
6
Suppose we now wish to extend the result (2) to consider the
change in an option price V (S ) where the underlying variable S
follows a geometric Brownian motion.
(Of course, you are not supposed to know anything about options
yet. Just think of manipulating functions.)
7
If we rewrite (1) as
dS
= µ dt + σ dX
S
8
An obvious question we may ask is, what is the jump in V (S + dS )
when S → S + dS?
dV 1 d2V 2.
dV = dS + 2 dS
dS dS 2
9
We can proceed further now as we have an expression for dS
3
(and hence dS ). As dt is very small, any terms in dt 2 or dt2 are
2
insignificant in comparison and can be ignored. So working to
O (dt)
dS 2 = σ 2S 2dt.
dV 2 2 d2V dV
dV = µS +1
2 σ S dt + σS dX. (3)
dS dS 2 dS
10
Suppose that we had a formula for V (S). Let’s take a very
special case, let’s consider
V (S) = log S.
dV 1
= .
dS S
d2V 1
2
= − 2
.
dS S
11
Now from (3) we have
1 2
d (log S ) = µ − 2 σ dt + σdX.
t t t
1 2
d (log S ) = µ − σ dτ + σ dX (t > 0)
0 0 2 0
1 2
= µ − 2 σ t + σ (X (t) − X (0)) .
12
Therefore
S (t)
1 2
log = µ − 2 σ t + σ (X (t) − X (0))
S (0)
1 2
S(t) = S0 exp µ − 2 σ t + σX(t) . (4)
13
Another example:
Let’s take a look at the Vasicek interest rate model for short-
term interest rates, and try manipulating that.
dr = γ (r − r) dt + σdX.
14
By setting u = r − r, u is a solution of
du = −γu dt + σdX.
15
Transition probability density functions again
dy = A(y, t) dt + B(y, t) dX
for the variable y.
16
Think of y and t as being current values with y and t being
future values.
17
The transition probability density function p(y, t; y , t ) satisfies
two equations.
18
The forward equation
∂p 1 ∂2 2
∂
= 2 2 B(y , t ) p − A(y , t )p
∂t ∂y ∂y
19
Example: The most important example to us is that of the
distribution of equity prices in the future. If we have the random
walk
dS = µS dt + σS dX
∂p ∂ 2 ∂
1 2 2
= 2 2 σ S p − µS p .
∂t ∂S ∂S
2
1 − log(S/S )+(µ− 1 σ 2)(t−t) /2σ 2(t−t)
p(S, t; S , t) = e 2
σS 2π(t − t)
20
0.006
0.005
0.004
0.003
0.002
0.001
0
0 50 100 150 200 250
21
0.014
0.012
0.01
0.008
0.006
0.004
1 0.002
0.75 0
250
232
0.5
214
196
Time
178
160
142
124
0.25
106
88
70
52
34
Asset
16
22
The steady-state distribution
Some random walks have no such steady state even though they
have a time-independent equation. For example the lognormal
random walk either grows without bound or decays to zero.
23
If there is a steady-state distribution p∞(y ) then it satisfies the
ordinary differential equation
d2 d
1 2
2 dy 2 B p∞ − dy (Ap∞) = 0.
dr = γ (r − r) dt + σdX.
2
1 σ 2 d p∞ − γ d (r − r )p
2 2 ∞ = 0.
dr dr
24
The solution is
2
1 γ − γ(r̄−r2 )
p∞ = e σ .
σ π
25
The backward equation
∂p 2
1 2∂ p ∂p
+ 2 B(y, t) 2
+ A(y, t) = 0.
∂t ∂y ∂y
26
Simulating the lognormal random walk
dS = µS dt + σS dX.
1/2
Si+1 − Si = Si µ δt + σφ δt .
27
The random walk on a spreadsheet
28
Start with an initial stock price, say, 100.
29
First time step: The random number is. . . 0.12. So
And so on.
30
In this simulation there are several input parameters, which re-
main constant:
• a time step δt
• the volatility σ
31
Slow but accurate
• NORMSINV(RAND()).
32
The pdf and cdf for the Normal distribution
1.2
0.45
0.4
1
0.35
0.3 0.8
0.25
0.6
0.2
0.15 0.4
0.1
0.2
0.05
0 0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2
1.5
0.5
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
-0.5
-1
-1.5
-2
-2.5
33
Fast but inaccurate
12
• RAND() − 6.
i=1
34
Why 12?
Any ‘large’ number will do. The larger the number, the closer
the end result will be to being normal, but the slower it is.
Why subtract off 6?
Must be 1.
35
A B C D E F G
1 Asset 100 Time Asset
2 Drift 0.15 0 100
3 Volatility 0.25 0.01 96.10692
4 Timestep 0.01 0.02 96.99647
5 0.03 94.76352
6 0.04 91.46698
=D4+$B$4
7 0.05 88.83325
8 0.06 88.42727
9 0.07 90.62882
10 0.08 88.80545
11 =E7*(1+$B$2*$B$4+$B$3*SQRT($B$4)*(RAND()+RAND()+RAND()+RAND()
0.09 87.72282
12 +RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()-6))
0.1 86.84395
13 0.11 84.93865
36
180
160
140
120
100
80
60
40
20
0
0 0.2 0.4 0.6 0.8 1 1.2
37
Simulating other random walks
dr = γ (r − r) dt + σdX.
38
0.12
0.1
0.08
0.06
0.04
0.02
0
-1 1 3 5 7 9 11 13 15
39
Producing correlated random numbers
40
Example:
41
In discrete time these become
1/2
S1i+1 − S1i = S1i µ1 δt + σ1φ1 δt
and
1/2
S2i+1 − S2i = S2i µ2 δt + σ2φ2 δt
with
E[φ1 φ2] = ρ.
42
Q: How can we choose a φ1 and a φ2 which are both Normally
distributed, both have mean zero and standard deviation of one,
and with a correlation of ρ between them?
43
Step 1: Choose uncorrelated $1 and $2, both Normally dis-
tributed with zero means and standard deviations of one.
φ1 = $1
φ2 = ρ $1 + 1 − ρ2 $2.
44
Check:
E[φ2
1 ] = 1,
E φ2 2 2 2 2 2
2 = E ρ $1 + 2ρ 1 − ρ $1$2 + (1 − ρ )$2
= ρ2 + 0 + (1 − ρ2) = 1,
and
E [φ1φ2] = E ρ$2
1+ 1 − ρ2$1$2 = ρ.
And Normality?
45
Weighted sums of Normally distributed numbers are themselves
Normally distributed!
n n n
wiXi ∼ N wi µ i , wi2σi2 .
i=1 i=1 i=1
46
Summary
• With the right tool (Itô’s lemma) you can examine functions
of stochastic variables
47