matlab代写 The University of Sydney School of Mathematics and Statistics

The University of Sydney School of Mathematics and Statistics

Computer Project

MATH2070/2970: Optimisation and Financial Mathematics

Web Page: http://www.maths.usyd.edu.au/u/IM/MATH2070/ Lecturer: Anna Aksamit and Georg Gottwald

Semester 2, 2018

Due on 5.00pm Thursday 1st November via TurnItIn
Late assignments are not accepted without prior arrangement well before the deadline!

You must attach a scanned copy of the signed cover-sheet to the front of your assignment (see over)!

This is mostly a computational project so you must submit all computer programs with your project formulations, descriptions and outputs. Assessment will be based on: accuracy, programming and presentation.

MATH2070: Do all questions except Questions x for x ≥ 7. MATH2970: Do all questions.

In this assignment you will be analyzing real stock market data downloaded from Yahoo!Finance. The file DowPricing_2004_2010.csv which you can download from Ed, contains the daily closing prices of the 30 stocks which make up the Dow Jones Industrial Average Index. Prices are recorded on a (business)-daily basis between 31/12/2003 and 29/12/2010. This includes the Global Financial Crisis (GFC) which we locate here in time from very roughly from 03/01/2007 – 31/05/2010. We define the peak of the GFC as the period 02/09/08–01/06/09, and define a pre-GFC and post-GFC period from 03/01/07 – 29/08/2008 and from 01/06/09 – 31/12/10, respectively. Recall that Lehman Brothers filed bankrupt protection on September 15, 2008.

There are two particularities with this time series:
(1) Visa’s share price starts at 19/3/2008 on Yahoo!Finance.
(2) Dow and DuPont have recently merged and are now trading as a new entity (DWDP) with a short trading history.
Therefore only consider the 28 stocks without Visa and Dow & DuPont.

All prices are here in US dollars.

Correlations and the covariance matrix

1. Export the data into Matlab using csvread and/or readtable. This question investigates the correlations of the return rates. When analyzing return rate data one has several choices. A commonly used variable is the logarithmic change of price or the so called log return rate: Let Yi be the price at time i, then consider Ξi = log Yi − log Yi−1 (wrt the natural base). An advantage of this variable to quantify the return rate is that it insensitive to (constant!) deflation factors (why?).

  1. (i)  Calculate the maximal correlation between the Ξi, and plot the two stock prices associated with the highest correlation as a function of time (excluding Visa and/or Dow & DuPont (see above))
  2. (ii)  Calculate the minimal correlation between the Ξi, and plot the two stock prices associated with the smallest correlation as a function of time (excluding Visa and/or Dow & DuPont (see above))

Copyright ⃝c 2018 The University of Sydney 1

  1. (iii)  Visualize the correlation matrices for the period before and during the GFC (separating into pre/peak/post periods). (You may use Matlab’s command imagesc). Can you spot differences?
  2. (iv)  Plot the histogram of the correlation coefficients ρij for the four periods. Comment on your result.
  3. (v)  Play with the data and try to identify interesting particularities. This sub-question will not be marked – just an encouragement to have some fun.

Portfolio Theory Consider for this question and the required plots only the GFC period 03/01/2007 – 31/12/2010. However, you might need to investigate the “normal” non-GFC period as well to justify any claims/interpretations you want to draw form your results.

  1. Determine which investors short sell in this market consisting of the stocks used to calculate the Dow Jones Index and which stocks they short sell. Are there any stocks which no-one will short sell or which everyone will short sell?
  2. Carry out the following computational tasks for an optimal portfolio P∗ consisting of the 28 stocks included in the Dow Jones for an agent who wants to invest $200,000 and has a risk factor of t = 0.15 (excluding Visa and Dow & Du Pont).
    1. (i)  Obtain the dollar investment in each of the stocks and obtain the corresponding expected return and risk of P ∗.
    2. (ii)  Obtain the μσ-plane graphical representation and include (all on the same graph):
      1. (a)  The stocks of the Dow Jones
      2. (b)  The minimum variance and efficient frontiers. Use a t-range |t| ≤ 0.35 for your display.
      3. (c)  A plot of 1000 random feasible portfolios satisfying |xi| ≤ 20 (for each of the 28 stocks)

        and σi ≤ 0.05 for i = 1,…,1000.
        You might notice that the random points occupy some region well-separated from the minimum variance frontier (MVF) – comment on this and explain why (This is a/the major part of the question).

      4. (d)  The indifference curve of an investor with t = 0.15 and their optimal portfolio P∗.

4. Adding a Riskless Cash Fund: Suppose now that a riskless cash fund P0 is also available to invest in. The risk free rate was r0 = 0.05 before the GFC and was lowered to r0 = 0.0025 in December 2008, for both lending and borrowing.

  1. (i)  Obtain the investor’s new allocation of their investment to the (now) 29 funds. State clearly investment in the riskless cash fund.
  2. (ii)  Describe in detail the Capital Market Line and the tangency portfolio. What can you say about the tangency portfolio; explain your result.
  3. (iii)  Assuming that the world only existed out of the 30/28 stocks traded in the Dow Jones contingent. What data would you like to have to determine the market portfolio and how would you then compute it? Unfortunately I was not able to get the data to approximate the market portfolio.

