monte-carlo simulation
DESCRIPTION
Monte-Carlo Simulation. Mathematical basis. The discounted price is a martingale ( MA4257 and MA5248). European vanilla call: linked to BS equation. Generating stock prices (1). Generating stock prices (2). - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/1.jpg)
Monte-Carlo Simulation
![Page 2: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/2.jpg)
Mathematical basis• The discounted price is a martingale (MA4257 and
MA5248).
![Page 3: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/3.jpg)
European vanilla call: linked to BS equation
![Page 4: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/4.jpg)
Generating stock prices (1)
![Page 5: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/5.jpg)
Generating stock prices (2)
• For European vanilla options, we can just take t=T and use the discrete process of x since prices at intermediate times are unnecessary.
• For path dependent options like Asian options, it is necessary to generate prices at each ti.
![Page 6: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/6.jpg)
Generating normal variables
The polar form of the Box-Muller method can be found at http://en.wikipedia.org/wiki/Box-Muller_method.
![Page 7: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/7.jpg)
A Matlab code for European call
• T=0.5; N=100; dt=T/N; sigma=0.3; r=0.05; q=0.01; mu=r-q; S0=1; K=0.9; nsample=2000; v=0; • for i=1:nsample s(1)=S0; for j=2:N+1 eps=randn; s(j)=s(j-1)*(1+mu*dt+eps*sigma*sqrt(dt)); end v=v+max(s(j)-K,0); end v=exp(-r*T)*v/nsample
![Page 8: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/8.jpg)
Another code for European call
• T=0.5; sigma=0.3; r=0.05; q=0.01; mu=r-q-sigma^2/2; S0=1; K=0.9; nsample=2000; v=0;• for i=1:nsample x=mu*T+randn*sigma*sqrt(dt)); s=S0*exp(x); v=v+max(s-K,0); end v=exp(-r*T)*v/nsample
![Page 9: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/9.jpg)
A better code
• T=0.5; sigma=0.3; r=0.05; q=0.01; mu=r-q-sigma^2/2; S0=1; K=0.9; nsample=2000;
• epsv=randn(nsample,1);• ST=S0*exp((mu-sigma^2/2)*T+epsv*sigma*sqrt(T));• v=exp(-r*T)*mean(max(ST-X,0))
![Page 10: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/10.jpg)
Number of trials and error of estimate
• The number of simulation trials carried out depends on the accuracy required.
• Denote the mean by b and the standard deviation by . Then variable b is the simulation's estimate for the true value f, with the standard error of the estimate
• To increase the accuracy by a factor of 10, the number of trials must increase by a factor of 100.
![Page 11: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/11.jpg)
Sampling through a tree
• Suppose we have a binomial tree where the risk neutral probability is p.
• The sampling procedure:– At each node, we sample a random number between
[0,1]. We take the down path if the number <1-p; and the up path otherwise. Once we have a complete path from the initial node to the end of the tree we can calculate a payoff. This completes the first trial.
• A similar procedure is used to complete more trials. The mean of the payoffs is discounted at the risk-free rate to get an estimate of the value of the derivative.
![Page 12: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/12.jpg)
Calculating the Greek letters: method 1
![Page 13: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/13.jpg)
Calculating the Greek letters: method 2
![Page 14: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/14.jpg)
Calculating the Greek letters: method 3
![Page 15: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/15.jpg)
Generation of correlated samples (1)
![Page 16: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/16.jpg)
Generation of correlated samples (2)
The Cholesky factorization gives one way of choosing this decomposition.
![Page 17: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/17.jpg)
Generation of correlated samples (3)
![Page 18: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/18.jpg)
Antithetic variance reduction
![Page 19: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/19.jpg)
Control variates (1)
Suppose we are trying to use MC to price a derivative A, and there is a derivative B with payoff correlated to A and with a price available in analytically closed form.
![Page 20: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/20.jpg)
Control variates (2)
![Page 21: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/21.jpg)
Control variates (3): an example
![Page 22: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/22.jpg)
Handling early exercise
• Not required• I refer interested students to Longstaff and Schwartz (2001):
Valuing American options by simulation: a simple least squares approach, Review of Financial Studies, 14(1), 113-147.
![Page 23: Monte-Carlo Simulation](https://reader035.vdocuments.net/reader035/viewer/2022081418/56814e3c550346895dbba46c/html5/thumbnails/23.jpg)
Quasi Monte Carlo
• Not required• Quasi MC makes use of low discrepancy sequences,
instead of pseudo random variables, to generate representative samples for desired probability distributions.
• References: – http://www.puc-rio.br/marco.ind/quasi_mc.html – P. Glasserman, Monte Carlo Methods in Financial
Engineering, Springer