Risk Management Monte Carlo Simulation Techniques
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 1
Monte-Carlo Simulation Techniques Pseudo-Random Number Generation ¾ Generating Pseudo-Random Variables ¾ Forecasting Volatilities and Correlations ¾ Monte Carlo Simulation of Diffusions ¾ Monte Carlo Options Pricing ¾ Variation Reduction Techniques ¾
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 2
Modeling Financial Processes ¾
Geometric Brownian Motion dS t ⎛⎡ ⎞ 1 2⎤ = µdt + σdWt St = S 0 exp⎜⎜ ⎢ µ − σ ⎥t + σWt ⎟⎟ St 2 ⎦ ⎝⎣ ⎠
¾
Hull White Stochastic Volatility Model 2 dSt dσ t 1 2 = µdt + σdWt = νdt + ξdWt 2 St σt
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 3
One Factor Interest Rate Models ¾
General Form: dr = m( r) dt + σ( r) dW Ito Process: • m: drift factor • σ: short rate volatility • dw: ε√t; ε ~ N(0,1)
¾
Model characteristics All rates move in same direction, but not by same amount Many different shapes possible (including inverted) Mean reversion can be built in
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 4
Model Taxonomy Expected Mean Volatility Fits Term Str. change in r Reversion of r Yield Vol m(r) s(r) Vasicek
a[m - r]
yes
CIR Brennan & Schwartz Ho & Lee BDT Hull & White
a[m - r] a[b + L - r] g(t) f(t,r,σ) a(t)[m(t) - r]
Copyright © 1997-2006 Investment Analytics
constant
no
no
yes yes
f(r,L)
no no
no no
no limited yes
constant f(time) f(time)
yes yes yes
no yes yes
σ√r
Monte-Carlo Simulation Techniques
Slide: 5
Pseudo-Random Number Generation ¾
Simulation of price and return paths over time Requires the generation of sequences of random variables. This is known as Monte Carlo sampling Generation of “random” (i.e. almost independent) numbers
¾
Pseudo-Random Numbers Represent as decimal fractions Interpret as realizations U of the uniform distribution on the unit interval U(0,1)
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 6
Linear Congruential Generator ¾
Most Common Method of Sequential Generation xi +1 = ( axi + c) modulo m
i = 0, 1, 2, ...
m is a very large number -- the period of the generator a and c are parameters
¾
x0 ∈{0, 1,..., m − 1, m}
is the seed provided to start the recursive stream of numbers x0, x1, x2, ... Construct uniform pseudo-random variates ui ~ U(0,1) ui = xi / m i = 0, 1, 2, ... • Sequence is not independent due to the m-long cycle • Okay when the sample number n is small relative to m
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 7
Example For example, if x0 := 35, a := 13, c := 65, and m := 100 the algorithm works as follows: Iteration 0 Iteration 1
Set x0 = 35, a = 13, c = 65, and m = 100. Compute x1 = (a x0 + c) modulo m = [13(35) + 65] modulo 100 = 20 Deliver u1 = x1 / m = 20/100 = 0.2
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 8
Example (continued) Iteration 2
Compute x2 = (a x1 + c) modulo m = [13(20) + 65] modulo 100 = 25 Deliver u2 = x2 / m = 25/100 = 0.25
Iteration 3
Compute x3 = (a x2 + c) modulo m . .
and so on. Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 9
Generating Discrete Random Variables Conceptually we may generate all n-valued discrete random variables according to the following scheme for S taking 3 values with p.d.f.: Pointer Spin
⎧0.25 s = S1 ⎪0.40 s = S ⎪ 2 f s ( s ) := ⎨ ⎪0.35 s = S3 ⎪⎩0 O.W .
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
S1 S2 S3
Slide: 10
Discrete PDF Generation ¾
More generally for x with discrete p.d.f: We divide the unit interval as f x ( xi ) i = 1, K , N
fx ( x n ) 67 4 4 8
f ( x1 ) 67 4x 4 8
fx ( x N ) 67 4 4 8
0
since
1
N
∑ f (x x
n
n =1
) = 1 n = 1, K , N
and return xn iff un falls in the nth interval
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 11
Example: Bootstrapping Daily Returns ¾
Consider the problem of simulating “Monthly” returns x over N trading days per “Month” given a sequence x1, ..., xN of actual daily returns for one such month
¾
The empirical density function for the return process x assigns probability 1/N to each actual observation -assuming the data independently and identically distributed -- and we think of #{xi < k} as the empirical estimate of P{x < k}
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 12
Resampling/Bootstrapping ¾
Now we use the uniform pseudo-random numbers u0, u1, u2, ... to generate xn n = 1, ..., N iff:
⎡ n −1 n ⎤ ui ∈ ⎢ , ⎥ ⎣ N N⎦ ¾
for as many multiples of N as is required This resampling technique -- known as bootstrapping -may be used to generate as many monthly returns as are required as e.g.: q+ N
∑x
i = q +1
Copyright © 1997-2006 Investment Analytics
i
for month q = 1, 2, ...
Monte-Carlo Simulation Techniques
Slide: 13
Generating Continuous Random Variables ¾
Inverse Transform Method Used for random variables x whose c.d.f. is available in closed form Fx Based on P{ U ≤ u } = P{ x ≤ Fx− 1 ( u )}
u
-3
Copyright © 1997-2006 Investment Analytics
-2
-1
0
F-1(u)
1
Monte-Carlo Simulation Techniques
2
3
Slide: 14
Generating Normal Variates In finance we are most interested in generating standard normal random variables z ~ N(0,1) ¾ Generate x ~ N(µ, σ2) as x=µ +σ z ¾
Noting that u ~ U(0,1) has mean 1/2 and variance 1/12 the central limit theorem means that n
z = (∑ u i − n / 2) ( n / 12)1/ 2 ≈ N (0,1) i =1
In practice n := 12 to give
12
z =∑ u i −6 i =1
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 15
Box-Muller Algorithm (1958) ¾
More accurate is the exact Box-Muller (1958) transformation of u1, u2 ~ U(0,1) independent r.v’s as z1=(−2 ln u1 )1/ 2 sin 2π u2 ~ N (0,1) z2 =(−2 ln u1 )1/ 2 cos2π u2 ~ N (0,1)
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 16
Generating Random Vectors ¾
Need to Generate Random Vectors For Correlated Returns • i.e. Log of price ratios • Assumed multivariate Normal For Multivariate (Log-Normal) Prices • Used for risk management & stress testing
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 17
Correlated Normal Variates Instantaneous correlation ρ ¾ Generate correlated bivariate Normal variates ¾
From standard normal variates ε1 and ε2
w1 = ε1 w2 = ρε1 + 1 − ρ ε 2 2
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 18
Procedure for Generating Random Vectors ¾
Given (estimated) covariance matrix Σ Factor the covariance matrix Σ into Cholesky factors as Σ = A A´ Generate z ~ N(0,1) Generate returns x = Az ~ N(0, Σ) Given a vector f of expected future spot prices generate multivariate lognormal prices p for the next period as xi
pi = f i e
Copyright © 1997-2006 Investment Analytics
i = 1, ..., I
Monte-Carlo Simulation Techniques
Slide: 19
Cholesky Factorization ¾
Compute Cholesky factorization Σ = A A´ -where A is lower triangular -- in O(n2) operations as follows
⎡a11 a12 a13⎤ ⎡s11 s12 s13 ⎤ ⎡a11 0 0 ⎤ Σ = ⎢⎢s21 s22 s23⎥⎥ A = ⎢⎢a21 a22 0 ⎥⎥ A' = ⎢⎢0 a22 a23 ⎥⎥ ⎢⎣0 0 a33 ⎥⎦ ⎢⎣s31 s32 s33 ⎥⎦ ⎢⎣a31 a32 a33 ⎥⎦ 2 ⎤ ⎡s11 s12 s13 ⎤ ⎡a11 0 0 ⎤ ⎡a11 a12 a13⎤ ⎡a11 a11a21 a11a31 ⎥ ⎢s s s ⎥ = ⎢a a 0 ⎥ × ⎢0 a a ⎥ = ⎢a a2 + a2 a a + a a ⎢ 11 21 22 21 31 32 22 ⎥ 22 23 ⎥ ⎢ 21 22 23⎥ ⎢ 21 22 ⎥ ⎢ 2 2 ⎥ ⎢⎣s31 s32 s33 ⎥⎦ ⎢⎣a31 a32 a33 ⎥⎦ ⎢⎣0 0 a33 ⎥⎦ ⎢a11a31a21a31 + a32a22 a112 + a22 + a 33 ⎣ ⎦
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 20
Cholesky Factorization ¾
¾
Now we use the elements sij of Σ to solve for the elements aij of A -- positive definite For an IxI matrix Σ we use the recursions i −1
aii = [ sii − ∑ aik2 ]1/ 2 k =1 i −1
aij = [ sij − ∑ aik a jk ] / aii
i = 1, ..., I, j = i + 1, i + 2, ..., I
k =1
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 21
Monte Carlo Simulation of Diffusions ¾
Return or price process S given by a stochastic differential equation of the form dSt = µ(St , t)dt +σ (St , t)dWt St We may apply the theory previously developed in both the univariate and multivariate cases In the univariate case we consider a real time increment ∆t and simulate a realization of the state St of the process for t=0, 1, 2 ... where t = k∆t
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 22
Simulating a Univariate Diffusion Process ¾
Wiener Process W is given by ∆Wt = ∆tz t t = 0, 1, 2, ...
Where {zt} are i.i.d. N(0,1) ¾
So
t −1
Wt = ∆t ∑ z t
t = 0, 1, 2, ...
s =0
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 23
Procedure for Univariate Process ¾ ¾ ¾
Generate stream of pseudo-random standard normal variates z0, z1, z2, ... Obtain stream of pseudo-random Wiener process increments ∆W0, ∆W1, ∆W2, ... Produces stream of diffusion process increments ∆S0, ∆S1, ∆S2, ... which are added to give the current state realization as … t −1
S t = ∑ ∆S i + S 0 i =0
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 24
Multiple Stochastic Factors ¾
Example: Spread Option Difference between two assets
dS 2t dS1t = µ 2dt + σ 2 dW2t = µ 1dt + σ 1dW1t S 2t S1t ¾
Hull White Stochastic Volatility Model
dSt 1 = µdt + σdWt St
Copyright © 1997-2006 Investment Analytics
dσ
σ
2 t 2 t
= νdt + ξdW t
Monte-Carlo Simulation Techniques
2
Slide: 25
Multiple Stochastic Factors ¾
Example with mean reverting square root volatility process (Hull White 1988) dS1t = µ 1dt + σ 1dW1t S1t
dS 2t = µ 2dt + σ 2 dW2t S 2t
d σ = α1 (σ − σ )dt + ξ1σ 1t dW 3t 2 1t
2 1t
2 2t
d σ = α 2 (σ − σ )dt + ξ 2σ 2t dW 2 2t
2 2t
Copyright © 1997-2006 Investment Analytics
2 2t
Monte-Carlo Simulation Techniques
4t
Slide: 26
Simulating Multivariate Diffusion Processes ¾
Multivariate case of I instruments St is an I-vector
Covariance Σ and drift µ must be estimated ¾ Volatility σ in the diffusion S.D.E. is its Cholesky factor, i.e. Σ = σσ and ¾
∆S t = µ ( S t , t )∆t + σ ( S t , t )∆Wt St
Copyright © 1997-2006 Investment Analytics
t = 0, 1, 2, ...
Monte-Carlo Simulation Techniques
Slide: 27
Monte Carlo Option Pricing ¾
Simulate paths of geometric Brownian motion in terms of ∆S t = rS t ∆t + σS t ∆Wt
t = 0, 1, 2, ...
This approach must be used for exotic -- path dependent -- options such as lookbacks and Asians ¾
So far there are no reliable methods for simulation of American option prices Due to the unknown exercise boundary See Brodie & Glasserman 1996, Rebonato & Cooper 1996
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 28
Monte Carlo Pricing of Vanilla European Options ¾
Valuation under the risk neutral measure given by P ( S , t ):= e − r (T −t ) E[ f (S t , T ) | S t = S ]
Evaluate the conditional expectation by Monte Carlo methods
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 29
Example: European call ¾
Involves the integral expectation ∞
ln S ( e ∫ − X ) f ln St (s)ds X
• where f ln S is the N{(T-t)r,(T-t)σ2} density Change variables to invert the normal c.d.f. using table lookups and interpolation Convert this to a new integral of an integrand g on the unit interval t
1 N −1 I ( g ) := ∫ g (ξ )dξ ≈ ∑ g (un ) N n =0 0 1
Copyright © 1997-2006 Investment Analytics
un ∈ [ 0,1]
Monte-Carlo Simulation Techniques
Slide: 30
Variance Reduction Techniques: Antithetic Variates ¾ ¾
These are used to speed convergence of the Monte Carlo approximation and the most popular are the following Antithetic Variates Use both u and 1-u to double sample size cheaply 1 d:=2
0
1
1 Vest = [Vest {u} + Vest {1 − u}] 2 ¾
As long as covariance between V{z} and V{1-z} is negative, the overall variance will be substantially reduced
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 31
Variance Reduction Techniques: Stratification ¾
Random sample Tends to leave gaps
¾
Stratified sample gives more regular representation Vi = (i-1) + Ui / 100 • Ui are iid uniform variates • Each Vi is uniformly distributed in the (i-1)th
•
percentile Then Zi = Φ-1(Vi ) falls between (i-1) and ith percentile of Normal distribution
Downside is loss of independence • Critical for statistical inference Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 32
Variance Reduction Techniques: Control Variates ¾
Control Variates Correct Monte Carlo estimate of exotic value with vanilla MC error
Vˆ E = V EMC + (V BSMC − V BS ) ¾
Variate – Control Variate correlation Reduces estimate variance when control and variate are correlated • Based on cancellation of shared estimation errors No benefit if control is uncorrelated with variate, If negative correlated, may increase estimate variance!
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 33
Control Variates ¾
Example: Barrier option Price Vi = discounted payoff for path i
Vi = h( S 0 , St(1i ) ,.........., Stm(i ) ) MCS estimate V = E[Vi] ¾
1 Vi ∑ n i =1
Assume standard call option control variate Price known in closed form, or easily evaluated
C = E[C i ] = E[ g ( S 0 , St(1i ) ,......., Stm( i ) ] Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 34
Control Variates ¾
Controlled Estimator 1 n ⎛1 n ⎞ − − V β C C ⎜ ⎟ ∑ ∑ i i n i =1 ⎝ n i =1 ⎠
Coefficient with smallest variance is:
Cov[Vi , Ci ] β = Var[Ci ] *
Variance reduction of estimator: 1 – ρ2v,c
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 35
Control Variate Example Correlation = 0.78 ¾ Variance reduction = 61% ¾
100 90 80
Arithmetic Asian
70 60 50 40 30 20 10 0 0
10
20
30
40
50
60
70
80
90
100
Standard Call
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 36
Quasi-Random Numbers Low Discrepancy Sequences ¾ Deterministic sequences generated by number theory ¾
Halton , Sobel, Faure Sequences appear random, but not “clumpy” Behavior is ideal for fast convergence
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 37
Example: Van der Corput Sequence ¾
To obtain nth point in series xn Restate n in base 2
I
n = ∑ ai 2i i =0
Transpose digits in ai around “decimal point” I
ai xn = ∑ i +1 i =0 2 Generates ½, ¼, ¾, 1/8, 5/8, 3/8, 7/8 • Contained in [0,1] • Every consecutive quadruple of points has one point in – (0, ¼), [1/4, ½), ½, ¾), [3/4, 1)
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 38
Other Sequences ¾
Halton General s-dimensional sequence in [0,1]s hypercube • First dimension is van der Corput base 2 • Second dimension is van der Corput base 3 • S-dimension is van der Corput base sth prime number
¾
Faure All dimensions use base prime p >= s >= 2 First dimension sequence is van der Corput base p Higher dimensions are permutations of 1st dim.
¾
Sobol All dimensions use 2 as base
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 39
Random vs. Sobel Paskov (1997)
Random points in the unit square
Sobol points in the unit square
Pricing Error for a European Call 0.10
0.05
0.00 0
500
1000
1500
2000
2500
3000
3500
4000
-0.05
Faure
-0.10
Pseudo 1 Pseudo 2
-0.15
-0.20
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 41
Sensitivity Factors with MCS ¾
Approximate using finite difference ratios Delta
∂C C ( P + ∆P) − C ( P − ∆P ) ≈ ∂P 2∆P
¾
Gamma
∂ 2C C ( P + ∆P ) − 2C ( P ) + C ( P − ∆P ) ≈ 2 ∂P ∆P 2
¾
Vega
¾
Theta
∂C C (σ + ∆σ ) − C (σ − ∆σ ) ≈ 2∆σ ∂σ
¾
∂C C (t + ∆t ) − C (t − ∆t ) ≈ ∂t 2∆t Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 42
Summary Monte-Carlo Methods ¾ Random number generation ¾ Simulating diffusion process ¾ Applications to option pricing ¾ Variance reduction techniques ¾
Copyright © 1997-2006 Investment Analytics
Monte-Carlo Simulation Techniques
Slide: 43