代写 R matlab graph Go Optimization Methods in Finance

Optimization Methods in Finance
ASSIGNMENT 1: Portfolio Optimization: Mean Variance and MAD DEADLINE: Thursday, 14 February 2019 @ 10pm (22:00) electronically via Learn
January 31, 2019
This assignment follows on from the last lab session (week 3).
Download the comma-separated value file all.csv from Learn. Have a look at it (for example with Excel): it includes monthly closing values of 7 major stock market indices, namely Dow-Jones, FTSE (UK), CAC (France), Dax (Germany), Nikkei, HSI (Hongkong), BOVESPA (Brazil) as well as monthly prices for Gold for the 8 years from January 2008 to January 2016.
Your task is to implement a variety of Portfolio optimization models, test them on this data and compare the results.
1. Mean-Variance Model.
(a) The data file all.csv can be read with the Matlab function csvread. Have a look at the help page for this function, there are options to skip over the first row and column which you should use. You should end up with a table of 97 rows (each month from Jan 2008 – Jan 2016) and 8 columns (the 7 indices and gold).
(b) Convert the data into yearly return rates for each of the years 2009–2016. In order to do this you should only take the 9 rows corresponding to a date in January and convert them into the 8 yearly returns. You should end up with a 8 × 8-matrix.
(c) Use these to work out the geometric mean yearly returns. For the estimate of the covariance matrix use all the monthly data points, ie. use the whole 97 × 8 matrix, calculate 96 × 8 matrix of monthly returns and use these to build an estimate of the covariance matrix. [3]
(d) Set up the Mean-variance optimization model (EP2) in cvx and solve it for a sensible range of values of
R. [5]
(e) Plot the efficient frontier R(σ), i.e. return against standard deviation and also the asset weights as a function of R (using Matlab’s area function). [12]
(f) Interpret the results. Are they surprising? Why does the model invest in the assets that it has chosen? How can you explain the changes of the portfolio as R changes. [25]
2. Risk-adjusted Return model.
(a) Change the model to the “Risk-adjusted Return” model (EP3) from the lecture, ie. the model should
solve
maxμTx−λ·Var(x), s.t.eTx=1,x≥0
(b) Solve this model for a range of sensible values for λ, plot the efficient frontier (μT x against σ) and the asset allocation against λ. Do the plots for parts 1(e) and 2(b) – efficient frontiers and asset allocations – coincide? Discuss! [15]
3. Different estimates for the covariance matrix.
Go back to the model of Task 1. Remove the short sell constraint (x ≥ 0) and investigate the effect of
different ways of estimating the covariance matrix
(a) Print the efficient frontier for the modified model (Since the asset allocations now contain negative
entries the area-plot is not all that useful anymore). [4] 1
[5]

(b) Now build the covariance using just the same 8 × 8 matrix of yearly returns as you did for the mean returns. Again remove the short sell constraint and plot the efficient frontier. [4]
(c) You should observe a strange behaviour in the second case. Can you comment on why this is the case?
[15]
4. Mean-absolute deviation model.
(a) Set up the model so that it minimizes MAD(x) subject to the average return being larger than a given R. The average return should be measured by the geometric mean. The MAD(x) should be based on the 96 monthly returns.
Details:
• You should introduce variables rett, t = 1, …, T in your model that measure the return of portfolio x in month t only. You will also need a variable ret = 1 􏰀 rett that measures the average return
Tt
of the portfolio over all time periods. Note that ret is the arithmetic mean.
• Mean-absolute deviation can be expressed as
MAD(x) = 1 ∥ret − ret · e∥1 T
whereret∈IRT ande∈IRT isthevectorofallones.
cvx allows you to use the 1-norm (norm(·, 1) in Matlab) directly in the objective function of a model.
[4]
(b) Again produce a graph of the portfolio return μT x against its risk (now measured by MAD(x)) for a sensible range of values of R (the Efficient Frontier). Also plot how the optimal asset allocation x changes with R (using Matlab’s area function). [8]
Notes
You should hand in (electronically on Learn)
• A matlab file mvo.m that solves part 1: it should read in data from all.csv, solves model (EP2) for a range of values of R and produces a plot of the efficient frontiers and a plot of the change of asset weights as R changes.
• A matlab file mvolam.m that solves part 2(a). The same as before but it now implements formulation (EP3).
• A matlab file mvo2.m that solves part 3(b): No short sell constraint and covariance matrix build from yearly
returns.
• A matlab file mad.m that solves part 4(a).
• A document that includes
– For Task 1, the plots (R(σ)) and asset weights x against R) for Task 1, and your answers to part 1(f).
– The plots for Task 2(b) (again σ(R) and asset weights x against R) and your answer to 2(b).
– Your answer to 3(c). If you refer to plots of the efficient frontiers from 3(a)/(b) those should be included.
– The plots (Efficient frontier and asset weights x against R) for part 4(b). No discussion/description is needed for this part.
• Note that the assignment appears twice on Learn: Once as a Learn assignment and once as a Turnitin assignment. Please upload everything (Matlab files and the document) under the Learn assignment and additionally the document under the Turnitin assignment.
2