# Monte Carlo Methods for Options

¨
Om¨ ur U
˘
GUR
Institute of Applied Mathematics
Middle East Technical University, Ankara, Turkey
July 24, 2010
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 1 / 38
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 2 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 3 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Monte Carlo Integration
Consider the problem of computing a multidimensional integral of the form
I =

A
g(x) dx,
where A ⊂ R
n
is Lebesgue measurable. We may estimate I by randomly sampling
a sequence of points x
i
∈ A, i = 1, 2, . . . , N, and building the estimator
´
I
N
=
vol(A)
N
N
¸
i=1
g(x
i
),
where vol(A) denotes the volume of the region A. Quite often we consider the
unit hypercube
A = [0, 1]
n
= [0, 1] ×[0, 1] ×· · · ×[0, 1],
so that vol(A) = 1.
The strong law of large numbers implies that
lim
N→∞
´
I
N
= I
with probability one.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 4 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Monte Carlo Integration (cont.)
More generally, if X denotes a vector random variable with joint density function
f(x), x ∈ R
n
, then the Monte Carlo integration may be used to estimate the
expected value
E [g(X)] =

R
n
g(x)f(x) dx
of an arbitrary function g of X.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 5 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Basics of Samples I
For a family of independent identically distributed (i.i.d.) random variables
{X
i
}

i=1
, the partial sum S
N
is deﬁned by
S
N
=
N
¸
i=1
X
i
= X
1
+ X
2
+· · · + X
N
. (1)
Associated with S
N
is the sample mean
¯
X
N
which is another random variable
given by
¯
X
N
=
1
N
S
N
=
1
N
N
¸
i=1
X
i
. (2)
This is an unbiased estimator of the parameter
µ = E [X
i
]
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 6 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Basics of Samples II
of the i.i.d. sample X
i
. In other words, the expectation of
¯
X
N
is the same as µ,
since
E

¯
X
N

=
1
N
E [S
N
] = E [X
i
] = µ, (3)
due to the i.i.d. sequence {X
i
}

i=1
.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 7 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Strong Law of Large Numbers
Theorem (Strong Law of Large Numbers)
For a family of i.i.d. random variables {X
i
}

i=1
, suppose that the mean
µ = E [X
i
] exists. Then,
lim
N→∞
¯
X
N
= lim
N→∞
1
N
N
¸
i=1
X
i
= µ
with probability one.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 8 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Squared-Error I
Moreover, we may quantify the quality of the estimator
¯
X
N
by considering the
expectation of the squared-error as
E

(
¯
X
N
−µ)
2

= E

¯
X
2
N

E

¯
X
N

2
= Var

¯
X
N

=
1
N
2
Var

¸
N
i=1
X
i

=
1
N
2
¸
N
i=1
Var [X
i
]
=
σ
2
N
,
(4)
where σ
2
= Var [X
i
] may be estimated by a sample variance, say ¯ σ
2
N
.
Therefore, beside an unbiased sample mean
¯
X
N
, an unbiased sample variance ¯ σ
2
N
may be given as
¯ σ
2
N
=
1
N −1
N
¸
i=1

X
i

¯
X
N

2
=
N
N −1

1
N
N
¸
i=1
X
2
i

¯
X
2
N

. (5)
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 9 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Squared-Error II
It is not diﬃcult to show that
E

¯ σ
2
N

= Var [X
i
] = σ
2
holds by using the second equality in (5).
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 10 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Central Limit Theorem
Theorem (Central Limit Theorem)
For a family of i.i.d. random variables {X
i
}

i=1
with ﬁnite mean µ and ﬁnite
variance σ
2
> 0, let
Z
N
=
S
N
−Nµ
σ

N
=
¯
X
N
−µ

σ
2
/N
.
Then, for x ∈ R,
lim
N→∞
P {Z
N
≤ x} = Φ(x) =
1

x
−∞
e
−ξ
2
/2
dξ,
where Φ is the standard normal distribution function.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 11 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Conﬁdence Interval I
Now, a (1 −α)th level of conﬁdence interval for a random variable Z is deﬁned by
the interval [−z
1−α/2
, z
1−α/2
] such that the critical number z
1−α/2
is found from
the equation
P
¸
−z
1−α/2
≤ Z ≤ z
1−α/2
¸
= 1 −α. (6)
If, further, the random variable Z is standard normally distributed, then
1 −α = Φ(z
1−α/2
) −Φ(−z
1−α/2
) = 2 Φ(z
1−α/2
) −1.
In other words,
Φ(z
1−α/2
) = 1 −α/2. (7)
Therefore, using the inverse of the error function, erf
−1
,
z
1−α/2
= Φ
−1
(1 −α/2) =

