(Resending b/c it seems postings with attachments (zip) get silently discarded)
The bugfixed version (v1.1) can be found here:
https://www.elitetrader.com/et/threads/simulating-stock-prices-using-gbm.375533/page-4#post-5861666
History:
2023-09-09-Sa: v1.1 Fixed a bug in accessing the generated path data: now
skipping 0th element and still taking timeSteps elements
Expected for 1SD:
timeSteps HitRate
1 68.27% cf. [3]
2 76.27% cf. [4]
3 79.29%
4 80.79%
5 81.66%
10 83.33%
100 84.77%
1000 84.92%
Results of QuantLib testing:
timeSteps HitRate
1 68.46%
2 75.59%
3 78.42%
4 79.93%
5 80.94%
10 82.85%
100 84.33%
1000 85.55%
These new test results, after fixing the test program in v1.1, show that
QuantLib's GBM using the BoxMullerGaussianRng<MersenneTwisterUniformRng> is OK.
It seems that Ito's lemma does not get used, b/c otherwise the result would
differ much.
U.Mutlu wrote in other thread on 09/10/23 02:39:
> Finally found the bug:
>
> The loop below must be so:
> for (size_t j = 1; j <= timeSteps; ++j)
>
> This of course invalidates the old test results
> Will see how good the results are now, but it looks much better now.
|