|
|
|
|
|
by andrewla
5301 days ago
|
|
Okay, someone with some Scala expertise needs to jump in here. The code as written is _clearly_ incorrect. q(n,mu) sums a distribution with mean mu n times. The expected value of this is mu * n. Then we run this 1000 times and average the results. If this is not extremely close to mu*n then I will eat my hat. In R, sum(replicate(1000,sum(rexp(3000,1/50)))) / 1000
returns ~150000 (using sum for clarity instead of mean). Maybe scala is caching the seed or something? I don't know what the "par" function does, but assuming it doesn't do anything crazy, the answer for all three of those expressions should be exactly 150,000, because they just reorder the order of summation. |
|
The poster is a quant working with Scala so I am certain I have just misunderstood something. Nevertheless, my humble bachelor's degree has led me to the same conclusion as you.