2 erf
−1
(1 −α). (8)
Commonly used critical numbers are
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 12 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Conﬁdence Interval II
z
0.975
= Φ
−1
(1 −0.05/2) ≈ 1.96, for α = 0.05, (9)
z
0.995
= Φ
−1
(1 −0.01/2) ≈ 2.58, for α = 0.01, (10)
for the (1 −α)th level of conﬁdence interval for a standard normally distributed
random variable.
Thus, if the number of samples N is large enough, then the random variable
Z =
¯
X
N
−µ

¯ σ
2
N
/N
can be considered to be approximately standard normally distributed by the
central limit theorem.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 13 / 38
Monte Carlo Methods Basics of Monte Carlo Integration
Conﬁdence Interval III
Therefore,
1 −α ≈ P

−z
1−α/2

¯
X
N
−µ

¯ σ
2
N
/N
≤ z
1−α/2
¸
= P

¯
X
N
−z
1−α/2

¯ σ
2
N
/N ≤ µ ≤
¯
X
N
+ z
1−α/2

¯ σ
2
N
/N

implies that an approximate (1 −α)th level conﬁdence interval for the parameter
µ = E [X
i
] may be computed from the sample mean
¯
X
N
and the sample variance
¯ σ
2
N
as
¸
¯
X
N
−z
1−α/2

¯ σ
2
N
/N,
¯
X
N
+ z
1−α/2

¯ σ
2
N
/N

. (11)
This also implies that the rate of convergence of Monte Carlo method is of order
O

¯ σ
2
N
/N

.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 14 / 38
Monte Carlo Methods Option Pricing by Monte Carlo Simulation
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 15 / 38
Monte Carlo Methods Option Pricing by Monte Carlo Simulation
Algorithm
Monte Carlo Simulation for European Options
for k = 1, 2, . . . , N do
if the option is path dependent then
simulate a path to get (S
T
)
k
% by numerical methods (for SDEs)
calculate the payoﬀ, V
k
else
draw Z
k
∼ N(0, 1)
(S
T
)
k
= S
0
exp

r −
1
2
σ
2

T + σZ
k

T
¸
calculate the payoﬀ, V
k
end if
end for
´
E(V ) =
1
N
¸
N
k=1
V
k
% estimate of risk-neutral expectation
´
V = e
−rT
´
E(V ) % approximate value of option
´
V = e
−rT
´
E(V ) ≈ V (S
0
, 0) = e
−rT
E
Q
[V (S
T
, T)]
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 16 / 38
Variance Reduction Techniques Antithetic Variates
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 17 / 38
Variance Reduction Techniques Antithetic Variates
Antithetic Variates I
Consider the idea of generating two sequences of independent identically
distributed samples,
¸
X
1
i
¸
N
i=1
=
¸
X
1
1
, X
1
2
, . . . , X
1
N
¸
,
¸
X
2
i
¸
N
i=1
=
¸
X
2
1
, X
2
2
, . . . , X
2
N
¸
. (12)
These samples may separately be used in Monte Carlo simulations, and so may
the pair-averaged samples
X
i
=
1
2

X
1
i
+ X
2
i

, i = 1, 2, . . . , N, (13)
since these are also i.i.d..
Assuming a correlation between the samples as
Cov

X
1
i
, X
2
i

< 0,
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 18 / 38
Variance Reduction Techniques Antithetic Variates
Antithetic Variates II
for each i = 1, 2, . . . , N. By using the identity

Cov

X
1
i
, X
2
i

1
2

Var

X
1
i

+Var

X
2
i

¸
,
it follows that
Var [X
i
] =
1
4

Var

X
1
i

+Var

X
2
i

+ 2 Cov

X
1
i
, X
2
i

¸

1
2
¸
Var

X
1
i

+Var

X
2
i
¸
.
Hence,
Var

¯
X
N

= Var
¸
1
N
N
¸
i=1
X
i
¸
=
1
N
Var [X
i
] ≤
1
2N
¸
Var

X
1
i

+Var

X
2
i
¸
.
This is the idea of antithetic variates.
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 19 / 38
Variance Reduction Techniques Antithetic Variates
Up-and-In Call, with antithetic variates
for i = 1, 2, . . . , M do
for j = 0, 1, . . . , N −1 do
Z
j
∼ N(0, 1)
S
j+1
= S
j
exp

