Correlation shows up as soon as you look at more than one stock, and it’s at the heart of
portfolio construction. The
last post measured the risk of one fund.
This one answers the question every portfolio manager asks next: what happens to risk when you
hold two things together?
Covariance: do two things move together?
Plain meaning: on days when A is above its average, is B also above its average (positive),
below it (negative), or neither (around zero)?
how two things move together: ρ and cov risk: σ, s and the covariance matrix Σ
cov ( A , B ) = 1 n − 1 ∑ t = 1 n ( a t − a ˉ ) ( b t − b ˉ ) \key{\text{cov}}(A, B) = \frac{1}{n-1} \sum_{t=1}^{n} (a_t - \bar{a})(b_t - \bar{b}) cov ( A , B ) = n − 1 1 t = 1 ∑ n ( a t − a ˉ ) ( b t − b ˉ )
Look at the product ( a t − a ˉ ) ( b t − b ˉ ) (a_t - \bar{a})(b_t - \bar{b}) ( a t − a ˉ ) ( b t − b ˉ ) . If both are above average, or both
below, the product is positive. If one is up while the other is down, it’s negative. Averaging
the products tells you which happens more. (It’s the same n − 1 n - 1 n − 1 as in the sample standard
deviation. In fact, the covariance of a thing with itself is its variance.)
Probability books write the same idea for random variables. Bishop and Bishop’s Deep Learning:
Foundations and Concepts (equation 2.48 is the vector version) gives, for two quantities x x x
and y y y :
cov [ x , y ] = E [ x y ] − E [ x ] E [ y ] \key{\text{cov}}[x, y] = E[xy] - E[x]\,E[y] cov [ x , y ] = E [ x y ] − E [ x ] E [ y ]
“the average of the product, minus the product of the averages”. The sum above is how you
estimate it from data.
Worked example: SPY and gold
The first five trading days of 2019, SPY (the S&P 500 fund) and GLD (gold), daily returns in
percent rounded to one decimal, the same data as the last post :
Day SPY a a a GLD b b b a − a ˉ a - \bar{a} a − a ˉ b − b ˉ b - \bar{b} b − b ˉ product 1 −2.4 0.9 −3.02 0.76 −2.30 2 3.3 −0.8 2.68 −0.94 −2.52 3 0.8 0.3 0.18 0.16 0.03 4 0.9 −0.3 0.28 −0.44 −0.12 5 0.5 0.6 −0.12 0.46 −0.06 Average / sum a ˉ = 0.62 \bar{a} = 0.62 a ˉ = 0.62 b ˉ = 0.14 \bar{b} = 0.14 b ˉ = 0.14 −4.96
cov ( A , B ) = − 4.96 5 − 1 = − 1.24 \key{\text{cov}}(A, B) = \frac{-4.96}{5 - 1} = -1.24 cov ( A , B ) = 5 − 1 − 4.96 = − 1.24
Negative: that week, when stocks had a good day, gold tended to have a bad one, and the other
way round. (Gold is where money runs when stocks fall; the first days of 2019 were nervous.)
But what does −1.24 mean? Is that a lot? Covariance is hard to read, because its size depends
on the units. Returns in percent give a number 10,000 times bigger than returns as decimals.
That’s why we usually use correlation.
Correlation: covariance on a fixed scale
Divide the covariance by both standard deviations:
ρ A , B = cov ( A , B ) s A s B \key{\rho_{A,B}} = \frac{\key{\text{cov}}(A, B)}{\risk{s_A} \, \risk{s_B}} ρ A , B = s A s B cov ( A , B )
The result, ρ \key{\rho} ρ (“rho”), always lies between −1 and +1:
ρ \key{\rho} ρ Meaning +1 they move perfectly together 0 no straight-line link −1 they move perfectly opposite
For that week, s A = 2.027 \risk{s_A} = 2.027 s A = 2.027 and s B = 0.688 \risk{s_B} = 0.688 s B = 0.688 :
ρ = − 1.24 2.027 × 0.688 = − 0.89 \key{\rho} = \frac{-1.24}{2.027 \times 0.688} = -0.89 ρ = 2.027 × 0.688 − 1.24 = − 0.89
Almost perfectly opposite, in that one week. Five days is far too few to trust; over the whole
five years the SPY–GLD correlation is only 0.11 \key{0.11} 0.11 , and it moves around. Here is the full
matrix for 2019 to 2023, each daily return against each other:
Item SPY AAPL JPM XOM GLD SPY 1.00 0.80 0.73 0.55 0.11 AAPL 0.80 1.00 0.45 0.32 0.09 JPM 0.73 0.45 1.00 0.59 −0.05 XOM 0.55 0.32 0.59 1.00 0.06 GLD 0.11 0.09 −0.05 0.06 1.00
The stocks move together (0.3 to 0.8, with SPY highest because it contains the others). Gold
moves on its own (near 0 with everything). That is the reason gold is in so many portfolios. Not its return, but what it does in the next
formula.
Two warnings:
Correlation only sees straight-line links. Two things can be strongly related in a curved
way and still show a correlation near 0.
Correlation is not causation. Two series can move together because a third thing drives
both.
Portfolio variance: where correlation pays
Put a share w 1 w_1 w 1 of your money in asset 1 and w 2 = 1 − w 1 w_2 = 1 - w_1 w 2 = 1 − w 1 in asset 2. The portfolio’s
variance is (Romero and Balch, What Hedge Funds Really Do , chapter 10):
σ p 2 = w 1 2 σ 1 2 + w 2 2 σ 2 2 + 2 w 1 w 2 ρ σ 1 σ 2 \risk{\sigma_p^2} = w_1^2 \risk{\sigma_1^2} + w_2^2 \risk{\sigma_2^2} + 2\, w_1 w_2\, \key{\rho}\, \risk{\sigma_1} \risk{\sigma_2} σ p 2 = w 1 2 σ 1 2 + w 2 2 σ 2 2 + 2 w 1 w 2 ρ σ 1 σ 2
Symbol Meaning w 1 , w 2 w_1, w_2 w 1 , w 2 the share of money in each asset (they add to 1) σ 1 , σ 2 \risk{\sigma_1}, \risk{\sigma_2} σ 1 , σ 2 each asset’s standard deviation ρ \key{\rho} ρ the correlation between them σ p \risk{\sigma_p} σ p the portfolio’s standard deviation
The first two terms are each asset’s own risk, scaled by how much you hold. The third term is
where correlation acts . With ρ \key{\rho} ρ below 1, part of the two risks cancels out. With ρ \key{\rho} ρ
negative, the third term is negative and cancels even more.
Worked example: 60% SPY, 40% gold
From the five years of data: SPY’s yearly standard deviation is 21.0%, GLD’s 14.9%, and their
correlation 0.11. Held 60/40:
σ p 2 = 0.6 2 × 0.210 2 + 0.4 2 × 0.149 2 + 2 × 0.6 × 0.4 × 0.11 × 0.210 × 0.149 \begin{aligned}
\risk{\sigma_p^2} &= 0.6^2 \times 0.210^2 \\
&\quad + 0.4^2 \times 0.149^2 \\
&\quad + 2 \times 0.6 \times 0.4 \times 0.11 \times 0.210 \times 0.149
\end{aligned} σ p 2 = 0. 6 2 × 0.21 0 2 + 0. 4 2 × 0.14 9 2 + 2 × 0.6 × 0.4 × 0.11 × 0.210 × 0.149
σ p 2 = 0.015876 + 0.003552 + 0.001652 = 0.021080 \begin{aligned}
\risk{\sigma_p^2} &= 0.015876 + 0.003552 + 0.001652 \\
&= 0.021080
\end{aligned} σ p 2 = 0.015876 + 0.003552 + 0.001652 = 0.021080
σ p = 0.021080 = 14.52 % \begin{aligned}
\risk{\sigma_p} &= \sqrt{0.021080} \\[10pt]
&= 14.52\%
\end{aligned} σ p = 0.021080 = 14.52%
If you just averaged the two risks (0.6 × 21.0 % + 0.4 × 14.9 % 0.6 \times 21.0\% + 0.4 \times 14.9\% 0.6 × 21.0% + 0.4 × 14.9% ), you’d get 18.6 % \risk{18.6\%} 18.6% .
The formula says 14.5 % \risk{14.5\%} 14.5% , and the actual standard deviation of that 60/40 mix, rebalanced
daily over the five years, was 14.51%. That gap is the diversification benefit . The plain
weighted average is only right when the correlation is exactly +1.
{"panels":[{"x0":43.64,"x1":565.2,"y0":10.8,"y1":246.88,"title":"","xlabel":"Share of money in SPY, the rest in GLD (%)","ylabel":"Portfolio risk: standard deviation (% a year)","xlog":false}],"series":[{"panel":0,"label":"correlation +1.0","color":"var(--chart-grey, #a3a19c)","x":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0,35.5,36.0,36.5,37.0,37.5,38.0,38.5,39.0,39.5,40.0,40.5,41.0,41.5,42.0,42.5,43.0,43.5,44.0,44.5,45.0,45.5,46.0,46.5,47.0,47.5,48.0,48.5,49.0,49.5,50.0,50.5,51.0,51.5,52.0,52.5,53.0,53.5,54.0,54.5,55.0,55.5,56.0,56.5,57.0,57.5,58.0,58.5,59.0,59.5,60.0,60.5,61.0,61.5,62.0,62.5,63.0,63.5,64.0,64.5,65.0,65.5,66.0,66.5,67.0,67.5,68.0,68.5,69.0,69.5,70.0,70.5,71.0,71.5,72.0,72.5,73.0,73.5,74.0,74.5,75.0,75.5,76.0,76.5,77.0,77.5,78.0,78.5,79.0,79.5,80.0,80.5,81.0,81.5,82.0,82.5,83.0,83.5,84.0,84.5,85.0,85.5,86.0,86.5,87.0,87.5,88.0,88.5,89.0,89.5,90.0,90.5,91.0,91.5,92.0,92.5,93.0,93.5,94.0,94.5,95.0,95.5,96.0,96.5,97.0,97.5,98.0,98.5,99.0,99.5,100.0],"y":[14.9,14.9305,14.961,14.9915,15.022,15.0525,15.083,15.1135,15.144,15.1745,15.205,15.2355,15.266,15.2965,15.327,15.3575,15.388,15.4185,15.449,15.4795,15.51,15.5405,15.571,15.6015,15.632,15.6625,15.693,15.7235,15.754,15.7845,15.815,15.8455,15.876,15.9065,15.937,15.9675,15.998,16.0285,16.059,16.0895,16.12,16.1505,16.181,16.2115,16.242,16.2725,16.303,16.3335,16.364,16.3945,16.425,16.4555,16.486,16.5165,16.547,16.5775,16.608,16.6385,16.669,16.6995,16.73,16.7605,16.791,16.8215,16.852,16.8825,16.913,16.9435,16.974,17.0045,17.035,17.0655,17.096,17.1265,17.157,17.1875,17.218,17.2485,17.279,17.3095,17.34,17.3705,17.401,17.4315,17.462,17.4925,17.523,17.5535,17.584,17.6145,17.645,17.6755,17.706,17.7365,17.767,17.7975,17.828,17.8585,17.889,17.9195,17.95,17.9805,18.011,18.0415,18.072,18.1025,18.133,18.1635,18.194,18.2245,18.255,18.2855,18.316,18.3465,18.377,18.4075,18.438,18.4685,18.499,18.5295,18.56,18.5905,18.621,18.6515,18.682,18.7125,18.743,18.7735,18.804,18.8345,18.865,18.8955,18.926,18.9565,18.987,19.0175,19.048,19.0785,19.109,19.1395,19.17,19.2005,19.231,19.2615,19.292,19.3225,19.353,19.3835,19.414,19.4445,19.475,19.5055,19.536,19.5665,19.597,19.6275,19.658,19.6885,19.719,19.7495,19.78,19.8105,19.841,19.8715,19.902,19.9325,19.963,19.9935,20.024,20.0545,20.085,20.1155,20.146,20.1765,20.207,20.2375,20.268,20.2985,20.329,20.3595,20.39,20.4205,20.451,20.4815,20.512,20.5425,20.573,20.6035,20.634,20.6645,20.695,20.7255,20.756,20.7865,20.817,20.8475,20.878,20.9085,20.939,20.9695,21.0],"sx":[67.35,69.72,72.09,74.46,76.83,79.2,81.57,83.94,86.32,88.69,91.06,93.43,95.8,98.17,100.54,102.91,105.28,107.65,110.02,112.39,114.76,117.13,119.51,121.88,124.25,126.62,128.99,131.36,133.73,136.1,138.47,140.84,143.21,145.58,147.95,150.32,152.7,155.07,157.44,159.81,162.18,164.55,166.92,169.29,171.66,174.03,176.4,178.77,181.14,183.51,185.89,188.26,190.63,193.0,195.37,197.74,200.11,202.48,204.85,207.22,209.59,211.96,214.33,216.7,219.08,221.45,223.82,226.19,228.56,230.93,233.3,235.67,238.04,240.41,242.78,245.15,247.52,249.89,252.27,254.64,257.01,259.38,261.75,264.12,266.49,268.86,271.23,273.6,275.97,278.34,280.71,283.08,285.46,287.83,290.2,292.57,294.94,297.31,299.68,302.05,304.42,306.79,309.16,311.53,313.9,316.27,318.65,321.02,323.39,325.76,328.13,330.5,332.87,335.24,337.61,339.98,342.35,344.72,347.09,349.46,351.84,354.21,356.58,358.95,361.32,363.69,366.06,368.43,370.8,373.17,375.54,377.91,380.28,382.65,385.03,387.4,389.77,392.14,394.51,396.88,399.25,401.62,403.99,406.36,408.73,411.1,413.47,415.84,418.22,420.59,422.96,425.33,427.7,430.07,432.44,434.81,437.18,439.55,441.92,444.29,446.66,449.03,451.41,453.78,456.15,458.52,460.89,463.26,465.63,468.0,470.37,472.74,475.11,477.48,479.85,482.22,484.6,486.97,489.34,491.71,494.08,496.45,498.82,501.19,503.56,505.93,508.3,510.67,513.04,515.41,517.79,520.16,522.53,524.9,527.27,529.64,532.01,534.38,536.75,539.12,541.49],"sy":[93.94,93.63,93.31,93.0,92.69,92.38,92.06,91.75,91.44,91.12,90.81,90.5,90.18,89.87,89.56,89.24,88.93,88.62,88.31,87.99,87.68,87.37,87.05,86.74,86.43,86.11,85.8,85.49,85.17,84.86,84.55,84.24,83.92,83.61,83.3,82.98,82.67,82.36,82.04,81.73,81.42,81.1,80.79,80.48,80.17,79.85,79.54,79.23,78.91,78.6,78.29,77.97,77.66,77.35,77.04,76.72,76.41,76.1,75.78,75.47,75.16,74.84,74.53,74.22,73.9,73.59,73.28,72.97,72.65,72.34,72.03,71.71,71.4,71.09,70.77,70.46,70.15,69.83,69.52,69.21,68.9,68.58,68.27,67.96,67.64,67.33,67.02,66.7,66.39,66.08,65.77,65.45,65.14,64.83,64.51,64.2,63.89,63.57,63.26,62.95,62.63,62.32,62.01,61.7,61.38,61.07,60.76,60.44,60.13,59.82,59.5,59.19,58.88,58.56,58.25,57.94,57.63,57.31,57.0,56.69,56.37,56.06,55.75,55.43,55.12,54.81,54.49,54.18,53.87,53.56,53.24,52.93,52.62,52.3,51.99,51.68,51.36,51.05,50.74,50.43,50.11,49.8,49.49,49.17,48.86,48.55,48.23,47.92,47.61,47.29,46.98,46.67,46.36,46.04,45.73,45.42,45.1,44.79,44.48,44.16,43.85,43.54,43.22,42.91,42.6,42.29,41.97,41.66,41.35,41.03,40.72,40.41,40.09,39.78,39.47,39.15,38.84,38.53,38.22,37.9,37.59,37.28,36.96,36.65,36.34,36.02,35.71,35.4,35.09,34.77,34.46,34.15,33.83,33.52,33.21,32.89,32.58,32.27,31.95,31.64,31.33]},{"panel":0,"label":"correlation +0.5","color":"var(--chart-grey, #a3a19c)","x":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0,35.5,36.0,36.5,37.0,37.5,38.0,38.5,39.0,39.5,40.0,40.5,41.0,41.5,42.0,42.5,43.0,43.5,44.0,44.5,45.0,45.5,46.0,46.5,47.0,47.5,48.0,48.5,49.0,49.5,50.0,50.5,51.0,51.5,52.0,52.5,53.0,53.5,54.0,54.5,55.0,55.5,56.0,56.5,57.0,57.5,58.0,58.5,59.0,59.5,60.0,60.5,61.0,61.5,62.0,62.5,63.0,63.5,64.0,64.5,65.0,65.5,66.0,66.5,67.0,67.5,68.0,68.5,69.0,69.5,70.0,70.5,71.0,71.5,72.0,72.5,73.0,73.5,74.0,74.5,75.0,75.5,76.0,76.5,77.0,77.5,78.0,78.5,79.0,79.5,80.0,80.5,81.0,81.5,82.0,82.5,83.0,83.5,84.0,84.5,85.0,85.5,86.0,86.5,87.0,87.5,88.0,88.5,89.0,89.5,90.0,90.5,91.0,91.5,92.0,92.5,93.0,93.5,94.0,94.5,95.0,95.5,96.0,96.5,97.0,97.5,98.0,98.5,99.0,99.5,100.0],"y":[14.9,14.8783,14.8571,14.8365,14.8165,14.797,14.7781,14.7597,14.742,14.7248,14.7081,14.6921,14.6766,14.6617,14.6474,14.6337,14.6206,14.608,14.5961,14.5847,14.5739,14.5637,14.5541,14.5452,14.5368,14.529,14.5218,14.5151,14.5091,14.5037,14.4989,14.4948,14.4912,14.4882,14.4858,14.484,14.4828,14.4822,14.4823,14.4829,14.4841,14.486,14.4884,14.4915,14.4951,14.4994,14.5042,14.5097,14.5158,14.5224,14.5297,14.5375,14.546,14.5551,14.5647,14.5749,14.5858,14.5972,14.6092,14.6218,14.635,14.6488,14.6632,14.6781,14.6936,14.7097,14.7264,14.7437,14.7615,14.7799,14.7989,14.8184,14.8385,14.8592,14.8804,14.9022,14.9245,14.9474,14.9708,14.9948,15.0193,15.0444,15.07,15.0961,15.1228,15.15,15.1777,15.206,15.2348,15.2641,15.2939,15.3242,15.3551,15.3864,15.4183,15.4506,15.4835,15.5168,15.5506,15.585,15.6198,15.6551,15.6908,15.7271,15.7638,15.801,15.8386,15.8767,15.9153,15.9543,15.9938,16.0337,16.0741,16.1149,16.1562,16.1979,16.24,16.2825,16.3255,16.3689,16.4127,16.457,16.5016,16.5466,16.5921,16.638,16.6842,16.7309,16.7779,16.8253,16.8732,16.9214,16.9699,17.0189,17.0682,17.1179,17.168,17.2184,17.2692,17.3203,17.3718,17.4237,17.4758,17.5284,17.5813,17.6345,17.688,17.7419,17.7961,17.8506,17.9055,17.9607,18.0162,18.072,18.1281,18.1845,18.2413,18.2983,18.3556,18.4133,18.4712,18.5294,18.5879,18.6467,18.7058,18.7651,18.8247,18.8847,18.9448,19.0053,19.066,19.127,19.1882,19.2497,19.3115,19.3735,19.4358,19.4983,19.5611,19.6241,19.6873,19.7508,19.8146,19.8785,19.9427,20.0072,20.0718,20.1367,20.2018,20.2672,20.3327,20.3985,20.4645,20.5307,20.5971,20.6638,20.7306,20.7977,20.8649,20.9323,21.0],"sx":[67.35,69.72,72.09,74.46,76.83,79.2,81.57,83.94,86.32,88.69,91.06,93.43,95.8,98.17,100.54,102.91,105.28,107.65,110.02,112.39,114.76,117.13,119.51,121.88,124.25,126.62,128.99,131.36,133.73,136.1,138.47,140.84,143.21,145.58,147.95,150.32,152.7,155.07,157.44,159.81,162.18,164.55,166.92,169.29,171.66,174.03,176.4,178.77,181.14,183.51,185.89,188.26,190.63,193.0,195.37,197.74,200.11,202.48,204.85,207.22,209.59,211.96,214.33,216.7,219.08,221.45,223.82,226.19,228.56,230.93,233.3,235.67,238.04,240.41,242.78,245.15,247.52,249.89,252.27,254.64,257.01,259.38,261.75,264.12,266.49,268.86,271.23,273.6,275.97,278.34,280.71,283.08,285.46,287.83,290.2,292.57,294.94,297.31,299.68,302.05,304.42,306.79,309.16,311.53,313.9,316.27,318.65,321.02,323.39,325.76,328.13,330.5,332.87,335.24,337.61,339.98,342.35,344.72,347.09,349.46,351.84,354.21,356.58,358.95,361.32,363.69,366.06,368.43,370.8,373.17,375.54,377.91,380.28,382.65,385.03,387.4,389.77,392.14,394.51,396.88,399.25,401.62,403.99,406.36,408.73,411.1,413.47,415.84,418.22,420.59,422.96,425.33,427.7,430.07,432.44,434.81,437.18,439.55,441.92,444.29,446.66,449.03,451.41,453.78,456.15,458.52,460.89,463.26,465.63,468.0,470.37,472.74,475.11,477.48,479.85,482.22,484.6,486.97,489.34,491.71,494.08,496.45,498.82,501.19,503.56,505.93,508.3,510.67,513.04,515.41,517.79,520.16,522.53,524.9,527.27,529.64,532.01,534.38,536.75,539.12,541.49],"sy":[93.94,94.16,94.38,94.59,94.8,95.0,95.19,95.38,95.56,95.74,95.91,96.07,96.23,96.39,96.53,96.67,96.81,96.94,97.06,97.18,97.29,97.39,97.49,97.58,97.67,97.75,97.82,97.89,97.95,98.01,98.06,98.1,98.14,98.17,98.19,98.21,98.22,98.23,98.23,98.22,98.21,98.19,98.16,98.13,98.1,98.05,98.0,97.95,97.88,97.82,97.74,97.66,97.57,97.48,97.38,97.28,97.17,97.05,96.92,96.8,96.66,96.52,96.37,96.22,96.06,95.89,95.72,95.54,95.36,95.17,94.98,94.78,94.57,94.36,94.14,93.92,93.69,93.45,93.21,92.97,92.72,92.46,92.2,91.93,91.65,91.37,91.09,90.8,90.5,90.2,89.9,89.59,89.27,88.95,88.62,88.29,87.95,87.61,87.26,86.91,86.55,86.19,85.82,85.45,85.07,84.69,84.31,83.91,83.52,83.12,82.71,82.3,81.89,81.47,81.05,80.62,80.19,79.75,79.31,78.86,78.41,77.96,77.5,77.04,76.57,76.1,75.63,75.15,74.67,74.18,73.69,73.19,72.69,72.19,71.69,71.18,70.66,70.14,69.62,69.1,68.57,68.04,67.5,66.96,66.42,65.87,65.32,64.77,64.21,63.65,63.09,62.52,61.96,61.38,60.81,60.23,59.64,59.06,58.47,57.88,57.28,56.69,56.09,55.48,54.88,54.27,53.66,53.04,52.42,51.8,51.18,50.55,49.92,49.29,48.66,48.02,47.38,46.74,46.1,45.45,44.8,44.15,43.5,42.84,42.18,41.52,40.86,40.19,39.52,38.85,38.18,37.5,36.82,36.15,35.46,34.78,34.09,33.41,32.72,32.02,31.33]},{"panel":0,"label":"correlation +0.1","color":"var(--chart-maroon, #b6262c)","x":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0,35.5,36.0,36.5,37.0,37.5,38.0,38.5,39.0,39.5,40.0,40.5,41.0,41.5,42.0,42.5,43.0,43.5,44.0,44.5,45.0,45.5,46.0,46.5,47.0,47.5,48.0,48.5,49.0,49.5,50.0,50.5,51.0,51.5,52.0,52.5,53.0,53.5,54.0,54.5,55.0,55.5,56.0,56.5,57.0,57.5,58.0,58.5,59.0,59.5,60.0,60.5,61.0,61.5,62.0,62.5,63.0,63.5,64.0,64.5,65.0,65.5,66.0,66.5,67.0,67.5,68.0,68.5,69.0,69.5,70.0,70.5,71.0,71.5,72.0,72.5,73.0,73.5,74.0,74.5,75.0,75.5,76.0,76.5,77.0,77.5,78.0,78.5,79.0,79.5,80.0,80.5,81.0,81.5,82.0,82.5,83.0,83.5,84.0,84.5,85.0,85.5,86.0,86.5,87.0,87.5,88.0,88.5,89.0,89.5,90.0,90.5,91.0,91.5,92.0,92.5,93.0,93.5,94.0,94.5,95.0,95.5,96.0,96.5,97.0,97.5,98.0,98.5,99.0,99.5,100.0],"y":[14.9,14.8374,14.7756,14.7145,14.6541,14.5946,14.5358,14.4778,14.4206,14.3642,14.3086,14.2539,14.1999,14.1469,14.0946,14.0433,13.9928,13.9432,13.8945,13.8467,13.7998,13.7538,13.7087,13.6646,13.6215,13.5793,13.538,13.4977,13.4585,13.4202,13.3829,13.3466,13.3113,13.2771,13.2439,13.2117,13.1806,13.1505,13.1215,13.0936,13.0668,13.041,13.0163,12.9927,12.9703,12.9489,12.9286,12.9095,12.8915,12.8746,12.8589,12.8442,12.8308,12.8184,12.8073,12.7972,12.7884,12.7806,12.7741,12.7687,12.7644,12.7614,12.7594,12.7587,12.7591,12.7607,12.7634,12.7673,12.7724,12.7786,12.786,12.7946,12.8043,12.8151,12.8271,12.8403,12.8545,12.87,12.8865,12.9042,12.923,12.943,12.964,12.9862,13.0094,13.0338,13.0593,13.0858,13.1134,13.1421,13.1719,13.2027,13.2345,13.2674,13.3014,13.3364,13.3724,13.4094,13.4474,13.4864,13.5263,13.5673,13.6092,13.6521,13.696,13.7407,13.7865,13.8331,13.8806,13.9291,13.9784,14.0287,14.0798,14.1318,14.1846,14.2383,14.2928,14.3481,14.4043,14.4613,14.519,14.5776,14.637,14.6971,14.7579,14.8196,14.8819,14.945,15.0089,15.0734,15.1387,15.2046,15.2713,15.3386,15.4066,15.4752,15.5445,15.6144,15.685,15.7562,15.828,15.9005,15.9735,16.0471,16.1213,16.1961,16.2715,16.3474,16.4239,16.5009,16.5785,16.6565,16.7352,16.8143,16.8939,16.9741,17.0547,17.1358,17.2174,17.2995,17.382,17.465,17.5485,17.6324,17.7167,17.8015,17.8867,17.9723,18.0584,18.1448,18.2317,18.319,18.4066,18.4946,18.5831,18.6719,18.761,18.8506,18.9405,19.0307,19.1213,19.2123,19.3036,19.3952,19.4872,19.5795,19.6721,19.765,19.8582,19.9518,20.0456,20.1398,20.2342,20.329,20.424,20.5193,20.6149,20.7108,20.8069,20.9033,21.0],"sx":[67.35,69.72,72.09,74.46,76.83,79.2,81.57,83.94,86.32,88.69,91.06,93.43,95.8,98.17,100.54,102.91,105.28,107.65,110.02,112.39,114.76,117.13,119.51,121.88,124.25,126.62,128.99,131.36,133.73,136.1,138.47,140.84,143.21,145.58,147.95,150.32,152.7,155.07,157.44,159.81,162.18,164.55,166.92,169.29,171.66,174.03,176.4,178.77,181.14,183.51,185.89,188.26,190.63,193.0,195.37,197.74,200.11,202.48,204.85,207.22,209.59,211.96,214.33,216.7,219.08,221.45,223.82,226.19,228.56,230.93,233.3,235.67,238.04,240.41,242.78,245.15,247.52,249.89,252.27,254.64,257.01,259.38,261.75,264.12,266.49,268.86,271.23,273.6,275.97,278.34,280.71,283.08,285.46,287.83,290.2,292.57,294.94,297.31,299.68,302.05,304.42,306.79,309.16,311.53,313.9,316.27,318.65,321.02,323.39,325.76,328.13,330.5,332.87,335.24,337.61,339.98,342.35,344.72,347.09,349.46,351.84,354.21,356.58,358.95,361.32,363.69,366.06,368.43,370.8,373.17,375.54,377.91,380.28,382.65,385.03,387.4,389.77,392.14,394.51,396.88,399.25,401.62,403.99,406.36,408.73,411.1,413.47,415.84,418.22,420.59,422.96,425.33,427.7,430.07,432.44,434.81,437.18,439.55,441.92,444.29,446.66,449.03,451.41,453.78,456.15,458.52,460.89,463.26,465.63,468.0,470.37,472.74,475.11,477.48,479.85,482.22,484.6,486.97,489.34,491.71,494.08,496.45,498.82,501.19,503.56,505.93,508.3,510.67,513.04,515.41,517.79,520.16,522.53,524.9,527.27,529.64,532.01,534.38,536.75,539.12,541.49],"sy":[93.94,94.58,95.22,95.84,96.46,97.08,97.68,98.27,98.86,99.44,100.01,100.57,101.13,101.67,102.21,102.73,103.25,103.76,104.26,104.75,105.23,105.71,106.17,106.62,107.06,107.5,107.92,108.33,108.74,109.13,109.51,109.88,110.25,110.6,110.94,111.27,111.59,111.9,112.19,112.48,112.76,113.02,113.27,113.52,113.75,113.97,114.17,114.37,114.56,114.73,114.89,115.04,115.18,115.31,115.42,115.52,115.61,115.69,115.76,115.82,115.86,115.89,115.91,115.92,115.91,115.9,115.87,115.83,115.78,115.71,115.64,115.55,115.45,115.34,115.22,115.08,114.94,114.78,114.61,114.43,114.23,114.03,113.81,113.58,113.35,113.1,112.83,112.56,112.28,111.98,111.68,111.36,111.04,110.7,110.35,109.99,109.62,109.24,108.85,108.45,108.04,107.62,107.19,106.75,106.3,105.84,105.37,104.89,104.4,103.91,103.4,102.88,102.36,101.83,101.28,100.73,100.17,99.6,99.03,98.44,97.85,97.25,96.64,96.02,95.4,94.77,94.13,93.48,92.82,92.16,91.49,90.81,90.13,89.44,88.74,88.04,87.33,86.61,85.88,85.15,84.41,83.67,82.92,82.17,81.4,80.64,79.86,79.08,78.3,77.51,76.71,75.91,75.1,74.29,73.47,72.65,71.82,70.99,70.15,69.31,68.46,67.61,66.76,65.89,65.03,64.16,63.28,62.41,61.52,60.63,59.74,58.85,57.95,57.04,56.14,55.23,54.31,53.39,52.47,51.54,50.61,49.68,48.74,47.8,46.86,45.91,44.96,44.0,43.05,42.09,41.12,40.16,39.19,38.22,37.24,36.26,35.28,34.3,33.31,32.32,31.33]},{"panel":0,"label":"correlation -0.5","color":"#7d7b77","x":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0,35.5,36.0,36.5,37.0,37.5,38.0,38.5,39.0,39.5,40.0,40.5,41.0,41.5,42.0,42.5,43.0,43.5,44.0,44.5,45.0,45.5,46.0,46.5,47.0,47.5,48.0,48.5,49.0,49.5,50.0,50.5,51.0,51.5,52.0,52.5,53.0,53.5,54.0,54.5,55.0,55.5,56.0,56.5,57.0,57.5,58.0,58.5,59.0,59.5,60.0,60.5,61.0,61.5,62.0,62.5,63.0,63.5,64.0,64.5,65.0,65.5,66.0,66.5,67.0,67.5,68.0,68.5,69.0,69.5,70.0,70.5,71.0,71.5,72.0,72.5,73.0,73.5,74.0,74.5,75.0,75.5,76.0,76.5,77.0,77.5,78.0,78.5,79.0,79.5,80.0,80.5,81.0,81.5,82.0,82.5,83.0,83.5,84.0,84.5,85.0,85.5,86.0,86.5,87.0,87.5,88.0,88.5,89.0,89.5,90.0,90.5,91.0,91.5,92.0,92.5,93.0,93.5,94.0,94.5,95.0,95.5,96.0,96.5,97.0,97.5,98.0,98.5,99.0,99.5,100.0],"y":[14.9,14.7733,14.6471,14.5216,14.3966,14.2722,14.1485,14.0255,13.903,13.7813,13.6603,13.54,13.4204,13.3016,13.1836,13.0664,12.95,12.8344,12.7198,12.606,12.4931,12.3811,12.2702,12.1602,12.0513,11.9433,11.8365,11.7308,11.6262,11.5228,11.4206,11.3196,11.2199,11.1215,11.0244,10.9287,10.8344,10.7415,10.6501,10.5603,10.472,10.3853,10.3002,10.2168,10.1352,10.0553,9.97718,9.90093,9.82658,9.75416,9.68372,9.6153,9.54894,9.4847,9.4226,9.3627,9.30504,9.24965,9.19659,9.14588,9.09758,9.05171,9.00832,8.96743,8.9291,8.89334,8.86019,8.82968,8.80184,8.77669,8.75425,8.73456,8.71761,8.70344,8.69205,8.68345,8.67766,8.67468,8.67451,8.67715,8.6826,8.69086,8.70191,8.71575,8.73236,8.75173,8.77383,8.79866,8.82618,8.85636,8.88919,8.92464,8.96266,9.00324,9.04633,9.0919,9.13992,9.19033,9.24312,9.29822,9.35561,9.41525,9.47708,9.54107,9.60717,9.67534,9.74554,9.81772,9.89184,9.96786,10.0457,10.1254,10.2069,10.29,10.3749,10.4614,10.5495,10.6392,10.7304,10.8231,10.9172,11.0128,11.1097,11.2079,11.3075,11.4083,11.5104,11.6137,11.7181,11.8237,11.9304,12.0382,12.147,12.2568,12.3677,12.4795,12.5923,12.706,12.8205,12.936,13.0523,13.1694,13.2873,13.406,13.5255,13.6457,13.7667,13.8883,14.0106,14.1336,14.2573,14.3815,14.5064,14.6319,14.758,14.8847,15.0119,15.1396,15.2679,15.3967,15.526,15.6558,15.786,15.9168,16.048,16.1796,16.3117,16.4442,16.5771,16.7104,16.8441,16.9782,17.1126,17.2474,17.3826,17.5182,17.654,17.7902,17.9268,18.0636,18.2008,18.3383,18.476,18.6141,18.7524,18.8911,19.0299,19.1691,19.3085,19.4482,19.5881,19.7283,19.8687,20.0093,20.1502,20.2913,20.4326,20.5742,20.7159,20.8578,21.0],"sx":[67.35,69.72,72.09,74.46,76.83,79.2,81.57,83.94,86.32,88.69,91.06,93.43,95.8,98.17,100.54,102.91,105.28,107.65,110.02,112.39,114.76,117.13,119.51,121.88,124.25,126.62,128.99,131.36,133.73,136.1,138.47,140.84,143.21,145.58,147.95,150.32,152.7,155.07,157.44,159.81,162.18,164.55,166.92,169.29,171.66,174.03,176.4,178.77,181.14,183.51,185.89,188.26,190.63,193.0,195.37,197.74,200.11,202.48,204.85,207.22,209.59,211.96,214.33,216.7,219.08,221.45,223.82,226.19,228.56,230.93,233.3,235.67,238.04,240.41,242.78,245.15,247.52,249.89,252.27,254.64,257.01,259.38,261.75,264.12,266.49,268.86,271.23,273.6,275.97,278.34,280.71,283.08,285.46,287.83,290.2,292.57,294.94,297.31,299.68,302.05,304.42,306.79,309.16,311.53,313.9,316.27,318.65,321.02,323.39,325.76,328.13,330.5,332.87,335.24,337.61,339.98,342.35,344.72,347.09,349.46,351.84,354.21,356.58,358.95,361.32,363.69,366.06,368.43,370.8,373.17,375.54,377.91,380.28,382.65,385.03,387.4,389.77,392.14,394.51,396.88,399.25,401.62,403.99,406.36,408.73,411.1,413.47,415.84,418.22,420.59,422.96,425.33,427.7,430.07,432.44,434.81,437.18,439.55,441.92,444.29,446.66,449.03,451.41,453.78,456.15,458.52,460.89,463.26,465.63,468.0,470.37,472.74,475.11,477.48,479.85,482.22,484.6,486.97,489.34,491.71,494.08,496.45,498.82,501.19,503.56,505.93,508.3,510.67,513.04,515.41,517.79,520.16,522.53,524.9,527.27,529.64,532.01,534.38,536.75,539.12,541.49],"sy":[93.94,95.24,96.54,97.82,99.11,100.38,101.65,102.92,104.17,105.42,106.66,107.9,109.13,110.35,111.56,112.76,113.96,115.14,116.32,117.49,118.65,119.79,120.93,122.06,123.18,124.29,125.38,126.47,127.54,128.6,129.65,130.69,131.71,132.72,133.72,134.7,135.67,136.62,137.56,138.48,139.39,140.28,141.15,142.01,142.85,143.67,144.47,145.25,146.02,146.76,147.48,148.18,148.86,149.52,150.16,150.78,151.37,151.94,152.48,153.0,153.5,153.97,154.41,154.83,155.23,155.59,155.93,156.25,156.53,156.79,157.02,157.22,157.4,157.54,157.66,157.75,157.81,157.84,157.84,157.81,157.76,157.67,157.56,157.42,157.25,157.05,156.82,156.57,156.28,155.97,155.64,155.27,154.88,154.47,154.02,153.56,153.06,152.55,152.0,151.44,150.85,150.24,149.6,148.95,148.27,147.57,146.85,146.11,145.35,144.57,143.77,142.95,142.11,141.26,140.39,139.5,138.59,137.67,136.74,135.79,134.82,133.84,132.85,131.84,130.81,129.78,128.73,127.67,126.6,125.52,124.42,123.32,122.2,121.07,119.93,118.78,117.63,116.46,115.28,114.1,112.91,111.7,110.49,109.27,108.05,106.81,105.57,104.32,103.07,101.81,100.54,99.26,97.98,96.69,95.4,94.1,92.79,91.48,90.16,88.84,87.52,86.18,84.85,83.5,82.16,80.81,79.45,78.09,76.73,75.36,73.99,72.61,71.23,69.85,68.46,67.07,65.67,64.27,62.87,61.47,60.06,58.65,57.24,55.82,54.4,52.98,51.55,50.12,48.69,47.26,45.82,44.38,42.94,41.5,40.05,38.6,37.15,35.7,34.24,32.79,31.33]},{"panel":0,"label":"correlation -1.0","color":"var(--chart-maroon, #b6262c)","x":[0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,4.5,5.0,5.5,6.0,6.5,7.0,7.5,8.0,8.5,9.0,9.5,10.0,10.5,11.0,11.5,12.0,12.5,13.0,13.5,14.0,14.5,15.0,15.5,16.0,16.5,17.0,17.5,18.0,18.5,19.0,19.5,20.0,20.5,21.0,21.5,22.0,22.5,23.0,23.5,24.0,24.5,25.0,25.5,26.0,26.5,27.0,27.5,28.0,28.5,29.0,29.5,30.0,30.5,31.0,31.5,32.0,32.5,33.0,33.5,34.0,34.5,35.0,35.5,36.0,36.5,37.0,37.5,38.0,38.5,39.0,39.5,40.0,40.5,41.0,41.5,42.0,42.5,43.0,43.5,44.0,44.5,45.0,45.5,46.0,46.5,47.0,47.5,48.0,48.5,49.0,49.5,50.0,50.5,51.0,51.5,52.0,52.5,53.0,53.5,54.0,54.5,55.0,55.5,56.0,56.5,57.0,57.5,58.0,58.5,59.0,59.5,60.0,60.5,61.0,61.5,62.0,62.5,63.0,63.5,64.0,64.5,65.0,65.5,66.0,66.5,67.0,67.5,68.0,68.5,69.0,69.5,70.0,70.5,71.0,71.5,72.0,72.5,73.0,73.5,74.0,74.5,75.0,75.5,76.0,76.5,77.0,77.5,78.0,78.5,79.0,79.5,80.0,80.5,81.0,81.5,82.0,82.5,83.0,83.5,84.0,84.5,85.0,85.5,86.0,86.5,87.0,87.5,88.0,88.5,89.0,89.5,90.0,90.5,91.0,91.5,92.0,92.5,93.0,93.5,94.0,94.5,95.0,95.5,96.0,96.5,97.0,97.5,98.0,98.5,99.0,99.5,100.0],"y":[14.9,14.7205,14.541,14.3615,14.182,14.0025,13.823,13.6435,13.464,13.2845,13.105,12.9255,12.746,12.5665,12.387,12.2075,12.028,11.8485,11.669,11.4895,11.31,11.1305,10.951,10.7715,10.592,10.4125,10.233,10.0535,9.874,9.6945,9.515,9.3355,9.156,8.9765,8.797,8.6175,8.438,8.2585,8.079,7.8995,7.72,7.5405,7.361,7.1815,7.002,6.8225,6.643,6.4635,6.284,6.1045,5.925,5.7455,5.566,5.3865,5.207,5.0275,4.848,4.6685,4.489,4.3095,4.13,3.9505,3.771,3.5915,3.412,3.2325,3.053,2.8735,2.694,2.5145,2.335,2.1555,1.976,1.7965,1.617,1.4375,1.258,1.0785,0.899,0.7195,0.54,0.3605,0.181,0.0015,0.178,0.3575,0.537,0.7165,0.896,1.0755,1.255,1.4345,1.614,1.7935,1.973,2.1525,2.332,2.5115,2.691,2.8705,3.05,3.2295,3.409,3.5885,3.768,3.9475,4.127,4.3065,4.486,4.6655,4.845,5.0245,5.204,5.3835,5.563,5.7425,5.922,6.1015,6.281,6.4605,6.64,6.8195,6.999,7.1785,7.358,7.5375,7.717,7.8965,8.076,8.2555,8.435,8.6145,8.794,8.9735,9.153,9.3325,9.512,9.6915,9.871,10.0505,10.23,10.4095,10.589,10.7685,10.948,11.1275,11.307,11.4865,11.666,11.8455,12.025,12.2045,12.384,12.5635,12.743,12.9225,13.102,13.2815,13.461,13.6405,13.82,13.9995,14.179,14.3585,14.538,14.7175,14.897,15.0765,15.256,15.4355,15.615,15.7945,15.974,16.1535,16.333,16.5125,16.692,16.8715,17.051,17.2305,17.41,17.5895,17.769,17.9485,18.128,18.3075,18.487,18.6665,18.846,19.0255,19.205,19.3845,19.564,19.7435,19.923,20.1025,20.282,20.4615,20.641,20.8205,21.0],"sx":[67.35,69.72,72.09,74.46,76.83,79.2,81.57,83.94,86.32,88.69,91.06,93.43,95.8,98.17,100.54,102.91,105.28,107.65,110.02,112.39,114.76,117.13,119.51,121.88,124.25,126.62,128.99,131.36,133.73,136.1,138.47,140.84,143.21,145.58,147.95,150.32,152.7,155.07,157.44,159.81,162.18,164.55,166.92,169.29,171.66,174.03,176.4,178.77,181.14,183.51,185.89,188.26,190.63,193.0,195.37,197.74,200.11,202.48,204.85,207.22,209.59,211.96,214.33,216.7,219.08,221.45,223.82,226.19,228.56,230.93,233.3,235.67,238.04,240.41,242.78,245.15,247.52,249.89,252.27,254.64,257.01,259.38,261.75,264.12,266.49,268.86,271.23,273.6,275.97,278.34,280.71,283.08,285.46,287.83,290.2,292.57,294.94,297.31,299.68,302.05,304.42,306.79,309.16,311.53,313.9,316.27,318.65,321.02,323.39,325.76,328.13,330.5,332.87,335.24,337.61,339.98,342.35,344.72,347.09,349.46,351.84,354.21,356.58,358.95,361.32,363.69,366.06,368.43,370.8,373.17,375.54,377.91,380.28,382.65,385.03,387.4,389.77,392.14,394.51,396.88,399.25,401.62,403.99,406.36,408.73,411.1,413.47,415.84,418.22,420.59,422.96,425.33,427.7,430.07,432.44,434.81,437.18,439.55,441.92,444.29,446.66,449.03,451.41,453.78,456.15,458.52,460.89,463.26,465.63,468.0,470.37,472.74,475.11,477.48,479.85,482.22,484.6,486.97,489.34,491.71,494.08,496.45,498.82,501.19,503.56,505.93,508.3,510.67,513.04,515.41,517.79,520.16,522.53,524.9,527.27,529.64,532.01,534.38,536.75,539.12,541.49],"sy":[93.94,95.78,97.63,99.47,101.31,103.15,104.99,106.84,108.68,110.52,112.36,114.21,116.05,117.89,119.73,121.58,123.42,125.26,127.1,128.95,130.79,132.63,134.47,136.32,138.16,140.0,141.84,143.69,145.53,147.37,149.21,151.06,152.9,154.74,156.58,158.43,160.27,162.11,163.95,165.8,167.64,169.48,171.32,173.16,175.01,176.85,178.69,180.53,182.38,184.22,186.06,187.9,189.75,191.59,193.43,195.27,197.12,198.96,200.8,202.64,204.49,206.33,208.17,210.01,211.86,213.7,215.54,217.38,219.23,221.07,222.91,224.75,226.6,228.44,230.28,232.12,233.97,235.81,237.65,239.49,241.33,243.18,245.02,246.86,245.05,243.21,241.37,239.52,237.68,235.84,234.0,232.15,230.31,228.47,226.63,224.78,222.94,221.1,219.26,217.41,215.57,213.73,211.89,210.04,208.2,206.36,204.52,202.67,200.83,198.99,197.15,195.3,193.46,191.62,189.78,187.94,186.09,184.25,182.41,180.57,178.72,176.88,175.04,173.2,171.35,169.51,167.67,165.83,163.98,162.14,160.3,158.46,156.61,154.77,152.93,151.09,149.24,147.4,145.56,143.72,141.87,140.03,138.19,136.35,134.5,132.66,130.82,128.98,127.13,125.29,123.45,121.61,119.77,117.92,116.08,114.24,112.4,110.55,108.71,106.87,105.03,103.18,101.34,99.5,97.66,95.81,93.97,92.13,90.29,88.44,86.6,84.76,82.92,81.07,79.23,77.39,75.55,73.7,71.86,70.02,68.18,66.33,64.49,62.65,60.81,58.96,57.12,55.28,53.44,51.6,49.75,47.91,46.07,44.23,42.38,40.54,38.7,36.86,35.01,33.17,31.33]}]}
2026-10-15T18:29:05.015005
image/svg+xml
Matplotlib v3.11.2, https://matplotlib.org/
0
20
40
60
80
100
Share of money in SPY, the rest in GLD (%)
0
5
10
15
20
Portfolio risk: standard deviation (% a year)
60/40 SPY/GLD at +0.11
correlation +1.0
correlation +0.5
correlation +0.1
correlation -0.5
correlation -1.0
Each curve is one correlation. At + 1 \key{+1} + 1 (grey, straight), mixing doesn’t reduce risk at all. The
lower the correlation, the more the curve sags below the straight line; the solid red curve is
SPY and GLD’s actual 0.11. At − 1 \key{-1} − 1 (dashed red) it touches zero: a perfect hedge exists.
There’s a mix with the lowest possible risk. For two assets:
w 1 ∗ = σ 2 2 − ρ σ 1 σ 2 σ 1 2 + σ 2 2 − 2 ρ σ 1 σ 2 w_1^{*} = \frac{\risk{\sigma_2^2} - \key{\rho} \risk{\sigma_1} \risk{\sigma_2}}{\risk{\sigma_1^2} + \risk{\sigma_2^2} - 2 \key{\rho} \risk{\sigma_1} \risk{\sigma_2}} w 1 ∗ = σ 1 2 + σ 2 2 − 2 ρ σ 1 σ 2 σ 2 2 − ρ σ 1 σ 2
Here that’s 31.6 % \key{31.6\%} 31.6% in SPY, with a standard deviation of 12.8 % \risk{12.8\%} 12.8% . That’s lower than
holding only gold (14.9%) , even though you’ve added the riskier asset. Adding something risky
made the whole thing safer, because the two barely move together.
With more than two assets, the same book writes the variance as a sum over every pair of assets:
σ p 2 = ∑ i ∑ j w i w j σ i σ j ρ i j \risk{\sigma_p^2} = \sum_i \sum_j w_i\, w_j\, \risk{\sigma_i}\, \risk{\sigma_j}\, \key{\rho_{ij}} σ p 2 = i ∑ j ∑ w i w j σ i σ j ρ ij
where ρ i i = 1 \key{\rho_{ii}} = 1 ρ ii = 1 , so each asset’s own variance appears when i = j i = j i = j . The compact way to write
it: put the weights in a vector w w w and all variances and covariances in a covariance matrix
Σ \risk{\Sigma} Σ :
σ p 2 = w ⊤ Σ w Σ = ( σ 1 2 ρ σ 1 σ 2 ρ σ 1 σ 2 σ 2 2 ) \risk{\sigma_p^2} = w^\top \risk{\Sigma}\, w
\qquad
\risk{\Sigma} = \begin{pmatrix} \risk{\sigma_1^2} & \key{\rho}\,\risk{\sigma_1}\risk{\sigma_2} \\ \key{\rho}\,\risk{\sigma_1}\risk{\sigma_2} & \risk{\sigma_2^2} \end{pmatrix} σ p 2 = w ⊤ Σ w Σ = ( σ 1 2 ρ σ 1 σ 2 ρ σ 1 σ 2 σ 2 2 )
The diagonal holds each asset’s variance, and the off-diagonal holds the covariances. For the
60/40 example, w ⊤ Σ w = 0.021080 w^\top \risk{\Sigma} w = 0.021080 w ⊤ Σ w = 0.021080 , the same as the long formula.
One more useful result. Hold n n n assets in equal amounts, each with standard deviation σ \risk{\sigma} σ
and the same correlation ρ \key{\rho} ρ between every pair:
σ p 2 = σ 2 n + ( 1 − 1 n ) ρ σ 2 \risk{\sigma_p^2} = \frac{\risk{\sigma^2}}{n} + \left(1 - \frac{1}{n}\right) \key{\rho}\, \risk{\sigma^2} σ p 2 = n σ 2 + ( 1 − n 1 ) ρ σ 2
As n n n grows, the first term disappears. What’s left is ρ σ 2 \key{\rho}\, \risk{\sigma^2} ρ σ 2 , so you can never get
the risk below ρ σ \sqrt{\key{\rho}}\, \risk{\sigma} ρ σ :
Assets Correlation 0 Correlation 0.3 1 20.0% 20.0% 10 6.3% 12.2% 100 2.0% 11.1%
With zero correlation, diversification removes almost all the risk. With 0.3, going from 10 assets
to 100 barely helps: the floor is 0.3 × 20 % = 11.0 % \sqrt{0.3} \times 20\% = 11.0\% 0.3 × 20% = 11.0% . That floor is market risk ,
the part you can’t diversify away.
One catch. Correlations are not fixed. In a crisis, many assets fall together and
correlations jump up, exactly when you need diversification most.
The code
import numpy as np
import pandas as pd
prices = pd . read_csv ( "prices.csv" , index_col = "date" , parse_dates = True )
returns = ( prices / prices . shift ( 1 ) - 1 ). dropna ()
returns . corr () # the 5 x 5 correlation matrix
rho = returns [ "SPY" ]. corr ( returns [ "GLD" ]) # 0.11
Sigma = returns . cov () * 252 # yearly covariance matrix
# 60/40 SPY/GLD risk, two ways
s1 , s2 = returns [ "SPY" ]. std () * 252 ** 0.5 , returns [ "GLD" ]. std () * 252 ** 0.5 # 0.210, 0.149
w1 , w2 = 0.6 , 0.4
var_p = w1 ** 2 * s1 ** 2 + w2 ** 2 * s2 ** 2 + 2 * w1 * w2 * rho * s1 * s2
w = pd . Series ({ "SPY" : 0.6 , "GLD" : 0.4 })
print ( np . sqrt ( var_p ), np . sqrt ( w @ Sigma . loc [ w . index , w . index ] @ w )) # 0.145 both
Summary
Idea Formula Remember it as Covariance ∑ ( a t − a ˉ ) ( b t − b ˉ ) / ( n − 1 ) \sum (a_t - \bar{a})(b_t - \bar{b}) / (n-1) ∑ ( a t − a ˉ ) ( b t − b ˉ ) / ( n − 1 ) Do they move together? Correlation ρ = cov / ( s A s B ) \key{\rho} = \key{\text{cov}} / (\risk{s_A} \risk{s_B}) ρ = cov / ( s A s B ) Covariance on a −1 to +1 scale Portfolio variance w 1 2 σ 1 2 + w 2 2 σ 2 2 + 2 w 1 w 2 ρ σ 1 σ 2 w_1^2\risk{\sigma_1^2} + w_2^2\risk{\sigma_2^2} + 2w_1w_2\key{\rho}\risk{\sigma_1}\risk{\sigma_2} w 1 2 σ 1 2 + w 2 2 σ 2 2 + 2 w 1 w 2 ρ σ 1 σ 2 Correlation decides how much cancels Matrix form w ⊤ Σ w w^\top \risk{\Sigma} w w ⊤ Σ w Same thing, any number of assets Diversification floor ρ σ \sqrt{\key{\rho}}\,\risk{\sigma} ρ σ Market risk doesn’t diversify away Real pair SPY–GLD correlation 0.11 60/40 risk 14.5%, not the 18.6% average
Next
The Sharpe, Sortino and Information ratios : how to compare two investments that have different
returns and different risks.
References
Christopher M. Bishop and Hugh Bishop, Deep Learning: Foundations and Concepts (Springer, 2024), chapter 2: covariance (equation 2.48)
Philip J. Romero and Tucker Balch, What Hedge Funds Really Do: An Introduction to Portfolio Management (Business Expert Press, 2014), chapter 10: portfolio variance, two-asset and general forms
Harry Markowitz, “Portfolio Selection”, The Journal of Finance 7(1), 77–91, 1952
NumPy cov and corrcoef