Draw the cumulative return and drawdown

Assignment Help Python Programming
Reference no: EM132817900

Problem 1: Portfolio Optimization

Suppose we want to design a portfolio among following assets:

StocksArray = c(' MSFTY AAPL',' AMZN',' FB',' GOOGY GOOGLY JNJ',' JPM',' VY PG',
'T',' UNH',' MA',' HD',' INTC',' V ZY KO',' BAC',' XOM',' MRK',' DIS',' PFE',
'PEP',' CMCSA',' CV X',' ADBE',' CSCO',' NVDA',' WMT',' NFLX',' CRM',
'WFC',' MCD',' ABT',' BMY',' COST',' BA',' C',' PM',' NEE',' MDT',' ABBV',
'AMGN',' TMO',' LLY',' HON',' ACN',' IBM')

The period we consider is from 01-01-2014 to 31-12-2020. In this problem, you are allowed to use any package.

(a) Please split the data set into training set and test set with 75% data in training set and 25% data in test set.

(b) Please use training data to construct the following portfolios:
• Uniform portfolio.
• Inverted volatility portfolio
• Quintile portfolio.

Apply them on test data, draw the cumulative return and drawdown. (your budget starts from 1 dollar and assuming risk-free rate is zero.)

(c) Estimation of mean vector and covariance matrix is a critical problem in portfolio optimization. Let ∑. be the sample covariance matrix. Instead of using ∑. to construct the portfolios, here we would use

. = ρ∑. + (1 - ρ) Trace(∑.)IN/N

where N is the number of asset, IN is the identity matrix of order N, and ρ is a real number between 0 and 1. Try different values of ρ in {0, 0.2, 0.4, 0.6, 0 8, 1}, construct the global minimum variance portfolio (GMVP)

minimize wT∑w
subject to 1Tw = 1, w ≥ 0, and compute the Sharpe ratio on test set.

(d) In this subproblem, instead of estimating E via sample covariance matrix, we assume E is one of M (known) covariance matrices ∑(k) ∈ Sn++, k =1,... , M, in which M = 10 and ∑(k) is computed as

∑(k) = k-1/M-1∑ + M-k Trace(∑) IN/N

where ∑ is the sample covariance matrix, N is the number of asset, and IN is the identity matrix of order N.

We will choose the portfolio weights in order to maximize the expected return, adjusted by the worst-case risk

minimize  -μTw + λ maxk=1,...,M (wT(k)w)
subject to 1Tw = 1.

Use CVX to solve it, apply the portfolio on test set, then show the Sharpe ratio, annualized return and average drawdown for different λ ∈ {0, 1,4,10,20}.

Problem 2: Gradient Descent

Consider a linear factor model:
xt = α + βft + ∈t, t = 1, 2,... T,

where xt ∈ RN. We estimate α and β by solving the following least-squares problem via gradient descent

minimize     ∑Tt=1 ||Xt - α - βft||2
α,β

For the vector of log-returns xt, we'll use

Stocks = c(MSFT' AAPL',' AMZN',' KB' ,GOOG')

starting from 2016-01-01 to 2019-12-31. For the factor ft we'll use the log-return of S&P500 index in the same period. Compare the estimates you obtained to that of CVX.

Hint The objective function is a function of α∈RN and β∈RN

So, there are 2N variables (α1, , αN, , β1,.....βN) to optimize. Given a point (αt, βt), a gradient descent step updates α and β as

1176_figure.jpg

You should choose step size n and stopping criteria properly so that your algorithm converges to the optimal.

Need to use R language with CVXR package.

Attachment:- Portfolio Optimization.rar

Verified Expert

The solution provided were Rstudio codes of financial modelling. It involved optimization of equally weighted portfolio, quintile portfolio as well as Sharpe ratio, gradient descent of least squares inequality.The data of several assets was extracted from yahoo.finace on S&P 500.

Reference no: EM132817900

Questions Cloud

Compute ending balance of the deferred tax asset : Compute ending balance of the deferred tax asset or liability account in 2010, 2020, 2021. Calculate income tax expense in 2019, 2020, 2021.
Research four types of literacy assessments : Research four types of literacy assessments and create a matrix including the following: Two formal and two informal literacy assessments and rationales.
What do you feel you have left to learn : As this program concludes, discuss your excitement and apprehension as you prepare for student teaching. What do you feel you have left to learn?
How would tax effects differ if susan rental building basis : Find How should Susan structure the transaction if she believes her marginal tax rate will increase in the future? What is the recognized gain or loss
Draw the cumulative return and drawdown : Apply them on test data, draw the cumulative return and drawdown - choose the portfolio weights in order to maximize the expected return, adjusted
Identify a learning need and target audience : Introduce your topic selection and include at minimum your topic, title of your project, and a 2-sentence summary. Then, based on your topic selection.
Record the journal entry for the recovery : Record the Journal Entry(s) for the recovery. Richard Company wants to do business with us and has agreed to pay ABC $6,000 of the previous amount owed.
How knowing about survey design and quant analysis useful : Write a 1-2 page reflection on how knowing about survey design and quant analysis might be useful in your professional practice of higher education.
How many equivalent units would be used to allocate : 3,500 units in beginning work in process inventory, how many equivalent units would be used to allocate conversion costs to work in process ending inventory?

Reviews

len2817900

3/5/2021 11:35:13 PM

Need to have some help on the problem solving. Need to use R language with CVXR package.

Write a Review

Python Programming Questions & Answers

  Construct a python function that returns title case version

Construct a python function that returns the title case version of a string, according to the rules above. Only use upper function and not title function

  Plot the optimal solution on the x-axis

CSE 410 - AI: Homework - Plot the optimal solution on the X-axis and the two heuristics on the Y axis. Describe two heuristics for the slide problem

  Write the code using python to create a NAT engine

By using python write the following code to create NAT engine. Create an application that runs a listener or sorts. It will listen for incoming network packets

  Calculate the amount of money a person would earn

Write a program that calculates the amount of money a person would earn over a period of time if their salary is one penny the first day, two pennies.

  Create your own function that illustrates a feature

Create your own function that illustrates a feature that you learned in this unit. The function must take at least one argument.

  Calculate the monthly average prices of apple stock

Calculate the monthly average prices of Apple stock from 1984 to 2013. A file of Apple's daily stock's prices will be given to you.

  Calculate the nth power of 2 starting from 1

For the integer numbers ranging from 2 to 2n where 2n is less than 10000, please calculate and print out their total. Calculate the nth power of 2 starting.

  Compute the average miles per gallon obtained on a trip

Write a program that will calculate the average miles per gallon obtained on a trip. Input the amount of gas used and the number of miles driven.

  Read the file and output its contents on the screen

Prompt for and read a file name from the user. Read the file and output its contents on the screen with the characters reversed.

  Evaluate and apply aspects of data science applications

Evaluate and apply aspects of data science applications and their use and evaluate various statistical and computational techniques for analysing datasets

  Write a python program to list the data types used in this

Write a Python program to load the exact data into a data frame df2016. Write a Python program to list the data types used in this data frame.

  Write the pseudo code and then code it in python

Write the pseudo code and then code it in Python. Write a function that has number of tosses as an input parameter. As usual, screen copy your code and results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd