Modèles fnancers en emps connu Inroducon o dervave prcng by Mone Carlo 204-204
Dervave Prcng by Mone Carlo We consder a conngen clam of maury T e.g. an equy opon on one or several underlyng asses, whn a Black-Scholes framework Is prce a s gven by: P P, S E Q e rt payoff T S S where r s he consan, deermnsc rsk free rae and S he underlyng prces The prncple of Mone Carlo prcng s o approxmae numercally hs expecaon by : P e # Smul rt # Smul scen payoff scen T where payoff T are realsaons of..d. random varables havng he same dsrbuon as he payoff of he dervave 2
Dervave Prcng by Mone Carlo Ths s a smple applcaon of he law of large numbers, ha says ha f, =,, N, are..d. wh E <, hen : N N = a.s. E The dea s hence o fnd algorhms o smulae..d. realsaons of he payoff of he opon As he expecaon s aken under he rsk-neural measure, he dsrbuon of he payoff has o be consdered under hs measure In pracce, we ofen don know he payoff dsrbuon s generally no gven explcly, and hs s precsely n hese cases ha Mone Carlo smulaons become helpful In he subsequen, we see how o smulae such payoffs n an..d. way 3-3-
Dervave Prcng by Mone Carlo Smulaon of a Brownan moon: A smple mehod consss o smulae normal dsrbuons: If, n, are ndependen sandard Gaussan varables, and f we defne he sequence: S 0 = 0, S n+ = S n + δ n hen S 0, S,, S n has he same dsrbuon as : W 0, W δ, W 2δ,, W nδ More generally for every funcon gx, gs 0, gs,, gs n has he same dsrbuon as : gw 0, gw δ, gw 2δ,, gw nδ Ths already provdes a way o approxmae numercally European opons n he framework of models wh explc soluons of he EDS governng he underlyng whch s he case of he Black-Scholes model 4-4-
Dervave Prcng by Mone Carlo Smulaon of a Brownan moon: In pracce, we mgh need o prce exoc opons wh payoff funcon of he underlyng a predefned nsans 0 = 0 < < < k, requrng smulang one or several Brownan moons a hese nsans To smulae a sandard B.M. a nsans 0 = 0 < < < k : Smulae k rvs ε.. d. N0, Apply he followng scheme: o W = ε o W 2 = W + 2 ε 2 = ε + 2 ε 2 o k o W k = = ε 5-5-
Dervave Prcng by Mone Carlo Smulaon whn Black-Scholes model /2: We know ha he soluon of he EDS of he geomerc Brownan s: S = S 0 e r 2 σ2 +σw So f we wan o calculae he prce of a European opon wh payoff H T = g S [0,T], suffces o dvde he me nerval [0,T] n n subnervals of lengh Δ, or o consder predefned nsans < 2 < k dependng on he problem and apply: For each smulaon: Smulae W on [0,T] Apply ransformaon above o ge a smulaon of S on [0,T] Calculae he payoff as gs 0,T The opon prce s hen obaned by akng he arhmec average on smulaons of he dscouned payoff 6-6-
Dervave Prcng by Mone Carlo Smulaon whn Black-Scholes model 2/2: Soluon of he Black-Scholes EDS: S = S 0 e r 2 σ2 +σw In pracce, we generally drecly smulae he Brownan moon wh drf appearng n, Z = r 2 σ2 + σw Ths leads e.g. o: Choose Δ = T for some n dependng on he problem n Smulae ε N 0,.. d. =,, n Inalsaon Z 0 = 0 Z Δ = Z Δ + r 2 σ2 Δ + σ Δε S Δ = S 0 e Z Δ 7-7-
Dervave Prcng by Mone Carlo Example: fxed srke lookback opon* Maury: T= 5 years, r = 2%, σ = 20% Payoff: max 0,5Y S K + Prce whn BS model based on a dscresaon scheme wh Δ = /250 and 500000 smulaons leads o a prce close o 0.3490 Cf. Malab code * Remark ha an analycal formula exss n he BS framework 8-8-
Dervave Prcng by Mone Carlo Example: 3.5 Payoff on 000 smulaons 3 2.5 2.5 0.5 0 0 00 200 300 400 500 600 700 800 900 000 9-9-
0 No all models are characerzed by explc soluons of he EDS of he underlyng asses or raes When he EDS canno be solved analycally, we need o use dscrezaon mehods Le us consder a general Io process: The smples mehod s he Euler dscresaon: We subdvde [0,T] no seps of sze Δ = T N. Euler scheme corresponds o: Dervave Prcng by Mone Carlo 0 0 ~, ~, ~ ~ ~ W W dw d d,,
The Euler scheme derves from a smple negraon rule and he defnon of he Io negral One can show ha hs scheme converges n L 2 o he soluon of he EDS, n he followng sense: C > 0 s.. E k k 2 CΔ k {0,,, N } Maruyama, 955 Dervave Prcng by Mone Carlo,, :,,, :,, W dw and d d where dw d
Dervave Prcng by Mone Carlo If we wan o calculae E[g T ], by he law of large numbers mples, f denoe dfferen ndependen occurrences of, =,, N, hen N N = g T provdes an approxmaon of hs expecaon. One can show ha wn Euler scheme, E g T E g T 0 wh a speed of he order of, where n s he dscrezaon sep n In pracce, a reasonable me sep s he monh n he case of a me horzon of he order of 0-20 years, bu depends on he problem In ha case /2 Take care abou he me un of he model parameers! In general, f gven, all parameers correspond o he year as me un e.g. «annual» volaly ec, bu ake care f you esmae hem from hsorcal daa 2
3 Mlsen scheme mproves hs dscrezaon f μ and σ do no depend on me I s based on a Taylor developmen of σx based on Io lemma I consss o he followng approxmaon One can show ha he scheme converges a.s. and n L 2, wh a greaer speed han he Euler scheme ~ ~ 0.5 ~ ~ ~ ~ 2 W dx d W Dervave Prcng by Mone Carlo
Dervave Prcng by Mone Carlo Idea of he dervaon of Mlsen scheme: source: J. Palczewsk, course compuaon n fnance, Un. Leeds: 4
Dervave Prcng by Mone Carlo Idea of he dervaon connued: source: J. Palczewsk, course compuaon n fnance, Un. Leeds: 5
Dervave Prcng by Mone Carlo Idea of he dervaon connued: source: J. Palczewsk, course compuaon n fnance, Un. Leeds: 6
7 One can also accelerae convergence Ex: anhec varaes whn Euler scheme: In pracce, whn a prcng ool: One generaes only ONE se of random numbers ε N0, per smulaon pah BUT cash-flows payoffs are projeced along he TWO ses of smulaon pahs n parallel Consder hen for each couple of smulaed pah wh he + and wh he - bu he same ε he average payoffs The resul s fnally a smple se of smulaed payoffs, from whch we ake he mean,,,, Dervave Prcng by Mone Carlo
Dervave Prcng by Mone Carlo In pracce, opons mgh nvolve also rsk-free neres raes In ha case, we work n a sochasc framework for neres raes, and we wll see ha he general prcng formula becomes: N P E Q payoff exp r s ds where rs denoes he shor rae a me s see laer Mone Carlo prcng becomes hence: P NbSmul NbSmul N payoff scen scen k exp r scen NbSmul NbSmul N scen payoff scen DFso scen 8
Smulaons Bascs abou pseudo-random Numbers Generaon In order o perform he Mone-Carlo smulaon of he processes by dscrezaon Euler or oher, we need o be able o generae pseudorandom numbers Example: f = /2 monh, f projecon horzon N = 20 ans, 240 ndependen generaons by scenaro are requres for 0000 generaed scenaros, hs leads o 2 400 000 random numbers by Brownan moon presen n an ESG we need o have a pseudo-random numbers generaor wh a suffcen cycle Pre-programmed funcon n numercal sofware lke Malab, SAS, R are n general suffcen for opon prcng: rand, random, ranun, I s mporan however o pay aenon o her cycle, dependng on he number of facors I s becomng nsuffcen f abou 0 9 smulaons of random numbers are requred 9
Smulaons Bascs abou pseudo-random Numbers Generaon The frs sep s o consruc pseudo-random numbers followng a unform law on [0,] A well-known mehod consss o use congruenal generaors Smple lnear congruenal generaors: The dea s o choose huge negers a, c, m, and o generae pseudorandom numbers by: ax c mod x u m for a choce of nal seed x. x m 20
Smulaons Bascs abou pseudo-random Numbers Generaon Some condons on he numbers a, c, m guaranee ha he generaor wll generae a complee cycle: Complee cycle means ha for any choce of nal seed, he m- subsequen generaed numbers wll all be dfferen If c 0, suffcen condons are gven by: c and m are relavely prme Any prme number dvdng m also dvdes a a s dvsble by 4 f m also s If now c=0 and f m s prme, a complee cycle can be generaed for any seed x 0 f: a m- s a mulple of m a j- s no a mulple of m for any j =,, m 2 2
Smulaons Bascs abou pseudo-random Numbers Generaon In pracce, a well known congruenal generaor corresponds o: m = 2 3 = 247483647, a = 6807, c=0 Park-Mller generaor Remark: hs choce of m corresponds o he greaes neger ha can be sored n a 32 bs compuer b for he sgn 3 bs for he dgs n a bnary bass, Ths was mporan n he pas when decdng o work wh varables declared n he long neger ype and no wh he double [precson] ype, whch was more effcen n erms of compuaonal speed 22
Smulaons Bascs abou pseudo-random Numbers Generaon Oher possbles are gven by: m a 2 3 6 807 = 2 47 483 647 39 373 742 938 285 950 706 376 226 874 59 2 47 483 399 40 692 2 47 483 563 40 04 23
Smulaons Bascs abou pseudo-random Numbers Generaon In pracce, as he sequence of generaed numbers can be arbrarly close o e m, by mulplyng hese by a durng he generaon, we arrve always o an over-flow f we work wh an neger ype n order o avod overflows, s possble o decompose m no: m=a q + r, where r = m mod a. In ha case, we use he fac ha ax mod m a x mod q x r q and ha he second erm above s always equal o m or 0 ax m As he resul s beween 0 and m-, we are sure ha he las erm s equal o m only f : x a x mod q r 0. q x q m 24
Smulaons Bascs abou pseudo-random Numbers Generaon Hence, hs decomposon of m never leads o an overflow when workng wh a long neger whn a 32 bs envronmen a 6807; m 247483647; q 27773; r 2836; Seed nalsaon For =:M xx seed mod q; k seed-xx/q; x a * xx - r * k; If x < 0 x x + m; seedx End 25
Smulaons Bascs abou pseudo-random Numbers Generaon Oher mehods have been developped and are used ex: mulple congruenal References: Glasserman, P., Mone Carlo Mehods n Fnancal Engneerng, Sprnger-Verlag, New York 2004. L Ecuyer,P. Effcen and porable combned random number generaors, Communcaons of he ACM 3, 742-749, Correspondence 32, 09-024 988. L Ecuyer,P., Good parameers and mplemenaons for combned mulple recursve random number generaors, Operaons Research 47, 59-64 999. Knuh, D.E., The ar of compuer programmng, Volume II: Semnumercal Algorhms, Thrd Edon, Addson Wesley Longman, Readng, Mass 998. Fshman, G.S., Mone Carlo: conceps, algorhms, and applcaons, Sprnger-Verlag, New York 996. 26
Smulaons Generaon of sandard normal numbers /4 We need o generae numbers ε followng sandard normal dsrbuons N0, The frs sep s o generae ndependen realsaons of sandard normal dsrbuons Several mehods can be consdered. One of hese: Polar rejecon mehod. Generae wo numbers followng ndependen unform laws on [-, ]: u, u 2 Calculae w = u ² + u 2 ², and f w<, se: e = -2 lnw/w /2 u e 2 = -2 lnw/w /2 u 2 If w, rejec he couple u, u 2 and generae anoher couple 27
Smulaons Generaon of sandard normal numbers 2/4 Alernave mehod: Box-Muller: R = 2 lnu W = 2πu 2 e = R cosw e 2 = R snw e 2 R /2 e Ths mehod s lnked o he choce of polar coordnaes and o he fac ha f Z=Z,Z 2 ~N0,Id s a bvarae Gaussan vecor, hen: R = Z ² ² + Z 2 ~ Exponenal dsrbuon wh mean 2 Condonally o R, he vecor Z,Z 2 follows a bvarae unform dsrbuon wh ndependen margns on he crcle of radus R cenered a he orgn 28
Smulaons Generaon of sandard normal numbers 3/4 Oher mehod: drec nverson of he cumulave dsrbuon funcon Ф of he sandard normal N0, No analycal expresson of Ф n erms of elemenary funcons exp, log, sn, cos, polynomals,. Approxmaon of he nverse of Ф: u u u 3 8 n0 n0 3 c n a n n0 ln ln u u u 0.5 b n 2n u 0.5 2n n 0 u 0.5 u 0.92 0.92 u 0.5 29
Smulaons Generaon of sandard normal numbers 4/4 where: a a a c c c c c a 2 3 0 2 3 4 0 2.50662823884 8.6500062529 0.337475482272647 0.976690909786 0.6079797498209 0.027643880333863 0.0038405729373609 0 3 8.4735093090 23.08336743743 4.399773534 b2 2.062240826 25.4406049637 b 3.3082909833 b b c c c c 5 6 7 8 0.000395896599 0.00003276788768 0.000000288867364 0.00000039603587 30
Smulaons Dependences beween he dfferen varables Ths becomes mporan n opon prcng for baske opons, or opons dependng on several underlyng varables The dfferen varables are generally dependen A smple possbly s o ncorporae lnear correlaons beween he dfferen Brownan moons of he dfferen processes In pracce: Cholesky decomposon A he level of he pseudo-random numbers generaed followng N0, Correlaon levels need of course o be esmaed, lke any oher parameer Frs sep: Generaon of he ndependen numbers ε, one sequence of numbers by Brownan moon, and nroducon of correlaons beween he dfferen sequences 3
Smulaons Inroducon of correlaons beween Brownan moons /4 Cholesky decomposon: decomposon of he correlaon marx n a produc of an upper and a lower rangular marces As he correlaon marx ρ s symmerc, on can show ha here exss a lower rangular marx L such ha LL T =ρ. We hen use he followng resul: If Z = Z,, Z d s a vecor of ndependen Gaussan varables, f LL T = ρ, hen W = LZ T s a Gaussan vecor wh correlaon marx ρ Thanks o hs resul, suffces o fnd L, and o mulply he Gaussan vecors obaned by usng one of he prevous mehod for generang..d. Gaussan numbers correspondng o he same smulaon nsan by he marx L 32
Smulaons Inroducon of correlaons beween Brownan moons 2/4 In pracce, he frs sep s o fnd he marx L of he Cholesky decomposon The algorhm corresponds smply o wre he equaon LL T =ρ on an elemen by elemen bass: L, j L, n k k L k, L k, j, j and solae n a member of he equaon Lk=,j frs rea he case =j, hen he case >j 33
Smulaons Inroducon of correlaons beween Brownan moons 3/4 Ths leads o he followng algorhm: for =:N for j=:n A,j=0; end end for j=:n for =j:n V=correl,j; for k=:j- V=V-Aj,k*A,k; end A,j=V/sqrVj; end end resula=a; 34
Smulaons Inroducon of correlaons beween Brownan moons 4/4 The correlaons are hen nroduced beween he numbers ε we suppose here ha we have M Brownan moons by a loop:: For j... M : corr, j j k L jk M k where represens a gven nsan n a gven generaed scenaro The ndex s used laer whn he generaon of he process assocaed o one asse or varable by Euler or varan dscresaon scheme, for he ncrease of Brownan moon for he j h process. In pracce: One consders groups of M numbers generaed followng sandard Gaussan varables, and we nroduce correlaons whn each group A a gven nsan n a gven scenaro, he M numbers ε corr,j correspond o realsaons of varables ha are correlaed wh he correlaon marx ρ. 35
Dervave Prcng by Mone Carlo Ineres raes models Vascek and Hull Whe Vascek model - Euler dscresaon: dr ar d dw r r ar where ε are normal varables N0,..d. Now, n he case of Vascek model, some alernave dscrezaon schemes exs, deduced from he explc expresson of he shor rae dr k r d dw r = r 0 exp k + μ exp k + σ exp k u dw u r r exp k exp k 0 exp 2k 2k The same mehodology can be appled for Hull-Whe model from he explc soluon for he shor rae 36
37 Ths can also be appled for he formulaon of Hull-Whe of he form Vascek + deermnsc funcon prevously nroduced: In he case of G2++, he Vascek schemes for x and y lead o he followng dscrezaon: ² ² 2 0, 2 a M e a f dw d ax dx x r 37 y x r, 2 2 exp ' exp 2 2 exp exp ' corr b b b y y a a a x x Dervave Prcng by Mone Carlo Ineres raes models Vascek and Hull Whe
Euler scheme: In heory, he probably o ge negave raes s zero f Φ >0. The probably ha x reaches 0 s generally 0 as well, bu dscresaon errors can mply n pracce ha we reach he orgn and even cross In order o avod such a suaon, one can replace n he square roo he erm x by s posve value, and by forcng negave values of x o 0,.e. usng he followng modfed Euler scheme: An alernave dscresaon scheme s due o Sco cf. references n [Glassermann, pages 20-24]. The mehod s summarzed below. x x k x x x x k x x 0 x hen 0, f x 38 Dervave Prcng by Mone Carlo Ineres raes models Vascek and Hull Whe
Dervave Prcng by Mone Carlo Ineres raes models CIR++ The dsrbuon of r gven rs for s< s known explcly, and appears as a non cenral ch-square dsrbuon. Ths propery s used o smulae he process. The ranson law of he CIR facor x s ndeed gven by: k s k u ² e 2 4ke x ' d k s k 4 ² e 4k where d ² and '2 d wh non cenraly parameer x s, s s a noncenral ch squared dsrbuon 39
Dervave Prcng by Mone Carlo Ineres raes models CIR++ Now, n order o smulae a noncenral ch-square varable wh noncenraly parameer λ and wh an neger ν> degrees of freedom, we frs can decompose hs varable n an ordnary.e. cenered ch-square varable and an ndependen normal. Ths can also be generalsed n he case ν s no an neger Now, f ν>0, by usng he defnon of a ch-square dsrbuon wh a non neger number of degrees of freedom, we can represen any noncenral ch-square varable wh noncenraly parameer λ as an ordnary.e. cenral ch-square varable wh a random degrees of freedom parameer, where hs sochasc parameer follows acually a Posson dsrbuon wh mean λ/2 2 2N The mehod consss hence n hs case o smulae a cenral varable where N s a Posson dsrbuon '2 2 In clear, f ν>, he varable s smulaed as Z ², where Z s a normal dsrbuon, and f ν s smaller or equal o, as where N s a Posson varable wh mean λ/2 40
Dervave Prcng by Mone Carlo Ineres raes models CIR++ Illusraon of boh dscrezaon mehods: 0.055 0.05 Raes comparson RN scenaros, averages Shor rae heor. mean Shor rae 0 Y ZC rae 5 Y ZC rae 0.05 0.045 Raes comparson RN scenaros, averages 0.045 0.04 0.04 0.035 0.035 0.03 0.025 0 50 00 50 200 250 300 350 400 0.03 Shor rae heor. mean Shor rae 0 Y ZC rae 5 Y ZC rae 0.025 0 50 00 50 200 250 300 350 400 450 500 Averages on smulaons of he shor rae, 5 and 0 years zero-coupon raes and heorecal mean dame parameers. Rgh: alernave mehod, lef: sandare Euler scheme. Only 000 smulaons nsuffcen for a good convergence owards he heorecal mean. The man neresng propery of hs smulaon algorhm s ha we avod now negave raes when hey should n heory no appear 4