Re: Using a Correlation Matrix to reduce risk
- To: mathgroup at smc.vnet.net
- Subject: [mg114397] Re: Using a Correlation Matrix to reduce risk
- From: Ray Koopman <koopman at sfu.ca>
- Date: Fri, 3 Dec 2010 05:20:30 -0500 (EST)
- References: <id7t4n$l8c$1@smc.vnet.net>
On Dec 2, 2:41 am, Garapata <warsaw95... at mypacks.net> wrote: > I have a problem for school and hoped someone could assist me. > > I have price data on 5 stocks and calculate a correlation matrix: > > cMatrix = Correlation[data] > > {{1.,0.635562,0.698852,0.404792,-0.32746}, > {0.635562,1.,0.410075,0.314375,-0.0636438}, > {0.698852,0.410075,1.,0.374416,-0.260137}, > {0.404792,0.314375,0.374416,1.,0.293135}, > {-0.32746,-0.0636438,-0.260137,0.293135,1.}} > > cMatrix //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 > > Now I want to construct a portfolio of the 5 stocks > that minimizes its correlation or concentration risk. > > It's easy to understand this if for instance I had just 3 stocks, > with 2 of them having correlations of 1 (100%) and the third at 0, > I think it's matrix would look like this: > > {{1,1,0},{1,1,0},{0,0,1}} > > Than it would make sense to put 25% in each of the 2 correlated stocks > and 50% in the uncorrelated one. This offsets the risk of > concentrating in correlated instruments. > > But I can not think of how to use the correlation matrix to do this > (especially for the 5 instruments). I keep searching for a solution > on the internet and at the library but can not find a specific > discussion on this. > > I hope someone can help or point me in the right direction. > > Thank you. > G You want to minimize the variance: Clear[x]; p = Array[x, Length@cMatrix]; Minimize[{p.cMatrix.p, Tr@p == 1 && And@@Thread[p >= 0]}, p] {0.306671, {x[1] -> 0.246238, x[2] -> 0.0909659, x[3] -> 0.214026, x[4] -> 0., x[5] -> 0.44877}}