-
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
-
Utility
Solution
def utilityCAL(ret1,ret2,var1,var2,cov,A):
returns = [(1-x/100)*ret1+(x/100)*ret2 for x in range(0,201)]
variances = [(1-x/100)**2*var1+(x/100)**2*var2+2*(1-x/100)*(x/100)*cov for x in range(0,101)]
utility = [x-.5*A*y for x,y in zip(returns,variances)]
utility.reverse()
standardDevs = [x**.5 for x in variances]
allocations = [(1-x/100) for x in range(0,101)]
plt.plot(allocations,utility)
plt.xlabel("Amount in Asset 1")
plt.ylabel("Utility")
plt.show()
utilityCAL(.05,.12,.02,.04,.005,2)
utilityCAL(.05,.12,.02,.04,.005,5)
utilityCAL(.05,.12,.02,.04,.005,10)
As you can see, the utility curves look very different with different A. The first investor is best off investing in the risky asset because they are not risk averse, the last investor is the best off investing in a combination of the two assets with the lowest variance since they are very risk averse.
Source Code
Prev
Optimization Part 2
Next
Introduction