-
Return and Variance 7
-
Lecture1.1
-
Lecture1.2
-
Lecture1.3
-
Lecture1.4
-
Lecture1.5
-
Lecture1.6
-
Lecture1.7
-
-
Solving Equations 5
-
Lecture2.1
-
Lecture2.2
-
Lecture2.3
-
Lecture2.4
-
Lecture2.5
-
-
Capital Allocation Line 6
-
Lecture3.1
-
Lecture3.2
-
Lecture3.3
-
Lecture3.4
-
Lecture3.5
-
Lecture3.6
-
-
Diversification 3
-
Lecture4.1
-
Lecture4.2
-
Lecture4.3
-
-
Investment Sets 3
-
Lecture5.1
-
Lecture5.2
-
Lecture5.3
-
-
Portfolios 7
-
Lecture6.1
-
Lecture6.2
-
Lecture6.3
-
Lecture6.4
-
Lecture6.5
-
Lecture6.6
-
Lecture6.7
-
-
Capital and Security Market Lines 3
-
Lecture7.1
-
Lecture7.2
-
Lecture7.3
-
-
Arbitrage 3
-
Lecture8.1
-
Lecture8.2
-
Lecture8.3
-
-
Dividend Discount Model 2
-
Lecture9.1
-
Lecture9.2
-
-
Fixed Income 4
-
Lecture10.1
-
Lecture10.2
-
Lecture10.3
-
Lecture10.4
-
-
Duration and Immunization 4
-
Lecture11.1
-
Lecture11.2
-
Lecture11.3
-
Lecture11.4
-
Playing with Correlation
Our function for this lesson:
import matplotlib.pyplot as plt
def investmentSet(ret1,ret2,SD1,SD2,cor):
var1 = SD1**2
var2 = SD2**2
cov = cor*SD1*SD2
returns = [(x)*ret1+(1-x/100)*ret2 for x in range(0,101)]
variances = [(x/100)**2*var1+(1-x/100)**2*var2+2*(x/100)*(1-x/100)*cov for x in range(0,101)]
standardDevs = [x**.5 for x in variances]
allocations = [(x/100) for x in range(0,101)]
plt.plot(allocations,standardDevs)
plt.xlabel("Amount in Asset 1")
plt.ylabel("Standard Deviation")
plt.title("Portfolio Standard Deviation vs. Allocation")
plt.show()
Notice we get the variances by squaring the standard deviation, and the covariance we get through it’s relationship to standard deviations and correlation.
And now we get to see how important correlation is, let’s start out with an example where two assets are perfectly correlated.
investmentSet(.06,.09,.2,.3,1)
What we see is there is a linear relationship between the standard deviation and allocation. This is because there is no diversification present, these two assets are affected by events in the same way. Now we will try one where there is a positive correlation.
investmentSet(.06,.09,.2,.3,.5)
You’ll notice that at every point in this curve, the standard deviation is lower than it was before, this is because there are diversification benefits, even if the two assets are somewhat related. What about no correlation?
investmentSet(.06,.09,.2,.3,0)
Even better results! What about a negative correlation?
investmentSet(.06,.09,.2,.3,-.5)
Still getting better, and now what about a perfectly negative correlation?
investmentSet(.06,.09,.2,.3,-1)
There is actually a point where the standard deviation is 0, this is the point where the overall impact on one asset is equal to the opposite impact on the other asset.