Loading documents preview...
Monte Carlo Methods for Options ¨ ur UGUR ˘ Om¨ Institute of Applied Mathematics Middle East Technical University, Ankara, Turkey
July 24, 2010
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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 Z I= g(x) dx, A
n
where A ⊂ R is Lebesgue measurable. We may estimate I by randomly sampling a sequence of points xi ∈ A, i = 1, 2, . . . , N , and building the estimator N
vol(A) X IbN = g(xi ), N i=1
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 IbN = I
N →∞
with probability one. ¨ ur UGUR ˘ Om¨ (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 ∈ Rn , then the Monte Carlo integration may be used to estimate the expected value Z g(x)f (x) dx E [g(X)] = Rn
of an arbitrary function g of X.
¨ ur UGUR ˘ Om¨ (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 ∞ {Xi }i=1 , the partial sum SN is defined by SN =
N X i=1
Xi = X1 + X2 + · · · + XN .
(1)
¯ N which is another random variable Associated with SN is the sample mean X given by N 1 1 X ¯ XN = SN = Xi . N N i=1
(2)
This is an unbiased estimator of the parameter µ = E [Xi ]
¨ ur UGUR ˘ Om¨ (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 ¯ N is the same as µ, of the i.i.d. sample Xi . In other words, the expectation of X since ¯ N = 1 E [SN ] = E [Xi ] = µ, E X N
(3)
∞
due to the i.i.d. sequence {Xi }i=1 .
¨ ur UGUR ˘ Om¨ (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 {Xi }i=1 , suppose that the mean µ = E [Xi ] exists. Then, N X ¯ N = lim 1 lim X Xi = µ N →∞ N →∞ N i=1
with probability one.
¨ ur UGUR ˘ Om¨ (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 ¯ N by considering the Moreover, we may quantify the quality of the estimator X expectation of the squared-error as ¯ N − µ)2 E (X
= = = =
2 ¯N 2 ¯ − E X E X N i h ¯ N = 12 Var PN Xi Var X i=1 N PN 1 Var [X ] 2 i i=1 N σ2 N ,
(4)
2 where σ 2 = Var [Xi ] may be estimated by a sample variance, say σ ¯N . 2 ¯ ¯N Therefore, beside an unbiased sample mean XN , an unbiased sample variance σ may be given as N
2 σ ¯N
1 X ¯N 2 = N Xi − X = N − 1 i=1 N −1
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
N 1 X 2 2 ¯N X −X N i=1 i
Monte Carlo Methods for Options @ Yeditepe
!
.
July 24, 2010
(5)
9 / 38
Monte Carlo Methods
Basics of Monte Carlo Integration
Squared-Error II It is not difficult to show that 2 E σ ¯N = Var [Xi ] = σ 2
holds by using the second equality in (5).
¨ ur UGUR ˘ Om¨ (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 {Xi }i=1 with finite mean µ and finite variance σ 2 > 0, let ¯N − µ SN − N µ X √ ZN = . =p σ N σ 2 /N
Then, for x ∈ R,
lim P {ZN
N →∞
1 ≤ x} = Φ(x) = √ 2π
Z
x
e−ξ
2
/2
dξ,
−∞
where Φ is the standard normal distribution function.
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
July 24, 2010
11 / 38
Monte Carlo Methods
Basics of Monte Carlo Integration
Confidence Interval I Now, a (1 − α)th level of confidence interval for a random variable Z is defined by the interval [−z1−α/2 , z1−α/2 ] such that the critical number z1−α/2 is found from the equation P −z1−α/2 ≤ Z ≤ z1−α/2 = 1 − α.
(6)
If, further, the random variable Z is standard normally distributed, then 1 − α = Φ(z1−α/2 ) − Φ(−z1−α/2 ) = 2 Φ(z1−α/2 ) − 1. In other words, Φ(z1−α/2 ) = 1 − α/2.
(7)
Therefore, using the inverse of the error function, erf−1 , z1−α/2 = Φ−1 (1 − α/2) =
√
2 erf−1 (1 − α).
(8)
Commonly used critical numbers are ¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
July 24, 2010
12 / 38
Monte Carlo Methods
Basics of Monte Carlo Integration
Confidence Interval II
z0.975
=
z0.995
=
Φ−1 (1 − 0.05/2) ≈ 1.96,
Φ−1 (1 − 0.01/2) ≈ 2.58,
for
α = 0.05,
(9)
for
α = 0.01,
(10)
for the (1 − α)th level of confidence interval for a standard normally distributed random variable. Thus, if the number of samples N is large enough, then the random variable ¯N − µ X Z=p 2 σ ¯N /N
can be considered to be approximately standard normally distributed by the central limit theorem.
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
July 24, 2010
13 / 38
Monte Carlo Methods
Basics of Monte Carlo Integration
Confidence Interval III Therefore, 1−α
≈ =
(
) ¯N − µ X P −z1−α/2 ≤ p 2 ≤ z1−α/2 σ ¯N /N q q 2 2 ¯ ¯ ¯N /N ≤ µ ≤ XN + z1−α/2 σ ¯N /N P XN − z1−α/2 σ
implies that an approximate (1 − α)th level confidence interval for the parameter ¯ N and the sample variance µ = E [Xi ] may be computed from the sample mean X 2 σ ¯N as q q 2 /N , X 2 /N . ¯ N + z1−α/2 σ ¯ N − z1−α/2 σ ¯N ¯N (11) X This palso implies that the rate of convergence of Monte Carlo method is of order 2 σ ¯N /N . O ¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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 (ST )k % by numerical methods (for SDEs) calculate the payoff, Vk else draw Zk ∼ N (0,n1) √ o (ST )k = S0 exp r − 21 σ 2 T + σZk T calculate the payoff, Vk end if end for b (V ) = 1 PN Vk % estimate of risk-neutral expectation E k=1 N b (V ) Vb = e−rT E % approximate value of option b (V ) ≈ V (S0 , 0) = e−rT EQ [V (ST , T )] Vb = e−rT E
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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, 1 N 1 , Xi i=1 = X11 , X21 , . . . , XN
Xi2
N
i=1
2 . = X12 , X22 , . . . , XN
(12)
These samples may separately be used in Monte Carlo simulations, and so may the pair-averaged samples Xi =
1 Xi1 + Xi2 , 2
i = 1, 2, . . . , N,
(13)
since these are also i.i.d.. Assuming a correlation between the samples as Cov Xi1 , Xi2 < 0,
¨ ur UGUR ˘ Om¨ (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 n o Cov Xi1 , Xi2 ≤ 1 Var Xi1 + Var Xi2 , 2 it follows that
Var [Xi ]
= ≤
Hence,
¯N Var X
= =
o 1n Var Xi1 + Var Xi2 + 2 Cov Xi1 , Xi2 4 1 Var Xi1 + Var Xi2 . 2 "
N 1 X Var Xi N i=1
#
1 1 Var Xi1 + Var Xi2 . Var [Xi ] ≤ N 2N
This is the idea of antithetic variates. ¨ ur UGUR ˘ Om¨ (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 Zj ∼ N (0, 1) n
√ o r − 21 σ 2 ∆t + σZj ∆t n √ o = Sbj exp r − 12 σ 2 ∆t − σZj ∆t
Sj+1 = Sj exp
% introduce
Sbj+1 end for Sim = max Sj ,
% correlation
0≤j≤N
Sbim = max Sbj 0≤j≤N
if Sim > B then Vi1 = e−rT max{SN − K, 0}, else Vi1 = 0 end if if Sbim > B then Vi2 = e−rT max{SbN − K, 0}, else Vi2 = 0 end if Vi = 21 (Vi1 + Vi2 ) end for M M 1 X 1 X 2 V¯M = Vi , σ ¯M (Vi − V¯M )2 = M i=1 M − 1 i=1
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
% antithetic variates % pair-averaged sample
July 24, 2010
20 / 38
Variance Reduction Techniques
Antithetic Variates
Antithetic Variates for Up-and-In Call (Comparison) Table: A comparison of the confidence intervals for plain Monte Carlo and the use of Antithetic Variates
M 102 103 104 105
Monte-Carlo (Plain) [0.0754, [0.1740, [0.2372, [0.2411,
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
0.3857] 0.2656] 0.2696] 0.2511]
Monte-Carlo (Antithetic Variates) [0.1392, [0.2055, [0.2356, [0.2417,
0.3709] 0.2716] 0.2570] 0.2485]
Monte Carlo Methods for Options @ Yeditepe
Ratio (Widths) 1.3387 1.3843 1.5150 1.4799
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
¨ ur UGUR ˘ Om¨ (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, Xc = X + c (Y − ν),
(14)
where c is a parameter that has to be chosen later. The expectation and the variance are E [Xc ] = E [X] = θ Var [Xc ] = Var [X] + c2 Var [Y ] + 2c Cov [X, Y ] . ¨ ur UGUR ˘ Om¨ (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 [Xc∗ ] = Var [X] + (c∗ )2 Var [Y ] + 2c∗ Cov [X, Y ] , Xc∗
∗
(15)
∗
where = X + c (Y − ν). Inserting c into (15) and using the correlation coefficient ρXY , Cov [X, Y ] p ρXY = p , Var [X] Var [Y ]
we deduce that
Var [Xc∗ ] = 1 − ρ2XY . Var [X]
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
(16)
July 24, 2010
24 / 38
Variance Reduction Techniques
Control Variates
Control Variates III Remarks Var [Xc ] < 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 ].
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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];
¨ ur UGUR ˘ Om¨ (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’
¨ ur UGUR ˘ Om¨ (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) 1.9
1.8
1.7
V
1.6
1.5
1.4
1.3
1.2
1.1
0
2
4
6
8 M+4
M (2
10
12
14
16
18
Number of Samples)
Figure: Convergence of Monte Carlo approximations to European Call
¨ ur UGUR ˘ Om¨ (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 St is observed at discrete times t = ti for i = 1, 2, . . . , N with equidistant time interval ∆t := T /N , where T is the maturity. Hence, ti = i ∆t for i = 0, 1, . . . , N . Then, the arithmetic mean, S¯t , becomes N N 1X 1 X S ti = ∆t Sti . S¯t = N i=1 T i=1
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))
¨ ur UGUR ˘ Om¨ (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) SpreadOption MC.m % 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)
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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);
¨ ur UGUR ˘ Om¨ (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 X i=0
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
N X i=0
#
S ti =
N X
E [Si∆t ]
i=0
S0 eri∆t = S0
N X i=0
er∆t
i
= S0
Monte Carlo Methods for Options @ Yeditepe
er(N +1)∆t − 1 , er∆t − 1
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);
¨ ur UGUR ˘ Om¨ (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
¨ ur UGUR ˘ Om¨ (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 confidence intervals for plain Monte Carlo and the use of Control Variates
Replications
Pilot Replications
5 · 102 5 · 103 5 · 104 5 · 105
5 · 101 5 · 102 5 · 103 5 · 104
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte-Carlo (Plain) [3.1562, [3.7335, [3.9182, [3.9467,
4.1555] 4.0564] 4.0224] 3.9796]
Monte-Carlo (Control Variate) [3.8204, [3.9444, [3.9536, [3.9574,
Monte Carlo Methods for Options @ Yeditepe
4.2510] 4.0817] 3.9971] 3.9710]
Ratio (Widths) 2.3207 2.3501 2.3991 2.4117
July 24, 2010
37 / 38
Exploring Matlab Codes
Variance Reduction Techniques
Thanks!...
Thanks!...
¨ ur UGUR ˘ Om¨ (Middle East Technical University)
Monte Carlo Methods for Options @ Yeditepe
July 24, 2010
38 / 38