0
$\begingroup$

My code:

Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"] 
   ["http://i.stack.imgur.com/ytfey.png"]

Remove["Global`*"]

k = 
  RandomFunction[
    GeometricBrownianMotionProcess[-0.00096, 0.239317, 3061. 44], 
    {0, 5, 1}];
s = k["Values"]; 
s[[5]]

Remove["Global`*"]

s[0] = 3061.44;
r = -0.000960;
σ = 0.239317;
Δt = 1;
s[u_] := s[u - 1]*Exp[(r - 0.5*σ^2)*Δt + Sqrt[Δt]*σ*z[[u + 1]]];
w = RandomFunction[WienerProcess[r, σ], {0, 5, 1}];
z = w["Values"];
s[5]

Remove["Global`*"]

s[0] = 3061.44;
r= -0.00096;
σ = 0.239317;
Δt = 1;
s[x_] := 
  s[x - 1] * 
    Exp[(r - 0.5*σ^2)*Δt + 
           Sqrt[Δt]*σ*InverseCDF[NormalDistribution[0, 1], RandomReal[]]];
s[5]

Why is there a difference between these three methods? I know that each specific number has to be different, because each formula uses a determinisitc and a stochastic part, which makes it impossible to get the exact same number with all the methods. What I've noticed is, that the stochastic part of each of those methods behaves differently, so much so, that when used in a monte carlo context, all three formulae lead to remarkably distinct results (deviations between 1 and 10). These are the values for the different variables:

Mathematica graphics

First comes the GeometricBrownianMotionProcess formula:

Mathematica graphics

Then there's the same formula with the WienerProcess:

Mathematica graphics

And then there's the formula usually found in books:

Mathematica graphics

In the end, all three of those functions should return geometric brownian results, no? Yet, this somehow isn't the case. I need to generate 5 different stock prices s[1] up to s[5], and, once I apply these formulae in a Monte Carlo Simulation, all three lead to distinct results, even after a million simulations. What are the differences? Am I using correct parameters for each process?

Edit: Here is the Mathematica notebook with all the necessary code (copy everything below (including Import) into an open notebook and press enter):

Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"]["http://i.stack.imgur.com/ytfey.png"]

$\endgroup$
  • 4
    $\begingroup$ Please post code as text, rather than as images, so people can copy / paste it and run it. $\endgroup$ – MarcoB Apr 26 '18 at 22:49
  • $\begingroup$ I'm voting to close this question as off-topic because the OP's code has been given in images making it too difficult for those who might otherwise help to work with the code. $\endgroup$ – m_goldberg Apr 26 '18 at 23:36
  • $\begingroup$ I added the Mathematica code just now... $\endgroup$ – Lumberjack88 Apr 27 '18 at 0:05
  • $\begingroup$ I still can't see the code... $\endgroup$ – anderstood Apr 27 '18 at 0:15
  • $\begingroup$ Copy and paste this into an open notebook and press enter: Import["halirutan.github.io/Mathematica-SE-Tools/… $\endgroup$ – Lumberjack88 Apr 27 '18 at 0:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.