Vous êtes sur la page 1sur 41

1

Monte Carlo Simulation and Related Methods 1 In this lecture. . .


G G G G G

the relationship between option values and expectations for equities, currencies, commodities and indices the relationship between derivative products and expectations when interest rates are stochastic how to do Monte Carlo simulations to calculate derivative prices and to see the results of speculating with derivatives how to do simulations in many dimensions using Cholesky factorization how to do numerical integration in high dimensions to calculate the price of options on baskets

2 Relationship between derivative values and simulations


Simulations are at the very heart of finance. With simulations you can explore the unknown future. Simulations can also be used to price options.
G

The fair value of an option is the present value of the expected payoff at expiry under a risk-neutral random walk for the underlying. The risk-neutral random walk for 6 is
G6 U6 G W  6 G ; 

We can therefore write option value


H
> 7 % > 9

 >payoff 6 @

provided that the expectation is with respect to the risk-neutral random walk, not the real one.

3 The algorithm: (1) Simulate the risk-neutral random walk starting at todays value of the asset 6 over the required time horizon. This time period starts today and continues until the expiry of the option. This gives one realization of the underlying price path. (2) For this realization calculate the option payoff. (3) Perform many more such realizations over the time horizon. (4) Calculate the average payoff over all realizations. (5) Take the present value of this average, this is the option value.

4 Price paths are simulated using a discrete version of the stochastic differential equation for 6  An obvious choice is to use
s6 U6 sW  6

sW 

where is from a standardized Normal distribution.


G

This way of simulating the time series is called the Euler method. This method has an error of 2 s W .

5 For the lognormal random walk we are lucky that we can find a simple, and exact, timestepping algorithm. We can write the riskneutral stochastic differential equation for 6 in the form
G OR J 6

? 7 >

  P 

@/ 9 

G; 

This can be integrated exactly to give


6 W
  P 

