Exercise Sheet 8 - Solutions Alessandro Gnoatto June 16, 015 1 Exercise 1 Let X t = x + µ t + σ W t denote a scaled Brownian motion with constant diffusion coefficient σ and constant drift µ. 1. Prove that Y t = e Xt where Y (t = Y (0 + t 0 dy with Y (0 = ex and dy t = (µ + 1 σ Y t dt + σy t dw t. We shall assume that the SDE for dy has a unique 1 solution in [0, t]. Since the solution to the SDE for dy is unique, we will prove the claim by obtaining d(e Xt and verifying that it is the same SDE as dy. Let us then start with dx t. By definition of Ito processes, dx t = µdt + σdw t and therefore, using Ito s lemma to obtain df(x t with f(z = e z. We have f (z = f (z = e z and d(e Xt =e Xt dx t + 1 σ e Xt dt d(e Xt =(µ + σ ext dt + σe Xt dw t. Note that f(x 0 = e X0 = e x = Y (0. Hence f(x t = e Xt and Y t are both solutions to the same SDE, i.e., Y t = e Xt. Another way is to take d(log Y t and show that its solution equals X t. We have g(y = log y, g (y = 1 y, and g (y = 1 y. Thus, hence also i.e. d(log Y t =(µ + σ Y t dt Y t Y t Y =µdt + σdw t, log Y t = log Y (0 + t σ dt + σ Y t Y t dw t t 0 µds + t log Y t = x + µt + σw t = X t. 0 σdw s 1 For more details about the necessary conditions for uniqueness of SDE, see Section 3, Chapter 5 of the lecture notes Lawrence Evans, An Introduction to Stochastic Differential Equations, ver 1., UC Berkeley. 1
. An example Java program of the solution can be found in 4 package de. math. lmu. exercise08 ; import java. text. DecimalFormat ; import net. finmath. montecarlo. BrownianMotion ; 6 import net. finmath. montecarlo. RandomVariable ; import net. finmath. stochastic. RandomVariableInterface ; 8 import net. finmath. time. TimeDiscretization ; 10 public class LogNormalTest { 1 s t a t i c f i n a l DecimalFormat formattersci6 = new DecimalFormat (" 0.000000 E00 ; -0.000000 E00 "; 14 public s t a t i c void main ( String [] args { int seed = 134; 16 int numberofpaths = 1000; //double dt = 0.01; 18 double sigma = 0.1; double mu = 0.1; 0 double initialvalueybar = Math. exp (1.0 ; double initialvaluex = 1.0; //define time grid 4 int numberoftimes = 00; double t0 =0.0; 6 double T =.0; double[] times = new double [00]; 8 for ( int countertime =0; countertime < numberoftimes ; countertime ++ { times [ countertime ] = t0 + countertime *( T- t0/(( double numberoftimes ; 30 3 //brownian motion TimeDiscretization mytimes = new TimeDiscretization ( times ; 34 36 BrownianMotion W = new BrownianMotion ( mytimes,1, numberofpaths, seed ; RandomVariableInterface previousvalueybar = new RandomVariable ( t0, initialvalueybar ; 38 RandomVariableInterface initialx = new RandomVariable ( t0, initialvaluex ; System. out. println (" time "+ " "+" mean value Y"+ " "+ " mean value Ybar " +" "+ " theor. mean "+ " "+ " error Y"+ " "+" error Ybar " + " "+ " Y - Ybar " ; 40 for ( int countertime =0; countertime < numberoftimes -1; countertime ++ { 4 double dt = times [ countertime +1] - times [ countertime ]; RandomVariableInterface dw = W. getbrownianincrement ( countertime, 0;//.getIncrementAtIndex( countertime; 44 RandomVariableInterface nextvalueybar = previousvalueybar. mult (1+( mu +0.5* sigma * sigma *dt. add (dw. mult ( previousvalueybar. mult ( sigma ; double empiricalmeanybar = nextvalueybar. getaverage
46 (; RandomVariableInterface nextvaluex = initialx. add (( mu* times [ countertime ]. add (W. getbrownianincrement ( countertime, 0. mult ( sigma ; 48 RandomVariableInterface nextvaluey = nextvaluex. exp (; double empiricalmeany = nextvaluey. getaverage (; 50 double theoreticalmean = initialvalueybar * Math. exp (( mu +0.5* sigma * sigma * times [ countertime ]; //continuous model 5 double absdifference = Math. abs ( empiricalmeanybar - empiricalmeany ; 54 double errory = Math. abs ( empiricalmeanybar - theoreticalmean ; double errorybar = Math. abs ( empiricalmeany - theoreticalmean ; 56 System. out. println ( formattersci6. format ( times [ countertime ] + " " + formattersci6. format ( empiricalmeany + " " + formattersci6. format ( empiricalmeanybar 58 + " " + formattersci6. format ( theoreticalmean + " "+ formattersci6. format ( errory + " "+ formattersci6. format ( errorybar +" " + formattersci6. format ( absdifference ; previousvalueybar = new RandomVariable ( nextvalueybar ; 60 6 64 3. Partial solution: We can express the approximations Ȳ in the following Euler-Maruyama recursion Ȳ n = t Ȳ +σȳ W for n =, 3,... with Ȳ0 = e x. From the solution to the previous exercise sheet we have that ( V ar[ȳn] = e x ( t l + σ t l 3 t l
and if we take t l, l, ( V ar[ȳn] =e x ( + σ ( ( n =e x + σ ( ( n n =e x (1 + (µ + σ σ + (µ + + σ ( ( n n =e x 1 + µ + σ + (µ + σ + σ ( ( n n =e x 1 + (µ + σ + (µ + σ n In order to compute V ar[y n ] = V ar[e Xn ], with X n = X + µ t + σ W we need to know the first and second moments of e Xn. Note that X n = x + µt n + σ W l therefore E [ e Xn] = e x+µtn E [e σ ] W l = e x+µtn E [ e Z] where Z := σ W l is just an N (0, σ n = N (0, σ t n distributed r.v. hence E [ e Z] = e σ tn and E [ e Xn] σ x+(µ+ = e tn. Now, computing E[(e Xn ] = E[e Xn ], we have Note that hence and finally E [ e Xn] = e x+µtn E [e σ ] W l = e x+µtn E [ e Z]. V ar[y n ] =V ar[e Xn ] E [ e Z] = e σ t n, E [ e Xn] = e x+(µ+σ t n =E[e Xn ] (E[e Xn ] =e x+(µ+σ σ t n x+(µ+ (e tn =e x+(µ+σ σ t n x+(µ+ e tn σ x+(µ+ =e tn (e σ t n 1 4
Now, we can compare V ar[ȳn] and V ar[y n ]. We note that, since e x is a common factor of both, it is enough to compare V ar[yn] e V ar[ȳn] x e with 0. We have that x n e (µ+σ t n (1 + (µ + σ + (µ + σ > e (µ+σ t n ( 1 + (µ + σ + (µ + σ n = e (µ+σ t n (1 + (µ + σ n n n ( = e (µ+σ t n 1 + (µ + σ t n n n > 0. Note that the right hand term is a lower bound for the left hand term (and its limit as n is the left hand term. Similarly n σ (µ+ e tn < 0. It remains to show whether n t n (1 + (µ + σ + (µ + σ n e(µ+σ < σ (µ+ e tn or not. If it is true, we conclude that V ar[y n ] e x V ar[ȳn] e x < 0, i.e. V ar[y n ] < V ar[ȳn], otherwise V ar[y n ] > V ar[ȳn]. Exercise The example Java program containing the solution is in provided in the following files package de. math. lmu. exercise08 ; 4 import java. text. DecimalFormat ; import net. finmath. montecarlo. BrownianMotion ; 6 import net. finmath. montecarlo. RandomVariable ; import net. finmath. stochastic. RandomVariableInterface ; 8 import net. finmath. time. TimeDiscretization ; 10 public class OptionsTest { 1 14 s t a t i c f i n a l DecimalFormat formattersci6 = new DecimalFormat (" 0.000000 E00 ; -0.000000 E00 "; public s t a t i c void main ( String [] args { 16 int numberoftimes = 800; 5
double t0 =0.0; 18 double T = 1.0; double initialvalue = 1.0; 0 double mu = 0.1; double r = 0.0; double sigma = 1.0; double strikes [] = {0.8,0.9,1.0,1.1,1.; 4 double price [] = new double[ strikes. length ]; double riskyvalue [] = new double[ strikes. length ]; 6 double pricebs [] = new double[ strikes. length ]; 8 double[] times = new double[ numberoftimes ]; for ( int countertime =0; countertime < numberoftimes ; countertime ++ { 30 times [ countertime ] = t0 + countertime *( T- t0/(( double numberoftimes ; 3 int seed = 34; 34 int numberofpaths = 10000; 36 TimeDiscretization mytimes = new TimeDiscretization ( times ; 38 BrownianMotion brownianw = new BrownianMotion ( mytimes,1, numberofpaths, seed ; //RandomVariableInterface initialxbar = new RandomVariable (t0,0.0; 40 RandomVariableInterface previousvaluep = new RandomVariable ( t0, initialvalue ; 4 RandomVariableInterface previousvalueq = new RandomVariable ( t0, initialvalue ; 44 46 System. out. println (" strike "+ " "+" risky value "+ " "+"MC price " + " "+ "BS price "; for ( int countertime =0; countertime < numberoftimes -1; countertime ++ { 48 double dt = times [ countertime +1] - times [ countertime ]; RandomVariableInterface dw = brownianw. getbrownianincrement ( countertime, 0; 50 RandomVariableInterface nextvaluep = previousvaluep. mult (1+ mu*dt. add (dw. mult ( previousvaluep. mult ( sigma ; 5 RandomVariableInterface nextvalueq = previousvalueq. mult (1+ r*dt. add (dw. mult ( previousvalueq. mult ( sigma ; 54 56 //continuous model // double MCerror = Math.abs(empiricalMean theoreticalmean; 58 previousvaluep = new RandomVariable ( nextvaluep ; previousvalueq = new RandomVariable ( nextvalueq ; 60 //System.out.println(formatterSci6.format(times[ countertime]+ " "+formattersci6.format( empiricalmean+ " "+formattersci6.format( 6
6 theoreticalmean+ " ; "+formattersci6.format(mcerror 64 66 68 for ( int counterstrike = 0; counterstrike < strikes. length ; counterstrike ++ { 70 price [ counterstrike ] = Math. exp (-r*(t-t0* previousvalueq. sub ( strikes [ counterstrike ]. floor (0. getaverage (; riskyvalue [ counterstrike ] = Math. exp (-r*(t-t0* previousvaluep. sub ( strikes [ counterstrike ]. floor (0. getaverage (; 7 74 pricebs [ counterstrike ] = net. finmath. functions. AnalyticFormulas. blackscholesoptionvalue ( initialvalue, 76 r, sigma, 78 T, strikes [ counterstrike ]; 80 8 84 System. out. println ( formattersci6. format ( strikes [ counterstrike ] +" " + formattersci6. format ( riskyvalue [ counterstrike ] + " " + formattersci6. format ( price [ counterstrike ] + " " + formattersci6. format ( pricebs [ counterstrike ]; 86 package de. math. lmu. exercise08 ; 4 import java. text. DecimalFormat ; import net. finmath. montecarlo. BrownianMotion ; 6 import net. finmath. montecarlo. RandomVariable ; import net. finmath. stochastic. RandomVariableInterface ; 8 import net. finmath. time. TimeDiscretization ; 10 public class OptionsTest { 1 14 s t a t i c f i n a l DecimalFormat formattersci6 = new DecimalFormat (" 0.000000 E00 ; -0.000000 E00 "; public s t a t i c void main ( String [] args { 16 int numberoftimes = 800; 18 double t0 =0.0; double T = 1.0; 0 double initialvalue = 1.0; double mu = 0.1; double r = 0.01; double sigma = 1.0; 7
4 double strikes [] = {0.8,0.9,1.0,1.1,1.; double price [] = new double[ strikes. length ]; 6 double riskyvalue [] = new double[ strikes. length ]; double pricebs [] = new double[ strikes. length ]; 8 double[] times = new double[ numberoftimes ]; for ( int countertime = 0; countertime < numberoftimes ; countertime ++ { 30 times [ countertime ] = t0 + countertime *( T- t0/(( double numberoftimes ; 3 int seed = 34; 34 int numberofpaths = 10000; 36 TimeDiscretization mytimes = new TimeDiscretization ( times ; 38 System. out. println ( mytimes. getnumberoftimes (; 40 BrownianMotion brownianw = new BrownianMotion ( mytimes,1, numberofpaths, seed ; RandomVariableInterface initialxbar = new RandomVariable ( t0,0.0 ; 4 44 RandomVariableInterface myw = new RandomVariable (0.0 ; for ( int i = 0; i < mytimes. getnumberoftimesteps (; i ++ { 46 myw = myw. add ( brownianw. getbrownianincrement (i, 0; 48 50 System. out. println (" strike "+ " "+" risky value "+ " "+"MC price " + " "+ "BS price "; 5 RandomVariableInterface valuelogxbarp = initialxbar. add ((( mu -0.5* sigma * sigma * times [ numberoftimes -1]. add ( myw. mult ( sigma ; 54 RandomVariableInterface valuexbarp = valuelogxbarp. exp (; 56 RandomVariableInterface valuelogxbarq = initialxbar. add ((( r -0.5* sigma * sigma * times [ numberoftimes -1]. add ( myw. mult ( sigma ; RandomVariableInterface valuexbarq = valuelogxbarq. exp (; 58 60 for ( int counterstrike = 0; counterstrike < strikes. length ; counterstrike ++ { 6 price [ counterstrike ] = Math. exp (-r*(t-t0* valuexbarq. sub ( strikes [ counterstrike ]. floor (0. getaverage (; riskyvalue [ counterstrike ] = Math. exp (-r*(t-t0* valuexbarp. sub ( strikes [ counterstrike ]. floor (0. getaverage (; 64 pricebs [ counterstrike ] = net. finmath. functions. AnalyticFormulas. blackscholesoptionvalue ( 66 initialvalue, r, 68 sigma, T, 70 strikes [ counterstrike ]; 8
7 System. out. println ( formattersci6. format ( strikes [ counterstrike ] +" " + formattersci6. format ( riskyvalue [ counterstrike ] + " " + formattersci6. format ( price [ counterstrike ] + " " + formattersci6. format ( pricebs [ counterstrike ]; 74 76 78 Each uses a different approach to approximate S, the first uses the Euler- Maruyama scheme on ds and the second computes the exact value of S using the Euler-Maruyama scheme on logs. (The second approach is faster. The correct measure to compute is the pricing measure Q. In order to implement this measure by Monte-Carlo, the empirical mean must be computed on the MC paths simulated under the Q-model. The Q-model for S is ds t = r t S t dt + σs t dw Q t and since r t 0, we have the following Q-model for S ds t = σs t dw Q t. 9