-
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
-
Optimization Part 2
Solution
I opted to create a function within a function. This approach will create a function which is only used within the parent function.
def CAL(ret1,ret2,var1,var2,cov):
def portVar(x):
return (1-x/100)**2*var1+(x/100)**2*var2+2*(1-x/100)*(x/100)*cov
returns = [(1-x/100)*ret1+(x/100)*ret2 for x in range(0,101)]
variances = [portVar(x) for x in range(0,101)]
standardDevs = [x**.5 for x in variances]
allocations = [(1-x/100) for x in range(0,101)]
minVarX = scipy.optimize.minimize(portVar,0,constraints=[con1,con2])["x"][0]
minVarSD = portVar(minVarX)**.5
minVarReturn = (1-minVarX/100)*ret1+(minVarX/100)*ret2
plt.plot(allocations,returns)
plt.xlabel("Amount in Asset 1")
plt.ylabel("Return")
plt.title("Capital Allocation Line ")
plt.plot(1-minVarX/100,minVarReturn,"ro")
plt.show()
plt.plot(allocations,standardDevs)
plt.xlabel("Amount in Asset 1")
plt.ylabel("Standard Deviation")
plt.title("Capital Allocation Line ")
plt.plot(1-minVarX/100,minVarSD,"ro")
plt.show()
CAL(.03,.09,.25,.35,.1)
An important aspect of the risk-reward trade off is that certain investors are very afraid of risk, so even if they are getting more reward, they are unhappy. Think about pension plans, the investors for pension plans have a goal to grow the pension plan’s money, but not with a lot of risk since they will need to pay out retirement benefits. We can model a consumer’s happiness with utility, a measure of overall benefit the person feels.
We are going to model utility as a measure where higher return is good, but higher variance is bad. We will also add a coeffecient term to represent people having different sensitivity to risk, the higher this term (we will use A), the more sensitive an investor is/the less utility they receive with risky investments.
Equation
2
E(r) = Expected Return
A = Coeffecient of Risk Aversion
σ
2
= Variance
Challenge