r −
1
2
σ
2

∆t + σZ
j

∆t
¸
% introduce
´
S
j+1
=
´
S
j
exp

r −
1
2
σ
2

∆t −σZ
j

∆t
¸
% correlation
end for
S
m
i
= max
0≤j≤N
S
j
,
´
S
m
i
= max
0≤j≤N
´
S
j
if S
m
i
> B then
V
1
i
= e
−rT
max{S
N
−K, 0}, else V
1
i
= 0
end if
if
´
S
m
i
> B then
V
2
i
= e
−rT
max{
´
S
N
−K, 0}, else V
2
i
= 0 % antithetic variates
end if
V
i
=
1
2
(V
1
i
+ V
2
i
) % pair-averaged sample
end for
¯
V
M
=
1
M
M
¸
i=1
V
i
, ¯ σ
2
M
=
1
M −1
M
¸
i=1
(V
i

¯
V
M
)
2
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 20 / 38
Variance Reduction Techniques Antithetic Variates
Antithetic Variates for Up-and-In Call (Comparison)
Table: A comparison of the conﬁdence intervals for plain Monte Carlo and the use of
Antithetic Variates
Monte-Carlo Monte-Carlo Ratio
M (Plain) (Antithetic Variates) (Widths)
10
2
[0.0754, 0.3857] [0.1392, 0.3709] 1.3387
10
3
[0.1740, 0.2656] [0.2055, 0.2716] 1.3843
10
4
[0.2372, 0.2696] [0.2356, 0.2570] 1.5150
10
5
[0.2411, 0.2511] [0.2417, 0.2485] 1.4799
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 21 / 38
Variance Reduction Techniques Control Variates
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 22 / 38
Variance Reduction Techniques Control Variates
Control Variates I
Suppose that we wish to estimate the parameter
θ = E [X]
and that there is another random variable Y (control variable) with a known
ν = E [Y ] .
We introducing the controlled estimator,
X
c
= X + c (Y −ν), (14)
where c is a parameter that has to be chosen later.
The expectation and the variance are
E [X
c
] = E [X] = θ
Var [X
c
] = Var [X] + c
2
Var [Y ] + 2c Cov [X, Y ] .
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 23 / 38
Variance Reduction Techniques Control Variates
Control Variates II
Hence,
c

= −
Cov [X, Y ]
Var [Y ]
.
At this optimal case, when c = c

, the variance of the controlled estimator
becomes
Var [X

c
] = Var [X] + (c

)
2
Var [Y ] + 2c

Cov [X, Y ] , (15)
where X

c
= X + c

(Y −ν). Inserting c

into (15) and using the correlation
coeﬃcient ρ
XY
,
ρ
XY
=
Cov [X, Y ]

Var [X]

Var [Y ]
,
we deduce that
Var [X

c
]
Var [X]
= 1 −ρ
2
XY
. (16)
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 24 / 38
Variance Reduction Techniques Control Variates
Control Variates III
Remarks
Var [X
c
] < Var [X] if and only if c lies between zero and 2c

, where c

may
be either negative or positive.
In practice, the optimal value of c must be estimated since the covariance
Cov [X, Y ], and possibly Var [Y ], are not known. Of course, a set of pilot
replications can be used to estimate Cov [X, Y ] as well as Var [Y ].
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 25 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 26 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
MC for a Vanilla Call Option
MonteCarlo Call.m
function [Price, CI] = MonteCarlo_Call(S0,K,r,sigma,T,NRepl)
% NRepl : number of replications (paths)
muT = (r - 0.5*sigma^2)*T; sigmaT = sigma * sqrt(T);
DiscPayoff = exp(-r*T) * max( 0, S0*exp(muT+sigmaT*randn(NRepl,1)) - K );
% Matlab command for the Mean and Standard Deviation and the Confidence Interval
%[Price, SDev, CI] = normfit(DiscPayoff);
Price = mean(DiscPayoff); width = 1.96*std(DiscPayoff)/sqrt(NRepl);
CI = [Price-width, Price+width];
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 27 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
MC for a Vanilla Call Option (Script)
MC Call Eg.m
% test MC_Call
clear all, close all, randn(’state’,13);
S0 = 10; K = 9; sigma = 0.1; r = 0.06; T = 1; M = 17;
for i = 1:M
NRepl = 2^(i+4);
[P, CI] = MonteCarlo_Call(S0,K,r,sigma,T,NRepl);
Price(i) = P; confInterval(i,:) = CI;
end
format long; Price, confInterval
[C, Cdelta, P, Pdelta] = CallPut_Delta(S0,K,r,sigma,T);
plot([1:M], Price, ’o’), hold on
plot([0:M+1], ones(1,M+2)*C, ’r’)
for i=1:M
plot([i,i], confInterval(i,:), ’g--’ )
end
xlabel(’M (2^{M+4} Number of Samples)’,’FontSize’,12), ylabel(’V’,’FontSize’,12)
print -r900 -deps ’../figures/MC_Call_eg’
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 28 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
MC for a Vanilla Call Option (Convergence)
0 2 4 6 8 10 12 14 16 18
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
M (2
M+4
Number of Samples)
V
Figure: Convergence of Monte Carlo approximations to European Call
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 29 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
MC for Asian Arithmetic Average Option
Assume that the price S
t
is observed at discrete times t = t
i
for i = 1, 2, . . . , N
with equidistant time interval ∆t := T/N, where T is the maturity. Hence,
t
i
= i ∆t for i = 0, 1, . . . , N. Then, the arithmetic mean,
¯
S
t
, becomes
¯
S
t
=
1
N
N
¸
i=1
S
t
i
=
1
T
N
¸
i=1
∆t S
t
i
.
Asian Arithmetic.m
% Euler-Maruyama: Asian option with Arithmetic Mean
clear all, close all, randn(’state’,13)
K = 1; r = 0.05; T = 1; N = 2^8; dt = T/N; M = 10000;
mu = r; S_0 = 1; sigma_0 = 0.8;
S = S_0*ones(M,1); Sigma = sigma_0*ones(M,1); sumOfS = S;
for j = 1:N
dW_1 = sqrt(dt)*randn(M,1); dW_2 = sqrt(dt)*randn(M,1); % independent of dW_1
% To be safe!
S = abs(S + dt*mu*S + sqrt(S).*Sigma.*dW_1);
Sigma = abs(Sigma + dt*(sigma_0 - Sigma) + sqrt(Sigma).*dW_2);
sumOfS = sumOfS + S;
end
meanOfX = sumOfS/(N+1); Price = exp(-r*T)*mean(max(0,meanOfX-K))
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 30 / 38
Exploring Matlab Codes Monte Carlo Method for European Options
MC for Spread Option (Correlated Assets)
% At maturity the payoff from a call spread option is max(S1-S2-K,0)
% At maturity the payoff from a put spread option is max(K-S1+S2,0)
clear all, close all, randn(’state’, 13)
flag_CallPut = ’c’; S1 = 110; S2 = 100; K = 1; r = 0.06; sum=0;
mu1 = r; mu2 = r; sigma1 = .2; sigma2 = .3; rho = .5; T = 1; nPaths = 10000;
if flag_CallPut == ’c’
z = 1; % Will return call option value
else
z = -1; % Will return put option value
end
drift1 = (mu1 - sigma1^2 / 2) * T; drift2 = (mu2 - sigma2^2 / 2) * T;
sigma1Sqrdt = sigma1 * sqrt(T); sigma2Sqrdt = sigma2 * sqrt(T);
for i = 1:nPaths,
Z1 = randn; Z2 = rho * Z1 + randn * sqrt(1 - rho ^ 2);
St1 = S1 * exp(drift1 + sigma1Sqrdt * Z1);
St2 = S2 * exp(drift2 + sigma2Sqrdt * Z2);
sum = sum + max(z * (St1 - St2 - K), 0);
end
Price = exp(-r * T) * (sum / nPaths)
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 31 / 38
Exploring Matlab Codes Variance Reduction Techniques
Outline
1
Monte Carlo Methods
Basics of Monte Carlo Integration
Option Pricing by Monte Carlo Simulation
2
Variance Reduction Techniques
Antithetic Variates
Control Variates
3
Exploring Matlab Codes
Monte Carlo Method for European Options
Variance Reduction Techniques
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 32 / 38
Exploring Matlab Codes Variance Reduction Techniques
Arithmetic Average Asian Option
MC ArithmeticAsian.m
function [P,CI] = MC_ArithmeticAsian(S0,K,r,sigma,T,NSamples,NRepl)
Payoff = zeros(NRepl,1);
for i=1:NRepl
Path=AssetPaths_gBM(S0,r,sigma,T,NSamples,1);
Payoff(i) = max(0, mean(Path(2:(NSamples+1))) - K);
end
% for simplicity use
[P,approxsigma,CI] = normfit( exp(-r*T) * Payoff);
AssetPaths gBM.m
function SPaths = AssetPaths_gBM(S0,mu,sigma,T,NSteps,NRepl)
% Calculates the asset paths using the exact formula
% NSteps = number of time steps to be taken
% NRepl = number of paths to be simulated
dt = T/NSteps; mudt = (mu-0.5*sigma^2)*dt; sidt = sigma*sqrt(dt);
Increments = mudt + sidt*randn(NRepl, NSteps);
LogPaths = cumsum([log(S0)*ones(NRepl,1) , Increments] , 2);
SPaths = exp(LogPaths);
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 33 / 38
Exploring Matlab Codes Variance Reduction Techniques
Arithmetic Average Asian Option (Control Variable)
E [Y ] = E
¸
N
¸
i=0
S
t
i
¸
=
N
¸
i=0
E [S
i∆t
]
=
N
¸
i=0
S
0
e
ri∆t
= S
0
N
¸
i=0