M? 7 > 6  H[ S

@9  P =
  P 

N
G; 

Or, over a timestep I 9,


$ 9  I 9 $ 9  I $

K? 7 > $ 9 H[ S

@I 9 

sW

(1)

Note that s W need not be small, since the expression is exact. Because this expression is exact and simple it is the best timestepping algorithm to use. Because it is exact, if we have a payoff that only depends on the final asset value, i.e. is European and path independent, then we can simulate the final asset price in one giant leap, using a timestep of 7 .

Spreadsheet showing a Monte Carlo simulation used to value a call and a put option.

A B C D E F G H I 1 Asset 100 Time Sim 1 Sim 2 Sim 3 Sim 4 Sim 5 2 Drift 5% 0 100.00 100.00 100.00 100.00 100.00 3 Volatility 20% 0.01 100.30 102.34 97.50 98.38 96.14 4 Timestep 0.01 0.02 103.52 103.38 99.31 98.55 90.84 5 Int. rate 5% 0.03 106.01 101.98 101.44 96.12 92.94 6 0.04 101.85 106.67 103.02 94.69 93.17 7 0.05 104.75 107.17 105.05 93.25 91.23 = D3+$B$4 8 0.06 106.57 110.24 109.55 94.50 89.97 9 0.07 101.15 107.73 110.77 93.83 91.08 =E3*EXP(($B$5-0.5*$B$3*$B$3)*$B$4+$B$3*SQRT($B$4)*NORMSINV(RAND())) 10 0.08 102.27 107.77 110.01 95.50 93.21 11 0.09 101.06 111.06 107.49 93.86 93.23 12 0.1 103.35 108.60 109.52 92.84 93.82 94 0.92 109.27 87.76 118.48 69.38 116.43 95 0.93 110.22 87.59 118.13 72.19 118.66 96 0.94 105.56 88.18 117.37 73.40 117.15 97 0.95 106.53 86.81 118.27 70.86 115.82 98 0.96 103.14 85.72 116.85 69.36 115.81 99 0.97 102.20 85.85 112.89 70.24 119.18 100 0.98 101.13 84.85 111.49 71.36 115.75 = MAX($B$104-F102,0) = MAX(G102-$B$104,0) 101 0.99 101.91 87.83 111.69 69.97 116.11 =AVERAGE(E104:IV104) 102 1 105.99 87.60 111.45 70.67 116.72 103 104 Strike 105 CALL Payoff 0.99 0.00 6.45 0.00 11.72 105 =D105*EXP(Mean 8.43 106 $B$5*$D$102) PV 8.02 107 PUT Payoff 0.00 17.40 0.00 34.33 0.00 108 Mean 8.31 109 PV 7.9 110 111

7 The method is particularly suitable for path-dependent options. In the next spreadsheet is shown the valuation of an Asian option. This contract pays of an amount P D [ $ >      where $ is the average of the asset price over the one-year life of the contract.

Spreadsheet showing a Monte Carlo valuation of an Asian option.

A B C D E F G H I 1 Asset 100 Time Sim 1 Sim 2 Sim 3 Sim 4 Sim 5 2 Drift 5% 0 100.00 100.00 100.00 100.00 100.00 3 Volatility 20% 0.01 100.88 100.74 99.07 100.73 100.03 4 Timestep 0.01 0.02 103.01 98.50 100.73 101.71 98.72 5 Int. rate 5% 0.03 103.47 97.56 98.73 103.43 99.96 6 0.04 103.92 98.75 97.64 99.90 102.33 = D3+$B$4 7 0.05 106.31 97.94 96.76 100.82 101.43 8 0.06 105.57 99.37 98.38 100.14 97.93 9 0.07 107.02 98.46 97.36 102.30 97.19 =E3*EXP(($B$5-0.5*$B$3*$B$3)*$B$4+$B$3*SQRT($B$4)*NORMSINV(RAND())) 10 0.08 107.05 96.74 99.18 100.86 94.89 11 0.09 104.59 97.27 98.31 101.32 94.26 12 0.1 103.80 95.63 100.89 103.75 92.99 13 0.11 101.61 97.06 99.58 107.24 94.21 93 0.91 82.50 95.63 105.93 119.52 97.35 94 0.92 79.69 95.58 105.05 122.86 97.07 95 0.93 78.91 93.11 105.41 119.11 98.27 96 0.94 79.10 92.92 106.84 121.56 100.98 97 0.95 75.42 92.06 107.37 123.28 102.66 98 0.96 74.77 92.58 107.40 121.94 102.34 =AVERAGE(E2:E102) 99 0.97 75.47 91.01 106.90 122.09 101.44 100 0.98 76.47 89.98 105.84 122.50 100.14 = MAX(G104-$B$104,0) 101 0.99 77.47 87.15 104.72 121.35 99.69 =AVERAGE(E104:IV104) 102 1 76.30 86.68 104.48 122.35 100.30 103 104 Average 91.27 86.49 95.40 111.87 98.31 105 106 Strike 105 ASIAN Payoff 0.00 0.00 0.00 6.87 0.00 107 =D105*EXP(Mean 3.18 108 $B$5*$D$102) PV 3.02 109 110

3 Advantages of Monte Carlo simulation


G G G G G G G G

The mathematics that you need to perform a Monte Carlo simulation can be very basic. Correlations can be easily modeled. There is plenty of software available, at the least there are spreadsheet functions that will suffice for most of the time. To get a better accuracy, just run more simulations. The effort in getting some answer is very low. The models can often be changed without much work. Complex path dependency can often be easily incorporated. People accept the technique, and will believe your answers.

10

4 Using random numbers


If the size of the timestep is s W then we may introduce errors of 2 s W by virtue of the discrete approximation to continuous events. E.g. if we have a barrier option we may miss the possibility of the barrier being triggered between steps. Because we are only simulating a finite number of an infinite number of possible paths, the error due to using 1 realizations of the asset price paths is 2 1 >    .

11 The error in the price is therefore


2 P D[ s W 5  1

NN


The total number of calculations required in the estimation of a derivative price is then 2 1 s W . To minimize the error, while keeping the total computing time fixed such that 2 1 s W . , we must choose
1 2 .


and

sW

2 .

> 

12

5 Generating Normal variables


G

A useful distribution that is easy to implement on a spreadsheet, and is fast, is the following approximation to the Normal distribution: U



> 

L 

where the L are independent random variables, drawn from a uniform distribution over zero to one.
G

To generate genuinely Normally-distributed random numbers use the BoxMuller method. This method takes uniformly-distributed variables and turns them into Normal. The BoxMuller method takes two uniform random numbers [  and [  between zero and one and combines them to give two numbers \  and \  that are both Normally distributed:
\ 

>  OQ [  FR V  ~ [ 

and

\

>  OQ [  VLQ  ~ [  

13

90 80 70 60 50 40 30 20 10 0 -3.80 -3.09 -2.37 -1.66 -0.95 -0.24 0.47 1.19 1.90 2.61 3.32

1.The approximation to the Normal distribution using BoxMuller.

14

6 Real versus risk neutral, speculation versus hedging


In the next figure are shown several realizations of a risk-neutral asset price random walk. These are the thin lines. The bold lines in this figure are the corresponding real random walks using the same random numbers but here with a higher drift instead of the interest rate drift.
180 160 140 120 100 80 60 40 20 0 0 0.2 0.4 0.6 0.8 1

2.Real and risk-neutral simulations.

15 We can use simulations to estimate the payoff distribution from holding an unhedged option position. In this situation we are interested in the whole distribution of payoffs (and their present values) and not just the average or expected value. This is because in holding an unhedged position we cannot guarantee the return that we (theoretically) get from a hedged position.
G

It is therefore valid and important to have the real drift as one of the parameters; it would be incorrect to estimate the probability density function for the return from an unhedged position using the risk-neutral drift.

16

7 Interest rate products


The relationship between expected payoffs and option values when the interest rate is stochastic is more complicated: (1) Simulate the random walk for the risk-adjusted spot interest rate 7 over the required time horizon. This gives one realization of the spot rate path. (2) For this realization calculate two quantities, the payoff and the average interest rate realized up until the payoff is received. (3) Perform many more such realizations. (4) For each realization of the 7 random walk calculate the present value of the payoff for this realization discounting at the average rate for this realization. (5) Calculate the average present value of the payoffs over all realizations, this is the option value.

17 In other words, option value


 

>

#
9

7 Q / Q

payoff 7

Why is this different from the deterministic interest rate case? Why discount at the average interest rate? We discount all cashflows at the average rate because this is the interest rate received by a money market account, and in the risk-neutral world all assets have the same risk-free growth rate. Recall that cash in the bank grows according to
G0 GW U W 0 

The solution of which is


0 W 0 7 H
>

#
9

7 Q / Q

This contains the same discount factor as in the option value.

18 The choice of discretization of spot rate models is usually limited to the Euler method
s U  X UW > z U W Z U W G W  Z UW

sW 

In the next spreadsheet the Monte Carlo method is used to price a contract with payoff P D [ U >      . Maturity is in one year. The model used to perform the simulations is Vasicek with constant parameters. The spot interest rate begins at 6%. The option value is the average present value in the last row.

Spreadsheet showing the Monte Carlo valuation of an interest rate product.

A B C D E F G 1 Spot rate 10% Time Sim 1 Sim 2 Sim 3 2 Mean rate 8% 0 10.00% 10.00% 10.00% 3 Reversion rate 0.2 0.01 10.16% 10.12% 10.02% 4 Volatility 0.007 0.02 10.25% 9.95% 10.02% 5 Timestep 0.01 0.03 10.27% 9.92% 9.87% 6 0.04 10.18% 9.83% 9.82% 7 0.05 10.24% 9.72% 9.91% =D3+$B$5 8 0.06 10.12% 9.66% 9.93% 9 0.07 10.12% 9.69% 9.90% 10 0.08 10.09% 9.76% 9.99% 11 0.09 10.18% 9.71% 10.02% =F5+$B$3*($B$212 0.1 10.23% 9.70% 10.05% F5)*$B$5+$B$4*SQRT($B$5)*(RAND()+RAND()+RAND()+RAND()+RAND() 13 0.11 10.22% 9.68% 10.00% +RAND()+RAND()+RAND()+RAND()+RAND()+RAND()+RAND()-6) 14 0.12 10.09% 9.69% 10.11% 15 0.13 10.05% 9.53% 10.09% 95 0.93 9.45% 9.75% 10.11% =AVERAGE(E2:E102) 96 0.94 9.40% 9.74% 10.11% 97 0.95 9.50% 9.56% 10.19% 98 0.96 9.40% 9.58% 10.24% 99 0.97 9.30% 9.58% 10.21% 100 0.98 9.38% 9.67% 10.18% =MAX(E102-$B$106,0) 101 0.99 9.38% 9.76% 10.17% 102 1 9.40% 9.69% 10.21% 103 =E106*EXP(-$D$102*E104) 104 Mean rate 9.44% 9.67% 10.23% 105 106 Strike 10% Payoff 0.0000 0.0000 0.0021 107 =AVERAGE(E107:IV107) PV'd 0.0000 0.0000 0.0019 108 Mean 0.000688 109 110 111 112 113 114

H Sim 4 10.00% 10.04% 10.03% 10.00% 10.00% 10.09% 10.08% 10.03% 10.02% 10.13% 10.15% 10.19% 10.16% 10.21% 10.30% 10.32% 10.38% 10.38% 10.33% 10.27% 10.31% 10.32% 10.25% 0.0032 0.0028

20

8 Calculating the greeks


The simplest way to calculate the delta using Monte Carlo simulation is to estimate the options value twice. The delta of the option is
d
K

OLP

9 6  K  W > 9 6 > K  W K

This is an estimate of the first derivative, with an error of 2 K  . However, the error in the measurement of the two option values at 6  K and 6 > K can be much larger than this for the Monte Carlo simulation. These Monte Carlo errors are then magnified when divided by K , resulting in an error of 2  K     .
G

To overcome this problem, estimate the value of the option at 6  K and 6 > K using the same values for the random numbers. In this way the errors in the Monte Carlo simulation will cancel each other out.

21

9 Higher dimensions: Cholesky factorization


Monte Carlo simulation is a natural method for the pricing of Europeanstyle contracts that depend on many underlying assets. Supposing that we have an option paying off some function of 6  , 6  ,  ,6 G then we could, in theory, write down a partial differential equation in /   variables. Such a problem would be horrendously time consuming to compute. The simulation methods discussed above can easily be extended to cover such a problem. All we need to do is to simulate
$ L 9  I 9 $
L

K? 7 > 9 H[ S
( > L M @

 P 

 L

@I 9 

I9 S

The catch is that the L are correlated,


 LM 

How can we generate correlated random variables? This is where Cholesky factorization comes in.

22 Let us suppose that we can generate G uncorrelated Normally distributed variables t  , J  ,. . . , J / . We can use these variables to get correlated variables with the transformation
S 

MJ

(2)

where S and J are the column vectors with L and t L in the Lth rows. The matrix M is special and must satisfy MM7
 E

with E being the correlation matrix.

23 It is easy to show that this transformation will work. From (2) we have % % % (3) S S  MJ J M  Taking expectations of each entry in this matrix equation gives
(
%

A B S S 

M

A B M JJ
%

MM%

 E 

This decomposition of the correlation matrix is not unique. It results in a matrix M that is lower triangular.

24

10 Speeding up convergence
Monte Carlo simulation is inefficient, compared with finite-difference methods, in dimensions less than about three. It is natural, therefore, to ask how can one speed up the convergence. There are several methods in common use:
G G

Antithetic variables Control variates

25 10.1 Antithetic variables In this technique one calculates two estimates for an option value using the one set of random numbers. We do this by
G G

using our Normal random numbers to generate one realization of the asset price path, an option payoff and its present value

taking the same set of random numbers but changing their signs, thus replacing with > and simulating a realization, and calculating the option payoff and its present value. Our estimate for the option value is the average of these two values. Perform this operation many times to get an accurate estimate for the option value.

26 10.2 Control variate technique Suppose we have two similar derivatives, the former is the one we want to value by simulations and the second has a similar (but nicer) structure such that we have an explicit formula for its value.
G

Use the one set of realizations to value both options. Call the values estimated by the Monte Carlo simulation 9  and '  . If the accurate value of the second option is '  then a better estimate than '  for the value of the first option is
'  > '   ' 

The argument behind this method is that the error in 9  will be the same as the error in 9  , and the latter is known.

27

11 Numerical integration
Often the fair value of an option can be written down analytically as an integral e.g. non-path-dependent European options contingent upon G lognormal underlyings, for which we have

9


> 7 % > 9 

 ~ 7 > W


> /

Deti

???

Payoff $
$ 


??? $
/

> 

??? $

H[ S

>

 

> 

??? P /
/$


> 

??? / $

where
F
L

M M$ N M
OR J
L

P L % > 9   

7 > 

>

 L

N
% > 9

and E is the correlation matrix for the / assets and Payoff(???) is the payoff function. If we do have such a representation of an options value then all we need do to value it is to estimate the value of the multiple integral.

28

12 Regular grid
We can do the multiple integration by evaluating the function on a uniform grid in the / -dimensional space of assets. There would thus be    / grid points in each direction where  is the total number of points used. Supposing we use the trapezium or mid-point rule, the error in the estimation of the integral will be  >   / and the time taken approximately  since there are  function evaluations. As the dimension / increases this method becomes prohibitively slow.

29

13 Basic Monte Carlo integration


Suppose that we want to evaluate the integral
 I [      [ / G [     G [ / 

over some volume. We can very easily estimate the value of this by Monte Carlo simulation. The idea behind this is that the integral can be rewritten as

 

I [      [ / G [    G [ /

volume of region of integration d averageI  where the average of I is taken over the whole of the region of integration.

30 We can sample the average of I by Monte Carlo sampling using uniformly distributed random numbers in the G -dimensional space. After 1 samples we have averageI
{
 1

;
1

I [ L

(4)

L 

where [ L is the vector of values of [     [ / at the Lth sampling. As 1 increases, so the approximation improves. Expression (4) is only an approximation.

31 The size of the error can be measured by the standard deviation of the correct average about the sampled average, this is

7 K 


> 1

L
 1

where
1   

;
1 L 

1 [ L

and I 

;
1 L 

1 [ L 

The error in the estimation of the value of an integral using a Monte Carlo simulation is 2 1 >    where  is the number of points used, and is independent of the number of dimensions. There are  function evaluations and so the computational time is  .
G

The accuracy is much higher than that for a uniform grid if we have five or more dimensions.

32 In financial problems we often have integrals over the range zero to infinity. The choice of transformation from zero-one to zero-infinity should be suggested by the problem under consideration. Let us suppose that we have / assets following correlated random walks. The risk-neutral value of these assets at a time 9 can be written as

$ L %

$ L 9 0

5  % > 9  P L L 7 > W 7 >  L> P  L  

The random variables L are Normally distributed and correlated.

33 We can now write the value of our European option as


H
> U % > 9  

???
>  > 

Payoff $  7

    6 / 7 S      / G

  G / 

where S      / is the probability density function for G correlated Normal variables with zero mean and unit standard deviation. We dont need to write down S explicitly, we wont need to know its functional form
G

as long as we generate numbers from this distribution. To value the option we must generate suitable Normal variables. The first step is to generate uncorrelated variables and then

G G

to transform them into correlated variables. Both of these steps have been explained above; use BoxMuller and then Cholesky. The option value is then estimated by the average of the payoff over all the randomly generated numbers.

34

14 Low-discrepancy sequences
With the basic Monte Carlo method we cannot be certain that the generated points in the / -dimensional space are nicely distributed. There is inevitably a good deal of clumping. Suppose that we want to calculate the value of an integral in two dimensions and we use a Monte Carlo simulation to generate a large number of points in two dimensions at which to sample the integrand. The choice of points may look something like the following.
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

3.A Monte Carlo sample in two dimensions.

35 Now suppose we want to add a few hundred more points to improve the accuracy. Where should we put the new points? If we put the new points in the gaps between others then we increase the accuracy of the integral. If we put the points close to where there are already many points then we could make matters worse. We want a way of choosing points such that
G G

they are not too bunched, but nicely spread out

we can add more points later without spoiling our distribution. Monte Carlo is bad for evenness of distribution, but a uniform grid does not stay uniform if we add an arbitrary number of extra points. Low discrepancy sequences or quasi-random sequences have the properties we require.

36 There are many such sequences with names such as Sobol, Faure, Haselgrove and Halton. Halton sequences are by far the easiest to describe. The Halton sequence is a sequence of numbers K L E for L     ???. The integer E is the base. The numbers all lie between zero and one. The numbers are constructed as follows. First choose your base. Let us choose 2. Now write the positive integers in ascending order in base 2, i.e. 1, 10, 11, 100, 101, 110, 111 etc. The Halton sequence base 2 is the reflection of the positive integers in the decimal point i.e. Integers Integers base 10 base 2 1 1 2 10 3 11 4 100
??? ???

Halton sequence base 2


 @  @  @  @
     

  @   @
 

 

  @

  @

   

???

 

Halton number base 10 0.5 0.25 0.75 0.125


???

37 Generally, the integer Q can be written as


L

;
2

D ME

M 

in base E , where 

T D M  E.
K L E

The Halton numbers are then given by

;
2

D ME

> M> 

M 

The resulting sequence is nice because as we add more and more numbers, more and more dots, we fill in the range zero to one at finer and finer levels.

38 The next figure shows the approximation to the Normal distribution using 500 points from a Halton sequence and the BoxMuller method.
70 60 50 40 30 20 10 0 -2.65 -1.88 -1.11 -0.34 0.43 1.19 1.96 2.73

4.The approximation to Normal using Halton numbers.

39 When distributing numbers in two dimensions choose, for example, Halton sequence of bases 2 and 3 so that the integrand is calcu  ??? 1 . The bases in lated at the points K L  K L  for L the two sequences should be prime numbers.
1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

5.Halton points in two dimensions.

40 The estimate of the G -dimensional integral

=


???

1 [   ??? [ / / [   ???  G [ /

is then
 1

;
L 

1 K L E   ???  K LE Q 

where E M are distinct prime numbers. The error in these quasi-random methods is
2 OR J 1 1
G

> 

and is even better than Monte Carlo at all dimensions. The time taken is  .

41 The error is clearly sensitive to the number of dimensions / . To fully appreciate the inverse relationship to  can require a lot of points. However, even with fewer points, in practice the method at its worst has the same error as Monte Carlo. In the next figure is shown the relative error in the estimate of value of a five-dimensional contract as a function of the number of points used. The inverse relationship with the Halton sequence is obvious.
-2 2 -2.5 -3 -3.5 -4 -4.5 -5 -5.5 -6 2.5 MC Halton 3 3.5 4

6.Error estimates.

Vous aimerez peut-être aussi