–––––––––––––––
size 10000.000 10000.000
min 0.004 0.005
max 0.049 0.050
mean 0.020 0.020
std 0.006 0.006
skew 0.529 0.572
kurtosis 0.418 0.503
However, a major difference can be observed in terms of execution speed, since sampling
from the noncentral chi-square distribution is more computationally demanding than from
the standard normal distribution. To illustrate this point, consider a larger number of paths
to be simulated:
In [ 29 ]: I = 250000
%time x1 = srd_euler()
Out[29]: CPU times: user 1.02 s, sys: 84 ms, total: 1.11 s
Wall time: 1.11 s
In [ 30 ]: %time x2 = srd_exact()
Out[30]: CPU times: user 2.26 s, sys: 32 ms, total: 2.3 s
Wall time: 2.3 s
The exact scheme takes roughly twice as much time for virtually the same results as with
the Euler scheme:
In [ 31 ]: print_statistics(x1[- 1 ], x2[- 1 ])
x1 = 0.0; x2 = 0.0
Out[31]: statistic data set 1 data set 2
–––––––––––––––
size 250000.000 250000.000
min 0.003 0.004
max 0.069 0.060
mean 0.020 0.020
std 0.006 0.006
skew 0.554 0.578
kurtosis 0.488 0.502