Minimize variance "intuitively"

We have an asset management problem. I think (and hope) that it raises interesting enough questions for this forum to consider. We conducted a fairly extensive literature search and found things that discussed this issue, but nothing related to the problem.

Background

We have time series data for assets from which we calculate the correlation matrix. For 5 assets using Mathematica, this might look something like this:

m = Correlation[data]

{{1.0, 0.635562, 0.698852, 0.404792, -0.32746}, {0.635562, 1.0, 0.410075, 0.314375, -0.0636438}, {0.698852, 0.410075, 1.0, 0.374416, -0.260137}, {0.404792, 0.314375, 0.374416, 1.0, 0.293135}, {-0.32746, -0.0636438, -0.260137, 0.293135, 1.0}}

m //TableForm

1.000000, 0.635562, 0.698852, 0.404792, -0.32746

0.635562, 1.000000, 0.410075, 0.314375, -0.0636438

0.698852, 0.410075, 1.000000, 0.374416, -0.260137

0.404792, 0.314375, 0.374416, 1.000000, 0.293135

-0.32746, -0.0636438, -0.260137, 0.293135, 1.000000

Asset management needs to be diversified. If two or more assets in a portfolio correlate too much, it concentrates rather than diversifies risk.

What do we want

, "" , -

Ill , ...

?

:

" " .

, .

, , , , .

, , , , , , . , ( , ):

(* This function computes the distribution of returns, given a \
distribution of price movements.*)

returnDistribution[P_, n_] := Module[ {xv, wv},
  wv = Array[w, n];
  xv = Array[x, n];
  varsInPlane = 
   Append[Delete[xv, n], (r - Total[Delete[wv*xv, n]])/wv[[n]]];
  Integrate[PDF[P, varsInPlane], 
   Map[Function[{#, -Infinity, Infinity}], Delete[xv, n]]
   ]
  ]

dist = MultinormalDistribution[
   ConstantArray[0, 3], {{1, 0.9, 0}, {0.9, 1, 0}, {0, 0, 1}}];
rd = returnDistribution[dist, 3]

(* The problem we want to solve is this *)
wv = Array[w, n];
Maximize[{rd*Log[rd, 2], 
  Total[wv] == 1 && And @@ Thread[wv >= 0]}, wv]

Attilio Meucci " " MatLab, ,

http://www.symmys.com/AttilioMeucci/Research/PublFinance/PublFinance.html

, :

, , , ( ), , . , , . , - , . , .

, , , "95% , 5% - ".

, , . , 2 1 (100%), - 0, :

1, 1, 0

1, 1, 0

0, 0, 1

25% 2 50% .

25%, 25%, 50%

, , 100% , .

, , , 100% - , , , :

50%, 0%, 50%

0%, 50%, 50%

10%, 40%, 50%

... .

, , , , :

25%, 25%, 50%

5 4, 100% , 1, 0%, :

1, 1, 1, 1, 0

1, 1, 1, 1, 0

1, 1, 1, 1, 0

1, 1, 1, 1, 0

0, 0, 0, 0, 1

, , :

12,5%, 12,5%, 12,5%, 12,5%, 50%

, .

(, )

- , , , , :

Mathematica, :

For 3 assets:

m3 = {{1, 1, 0}, {1, 1, 0 }, { 0, 0 , 1}};

Array[x, Length@m3];

Minimize[{p.m3.p, Tr@p == 1 && And @@ Thread[p >= 0]}, p]

{1/2, {x[1] -> 1/4, x[2] -> 1/4, x[3] -> 1/2}}

. :

25%, 25%, 50%

...

5 :

m5 = {{1, 1, 1, 1, 0}, {1 , 1, 1, 1, 0 }, {1 , 1, 1, 1, 0 }, {1 , 1,1, 1, 0 }, { 0, 0 , 0, 0, 1}};

p = Array[x, Length@m5];

Minimize[{p.m5.p, Tr@p == 1 && And @@ Thread[p >= 0]}, p]

{1/2, {x[1] -> 1/16, x[2] -> 1/4, x[3] -> 1/8, x[4] -> 1/16, x[5] ->1/2}}

, :

6.25%, 25%, 12.50%, 6.25%, 50%

, ( ) , - .

- , , . , - .

Mathematica:

m = {{1, 1, 0}, {1, 1, 0}, {0, 0, 1}};

Tr /@ PseudoInverse[m]/Tr[ Tr /@ PseudoInverse[m]]

{1/4, 1/4, 1/2}  

, . . , Mathematica, : "Tr" , "/@" . , , .

:

m = {{1, 1, 1, 0}, {1, 1, 1, 0}, {1, 1, 1, 0}, {0, 0, 0, 1}};

Tr /@ PseudoInverse[m]/Tr[ Tr /@ PseudoInverse[m]]

{1/6, 1/6, 1/6, 1/2}

, , .

, , ( ) , :

m = {{1.0, 0.635562, 0.698852, 0.404792, -0.32746}, {0.635562, 1.0, 0.410075, 0.314375, -0.0636438}, {0.698852, 0.410075, 1.0, 0.374416, -0.260137}, {0.404792, 0.314375, 0.374416, 1.0, 0.293135}, {-0.32746, -0.0636438, -0.260137, 0.293135, 1.0}}

Tr /@ PseudoInverse[m]/Tr[ Tr /@ PseudoInverse[m]]

{0.267806, 0.0898877, 0.22403, -0.0541658, 0.472441}

(-0.0541658) 4- , , .

, MinimizeVarianceIntuitively. , , . - , , .

, , , CAPM ( ) . . , , "", "", . , . , CAPM , , .

,

+3
2

. . .

, , .

cormat = {{1.0, 0.635562, 0.698852, 
0.404792, -0.32746}, {0.635562, 1.0, 0.410075, 
0.314375, -0.0636438}, {0.698852, 0.410075, 1.0, 
0.374416, -0.260137}, {0.404792, 0.314375, 0.374416, 1.0, 
0.293135}, {-0.32746, -0.0636438, -0.260137, 0.293135, 1.0}};

n = Length[cormat];
xvars = Array[x, n];
corrs = Map[Total, cormat];
cortot = Total[Total[cormat]];

unnormalized = 
  xvars /. First[Solve[xvars == cortot/corrs, xvars]]

Out [26] = {4.129760099114916, 4.337254104111004, 4.479986290069387, \ 4.173066277624756, 15.51647047130198}

normalized = unnormalized/Total[unnormalized]

Out [27] = {0.1265379371734397, 0.1328956583819156, 0.1372690447157368, \ 0.1278648603757522, 0.4754324993531559}

, .

. -, . , , , , 1 2, ...

- -

. , . , , . , , "" ( ) ?

- -

, , . , , . , , ? , ( , , ).

, , , ( ), , , -1. , , , , (-0,5,0), -0,5.

, , , . . - , , . ...

. , . , .

Wolfram Research

+2

; . , , () , , : , . :

lambda = .00001;
NMinimize[{p.m5.p - 
   lambda*PDF[DirichletDistribution[Table[2, {5}]], Most[p]], 
  Tr@p == 1 && And @@ Thread[p >= 0]}, p]

1/5. , "2" ( ). .

lambda = .0001;
NMinimize[{p.m.p - 
   lambda*PDF[DirichletDistribution[Table[2, {5}]], Most[p]], 
  Tr@p == 1 && And @@ Thread[p >= 0]}, p]

-

+2

Source: https://habr.com/ru/post/1788517/


All Articles