Posted by
Vivian Wu on
Oct 29, 2014; 5:47am
URL: http://quantlib.414.s1.nabble.com/Questions-about-GeometricBrownianMotionProcess-PathGenerator-tp16004.html
test.cpptest_path_outstream.csvtest_path_outstream.xlsxHi,you all,
I'm confused when I tried to test path generator by using pathgenerator.cpp in QuantLib testsuit.
Attached please find my testing codes and results related.
As you can see in test.cpp, function GeometricBrownianMotionProcess(initialValue, mue, sigma) is used to model the process of path generator.
According to following stochastic differential equation,
dS = mue*S*dt + sigma*S*dW
and E(S)=initialValue*exp(mue*t), we got E(S)=initialValue if mue=0, and dS should be both positive and negative values follow N(0, sigma*S*sqrt(t)).
In order to build a path that contains positive numbers with expected value 100(the initialValue), I picked mue=0.
But it didn't work as I expected. Please refer to test_path_outstream.csv and test_path_outstream.xlsx.
The number became larger and larger(from 100 to 141.132) when variable t goes bigger(from 0 to 10, and dt=0.00033333). It turns out the expected value seems like 120 but not 100.
Here my questions are:
1. Why the random numbers generated by PathGenerator(using GeometricBrownianMotionProcess) became larger when mue=0?
2. Is there a way that meets my requirement, which is generating numbers both bigger and smaller than 100 and the expected value is 100, by setting resonable parameters(eg. initialValue, mue, and sigma) of GeometricBrownianMotionProcess?
Are there any comments or ideas? Really appreciate it.