2

Captial Market Theory

5. The Capital Market Line: Make a new μσ-plane graph showing the riskless cash fund, tangency portfolio, and the Capital Market Line relative to the risky efficient frontier. Calculate the investor’s new optimal portfolio. If the original stocks have a net worth of $100 million, estimate (to the nearest $0.1 million) the total value of each stock.

6. The Security Market Line: Compute the β’s of all relevant stocks and assets in this project and clearly display them on the Security Market Line. Comment on the result and decsribe what portfolio theory would recommend an investor to do.

Empirical Orthogonal Eigenfunctions

Scientists are often faced with the challenge of extracting useful information from large data sets. In this assignment the data set is a time series of the stock return rates of the 30 stocks which make up the Dow Jones index (well, only 28 are actual occurring time series). An example from a very different context could be observational data of the sea surface temperature in the Pacific ocean over time. We might ask the question: are there any underlying structures which dominate in some sense the system? Or phrased differently, rather than using the full data set and all available observations to describe the phenomenon, can we describe the system at each time instance by just a few structures or factors the coefficients of which then vary in time? In the context of the sea surface patterns, these structures would be large scale regimes such as El-Niño patterns which dominate the ocean dynamics in the Pacific (on a certain time scale). It turns out that this can be posed as an optimization problem.

7. Mathematically, we seek an approximation of a time series ut for u ∈ Rd. Here t = 1, · · · , N denotes the discrete times and typically d ≪ N. In the context of the stocks price data of the Dow Jones Index we have u ∈ R30 (or rather here u ∈ R28). Given an orthonormal basis φj ∈ Rd with φTi φj = δij, at each time instance t we can decompose

d
ut =􏰀ctjφj ,

j=1

for some real coefficients cij. Here we order the basis according to descending eigenvalues λj. All the time dependency is now in the time-varying coefficients atj ∈ R. We now seek an orthonormal basis φi such that if we truncate using only p < d modes to express u, i.e. if we approximate ut by

p

u ̃(p) =􏰀ctjφj , t

j=1

we make the least error. This definition obviously depends on the definition of “error”. An optimal basis called empirical orthogonal eigenfunctions or Karhunen-Loeve modes or principal components, is found by minimizing the l2-error

N

ε2(p) = 􏰀 ||ut − u ̃(p)||2 , t

t=1
and is found by solving the following constrained optimization problem

minimize ε2 (p) subject to φTi φj = δij

(i) Solve the constrained optimization problem and show that solutions are given as eigenvec- tors of the matrix AAT ∈ Rd×d where Ait = uit.

3

.

8.

  1. (ii)  Show that for the optimal basis ε2 (p) = 􏰂dj =p+1 λj .
  2. (iii)  It is said that the optimal basis vectors explain most of the variance of the data. Explain.
  3. (iv)  It is pertinent to note that EOFs are not capable of detecting any temporal correlations, i.e. picking up that, for example, an increase of the stock return rate of Goldman & Sachs on average lags behind a decrease of the stock return rate of of Walt Disney. Show analytically why this is so.

Apply the framework from Question 7 to the Dow Jones stock data.

  1. (i)  Plot the ordered spectrum λi for i = 1, · · · , 28 (again excluding Visa and Dow & Du Pont). Why is it tempting to say that by only using a few modes we are capable of explaining most of the stock market data? Plot the spectrum for the non-GFC period and for the three periods of the GFC (pre/peak/post).
  2. (ii)  Plot the first two empirical orthogonal eigenfunctions for the whole data set, the time periods before the GFC and for the pre/peak/post periods of the GFC.
  3. (iii)  Investigate quantitatively how well the first three EOFs describe the data by projecting the data onto the first three EOFs. Do this for the 5 sets of EOFs. In which projection can you detect the GFC best? Comment on the result.
  4. (iv)  Can you find any economic interpretation of the EOFs; I couldn’t (this question does not earn marks, but it is fun to think about this).

4

The University of Sydney School of Mathematics and Statistics

Assignment Cover Sheet

MATH2070/2970: Optimisation and Financial Mathematics

Web Page: http://www.maths.usyd.edu.au/u/IM/MATH2070/ Lecturer: Anna Aksamit and Georg Gottwald

Semester 2, 2018

Family Name …………………………………………………………………………

Given Names ……………………………….. SID ………………………………..

Legitimate cooperation between students on assignments is encouraged, since it can be a real aid to understanding. It is legitimate for students to discuss assignment questions at a general level, provided everybody involved makes some contribution. However, students must produce their own individual written solutions. Copying someone else’s work is plagiarism, and is unacceptable.

I certify that:

• I have read and understood the University of Sydney Student Plagiarism: Coursework Policy and Procedure at

http://sydney.edu.au/policies/showdoc.aspx?recnum=PDOC2012/254&RendNum=0.
• this assignment is all my own work, and that no part of this assignment has been copied from

another person.
• I have not allowed my work to be copied by another person.

Signature …………………………………. Date …………………………………. The University may impose severe penalties for plagiarism

This part to be completed by the marker: Grand total out of 40 ……………………………..

5