e
r∆t

i
= S
0
e
r(N+1)∆t
−1
e
r∆t
−1
,
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 34 / 38
Exploring Matlab Codes Variance Reduction Techniques
Arithmetic Average Asian Option (Control Variable, cont.)
MC ArithmeticAsian Control SumOfS.m
function [P,CI] = MC_ArithmeticAsian_Control_SumOfS(...
S0,K,r,sigma,T,NSamples,NRepl,NPilot)
% pilot replications to set control parameter
TryPath=AssetPaths_gBM(S0,r,sigma,T,NSamples,NPilot);
StockSum = sum(TryPath,2); PP = mean( TryPath(:,2:(NSamples+1)), 2 );
TryPayoff = exp(-r*T) * max(0, PP - K);
MatCov = cov(StockSum, TryPayoff); c = - MatCov(1,2) / var(StockSum);
dt = T / NSamples;
ExpSum = S0 * (1 - exp((NSamples + 1)*r*dt)) / (1 - exp(r*dt));
% MC run
ControlVars = zeros(NRepl,1);
for i=1:NRepl
StockPath = AssetPaths_gBM(S0,r,sigma,T,NSamples,1);
Payoff = exp(-r*T) * max(0, mean(StockPath(2:(NSamples+1))) - K);
ControlVars(i) = Payoff + c * (sum(StockPath) - ExpSum);
end
[P,approxSigma,CI] = normfit(ControlVars);
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 35 / 38
Exploring Matlab Codes Variance Reduction Techniques
Control Variates, Testing (Script)
test ControlVariate Sums
% test MC and Control Variate with Asset Sums
clear all, close all, rand(’state’, 13), randn(’state’, 13)
howMany = 5;
for k=2:howMany
[Pmc,CI] = MC_ArithmeticAsian(50,50,0.1,0.4,5/12,5,5*10^k);
[Pcv,CIcv] = MC_ArithmeticAsian_Control_SumOfS( ...
50,50,0.1,0.4,5/12,5,5*10^k,5*10^(k-1));
TC = [k, CI(1), CI(2), CIcv(1), CIcv(2), ...
( CI(2)-CI(1) ) / ( CIcv(2)-CIcv(1) ) ]
end
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 36 / 38
Exploring Matlab Codes Variance Reduction Techniques
Arithmetic Average Asian Option (Comparison)
Table: A comparison of the conﬁdence intervals for plain Monte Carlo and the use of
Control Variates
Pilot Monte-Carlo Monte-Carlo Ratio
Replications Replications (Plain) (Control Variate) (Widths)
5 · 10
2
5 · 10
1
[3.1562, 4.1555] [3.8204, 4.2510] 2.3207
5 · 10
3
5 · 10
2
[3.7335, 4.0564] [3.9444, 4.0817] 2.3501
5 · 10
4
5 · 10
3
[3.9182, 4.0224] [3.9536, 3.9971] 2.3991
5 · 10
5
5 · 10
4
[3.9467, 3.9796] [3.9574, 3.9710] 2.4117
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 37 / 38
Exploring Matlab Codes Variance Reduction Techniques
Thanks!...
Thanks!...
¨
Om¨ ur U
˘
GUR (Middle East Technical University) Monte Carlo Methods for Options @ Yeditepe July 24, 2010 38 / 38

Sign up to vote on this title