Question: import numpy as np returns = np.array([[2.8, 7.7, 5.3, 10.7, -4.9, 8.3, 1.7, 1.5, 0.8, 3.1, 5.9, 4.2], [18.3, 3.9, 2.2, -0.6, -8.3, 8.6, 7.5,

 import numpy as np returns = np.array([[2.8, 7.7, 5.3, 10.7, -4.9,
import numpy as np
returns = np.array([[2.8, 7.7, 5.3, 10.7, -4.9, 8.3, 1.7, 1.5, 0.8, 3.1, 5.9, 4.2],
[18.3, 3.9, 2.2, -0.6, -8.3, 8.6, 7.5, -7.5, 7.3, -8.0, 1.7, -0.3],
[27.2, -3.1, 3.2, 16.0, -8.2, 8.8, 0.6, -4.4, -4.1, 7.6, 5.2, 1.8],
[5.5, 4.5, 9.7, 5.6, -12.4, 13.1, 7.6, -1.7, 7.3, 11.1, 7.7, 9.9],
[19.0, -14.4, 0.8, 8.7, -8.7, 9.5, -4.6, -0.4, -1.4, 18.3, -3.7, -0.4],
[21.2, 46.7, 12.4, 1.1, 6.7, 20.3, 17.5, -5.8, -0.2, -4.7, 1.3, 7.1]])

Name(s) Question 1 In 1]: import numpy as np returns = np.array([[2.8, 7.7, 5.3, 10.7, -4.9, 8.3, 1.7, 1.5, 0.8, 3.1, 5.9, 4.2), [18.3, 3.9, 2.2, 0.6, -8.3, 8.6, 7.5, -7.5, 7.3, 8.0, 1.7, 0.3) [27.2, 3.1, 3.2, 16.0, 8.2, 8.3, 0.6, 4.4, 4.1, 7.6, 5.2, 1.8). [5.5, 4.5, 9.7, 5.6, -12.4, 13.1, 7.6. -1.7, 7.3, 11.1, 7.7, 9.9), (19.0, 14.4, 0.3, 8.7, -8.7, 9.5, 4.6, 2.4, -1.4, 18.3, -3.7, -0.4) [21.2, 46.7. 12.4, 1.1. 6.7, 20.3, 17.5, -5.8. -8.2, -4.7, 1.3, 7.1]]) The above array, returns is a year's worth of monthly retums for 6 stocks. Each row corresponds to a stock and each column to a different month, which you can see ty examining the shape of the array In [2] : returns.shape Out[2] (6, 12) Supppose we held a portfolio of these stocks with the following weights: 20% 10%, 5% 15% 20% 30% Create a numpy atray out of those stocks called weights and use the dot product operator to calculate monthly portfolio returns Hint enter weights as decimals and make sure you put the arrays in the right order in the dot product so the dimentions agree. In 1: In 11 Suppose you had equal wechts in each of the 6 portfolios. Without using a dot product, calculate the portfolio return for the 12 months. Hint. Think about what you are doing when you calculate a returns of portfolio when weights are equal We used a method in class that does the same thing To 10 Suppose we want to create an array of all of the positive returns from the returns array. Create a new array called pos returns

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!