13.07.2015 Views

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

BERND PAPE Asset Allocation, Multivariate Position Based Trading ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

ACTA WASAENSIA 91of occurences of p exceeding its associated random number.The execution speed is further improved by generating random variates of agents leavingfrom the same subpopulation within the same matrix. The binomial draws of agentsleaving their strategy in lines 170 to 173 of appendix A1 were therefore originally codedas170 %(1*2) binomial draws of agents leaving their strategy171 npout = sum(repmat([ppm(2) pcf(1,2)],np,1)>rand(np,2));172 nmout = sum(repmat([ppm(1) pcf(2,2)],nm,1)>rand(nm,2));173 nfout = sum(repmat([pcf(1,1) pcf(2,1)],nf,1)>rand(nf,2));which does the same as before on two-columned matrices with the number of rowsgiven by the number of agents in the relevant subpopulation and the columns filledwith the relevant transition probabilities.Generating binomially distributed random variates from summing up Bernoulli randomnumbers is however inefficient in our case of large n and small p due to the many callsof the random number generator. An algorithm for producing binomially distributedrandom variates with only a single call of the uniform random number generator andn*p expected loops is given by the BINV algorithm described in Kachitvichyanukul& Schmeiser (1988) and implemented under the name fastbin in lines 288 to 312 ofappendix A1. The BINV algorithm uses the inversion method for transforming U[0, 1]distributed random variates into a random number with distribution function F .Thatis, defining the generalized inverse of a function F on [0,1], F − ,asF − (u) :=inf{x; F (x) ≥ u},then F − (U) will have the distribution F ,ifU ∼ U[0, 1]. The BINV algorithms exploitsthe recursive formulaf B (k) =f B (k − 1) n − k +1 pk 1 − pfor k =1, 2,...,n (4.57)of the binomial distribution nf B (k) = pk(1 − p) n−k , k =0, 1, 2,...,n (4.58)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!