Bugs item #2637105, was opened at 2009-02-25 15:16
Message generated for change (Comment added) made by heckl You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=2637105&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Accepted Priority: 5 Private: No Submitted By: Michael Heckl (heckl) Assigned to: Luigi Ballabio (lballabio) Summary: error in method expectation of BlackScholesMerton process Initial Comment: The method "expectation(Time t0, Real x0, Time dt)" does wrong calculations. I tried it for a BlackScholesMerton Process and the result is wrong. After following up the code i found out that the method calculates: return x0 * std::exp(dx); where dx comes from Real EulerDiscretization::drift(const StochasticProcess1D& process, Time t0, Real x0, Time dt) const { return process.drift(t0, x0)*dt; } And the process drift from Real GeneralizedBlackScholesProcess::drift(Time t, Real x) const { Real sigma = diffusion(t,x); // we could be more anticipatory if we know the right dt // for which the drift will be used Time t1 = t + 0.0001; return riskFreeRate_->forwardRate(t,t1,Continuous,NoFrequency,true) - dividendYield_->forwardRate(t,t1,Continuous,NoFrequency,true) - 0.5 * sigma * sigma; } This is simply wrong. What is wrong is that you didnt consider the Jenson inequality. Since exp is a strictly convex function we have: let X_t be the BlackScholes Merton Process and S_t be ln(X_t) the related log-process, then exp{E[S_t]}=exp{E[ln(X_t)]}<E[exp{ln(X_t)}]=E[X_t] But the method expectation calculates the left side which is always to small. You can easily illustrate it if you choose the BlackScholesMerton Process in a way that the drift is 0. Check out the attached code for clarification. Greetings Michael ---------------------------------------------------------------------- >Comment By: Michael Heckl (heckl) Date: 2009-03-02 15:22 Message: No, sorry, regrettably i dont have an easy patch to fix this bug. I was trying a few things but in the end it turned out more difficult to fix this bug then you would expect considering it only takes a little change in the mathematical formula. It is not possible to simply adjust the method: - StochasticProcess1D::expectation(Time t0, Real x0, Time dt) or the method - Real GeneralizedBlackScholesProcess::apply(Real x0, Real dx) those methods do the math. But the problem is that they are both used by the method: - Real ExtendedBlackScholesMertonProcess::evolve which is responsible to do generate the pathes. So a change in one of the upper methods which calculate the expected value immediatly affects the "evolve" method and therefore we get wrong pathes. imho the easiest way would be to make a new method and change the names to make it more intuitional (i.e. make it more obvious what method calculates what values; does the value belong to the process or the log-process; what does the value describe?). The new method could look something like: Real StochasticProcess1D::expectationOfX(Time t0, Real x0, Time dt) const { Real sigma = diffusion(t0,x0); Real mue = drift(t0,x0); Real dx = (mue+0.5*sigma*sigma)*dt; return apply(x0, dx); } ---------------------------------------------------------------------- Comment By: Luigi Ballabio (lballabio) Date: 2009-02-27 12:18 Message: You're right. The problem comes from the process being born as an exp wrapper for the underlying log process. The expectation doesn't work. Do you have a patch that makes it return the correct value? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=2637105&group_id=12740 ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |