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.

190 ACTA WASAENSIA9192 for t = 1:T %Start outer loop over integer time steps9394 for st = 1:steps %start inner loop over micro time steps9596 % Calculate traders utilities9798 c(1) = (nc(1)+nf(1)-nc(2)-nf(2))/N;99 c(2) = -c(1); %(1*2) chartist utilities100 f = s*abs(pf-p); %(1*2) fundamentalist utilities101102103 % Fill probability matrix for transitions within stocks104105 pmat(1,1) = c(2) - c(1); % c1 -> c2106 pmat(2,1) = f(2) - f(1); % f1 -> f2107 pmat(3,1) = f(1) - c(1); % c1 -> f1108 pmat(4,1) = f(2) - c(2); % c2 -> f2109 pmat(5,1) = f(2) - c(1); % c1 -> f2110 pmat(6,1) = f(1) - c(2); % c2 -> f1111 pmat(:,2) = -pmat(:,1); % reverse direction of col. 1112113 pmat = (v/steps)*exp(a*pmat); %(6*2) transition prob’s114115116 % Fill prob-matrix for transitions between stocks / bonds117118 ne = N - nb; %# equity investors119 pbe = exp(ab*(ne-nb)/N); %p_BE: from bond to equity120 pbmat(1:2,1) = nc’*(pbe/ne); % b -> c1; b -> c2121 pbmat(3:4,1) = nf’*(pbe/ne); % b -> f1; b -> f2122 pbmat(:,2) = repmat(1/pbe,4,1); % c1, c2, f1, f2 -> b123124 pbmat = (vb/steps)*pbmat; %(4*2) transition prob’s125126127 % (6*2) draws of traders leaving their strategy w’in stocks128129 dnmat(1,1) = fastbin(nc(1), pmat(1,1)); % c1 -> c2130 dnmat(1,2) = fastbin(nc(2), pmat(1,2)); % c2 -> c1131 dnmat(2,1) = fastbin(nf(1), pmat(2,1)); % f1 -> f2132 dnmat(2,2) = fastbin(nf(2), pmat(2,2)); % f2 -> f1133 dnmat(3,1) = fastbin(nc(1), pmat(3,1)); % c1 -> f1134 dnmat(3,2) = fastbin(nf(1), pmat(3,2)); % f1 -> c1135 dnmat(4,1) = fastbin(nc(2), pmat(4,1)); % c2 -> f2136 dnmat(4,2) = fastbin(nf(2), pmat(4,2)); % f2 -> c2137 dnmat(5,1) = fastbin(nc(1), pmat(5,1)); % c1 -> f2

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

Saved successfully!

Ooh no, something went wrong!