Skip to content
Prev 9148 / 15274 Next

Option valuation for arbitrary distribution using monte carlo simulation

Joachim,

I'm guessing that you could get
some better speed by doing the
'sample' call all at once, do it
with 'logret' instead of 'ret'
and sum them efficiently.  Something
like:

sampmat <- array(sample(logret,
    size=63 * 1e5, replace=TRUE,
    prob=rnprob), c(63, 1e5))

samplret <- colSums(sampmat)

# then transform to simple returns
# and use 'pmax' instead of 'max'

If the matrix is too large for your
memory, you could do it in a few
blocks.
On 23/12/2011 14:59, Joachim Breit wrote: