这个Assignment是通过研究多种投资产品来预测收益

Optimization Methods in Finance

ASSIGNMENT 2: Scenario Generation and Stochastic Programming

DEADLINE: Monday, 16 March 2020 @ 5pm

electronically via Learn

1. Download the file retm.mat from Learn. This defines a 100, 000×8 matrix retm of random returns for 8 assets

(each row representing one random value – you can load this in Matlab with the command load retm.mat):

(a) Convince yourself that the assets geometric means and co-variances are the same as for Assignment 1.

(b) Plot the return of the first asset again the second asset (i.e. first against second column of the retm

matrix) to see that the joint distribution is evidently not multivariate normal. [no marks]

2. Assume you would like to invest your budget of B =£10, 000 into the 8 assets. After one time period (month)

you are required to pay a liability of L =£10, 100. That is, you are required to get a 1% return on your

investment to cover the liability. Let x ∈ IRn (x ≥ 0,

P

i

xi = 1) be your investment decisions (which fraction

of your budget to invest in each asset). That is your total investmemnt into asset i is B · xi

.

Let rs be the s-th row of the retm-matrix. Treat this as one possible scenario s of asset returns. That is the

value of your investment in scenario s is B · r

>

s x and the shortfall (difference to meeting your liability) is

sfs = max{L − Br>

s x, 0} (1)

(a) Show how to formulate the problem of minimizing the expected shortfall Es[sfs]. Show that this fits

into the stochastic programming framework. [10]

(b) Write a CVX model minesf.m that finds the investment decision x that minimizes the expected shortfall

over a given set of scenarios. Test this model with the first 10 rows in the matrix.

NOTE: do not try to solve the model with all 100,000 scenarios: this will likely exceed the

capabilities of Matlab and CVX [20]

(c) With the investment decisions that you get from part (2b) calculate the expected shortfall over all

100,000 scenarios. Note the difference from the expected shortfall that has been predicted by the model.

This is the difference between in-sample and out-of-sample:1 The in-sample expected shortfall (ie. over

the sample of scenarios that you have used as input to your optimization model) is significantly lower

than the out-of-sample shortfall (ie. evaluated over data that comes from the same distribution, but

was not seen by the model).

Report in-sample and out-of-sample expected shortfall [5]

(d) Try again by optimizing over the first 1000 scenarios. Again report in-sample and out-of-sample expected

shortfall. [5]

3. The setup for the remainder of this section is that you would like to come up with an investment decision that

gives as low an out-of-sample expected shortfall as possible. However you are assuming that you cannot

solve the above CVX problem for more than 10 scenarios.

The solution to 2(b/c) would count but not the solution to 2(d) – more than the allowed number of scenarios.

The solution to 2(d) however can be used as a benchmark to show what is achievable. [Total 60]

You can explore various avenues:

(a) Attempt to find an optimal/good 10-scenario discretization, ie. 10 scenarios which to use an

input to the above CVX model minesf.m that result in an as-low-as-possible out-of-sample expected

shortfall. You may for example try clustering (using the kmeans2.m Matlab script from Lab Session 6),

or some other way of finding the scenarios (eg. trial and error)). Note that CVX is not able to solve the

moment-matching problem since that is not convex.

You should describe what you have done and the reasoning for doing so. You should also comment on

the effort required in coming up with the scenarios (ie. how much work would it be in general to apply

your method). [30]

(b) Solve the problem by stochastic gradients: ie. choose a trial investment decision x0, calculate

the shortfall Q(x0, rs) for this trial decision and a specific return scenario rs, calculate the gradient

∂

∂x0

Q(x0, rs) for the specific scenario and adjust your trial decision accordingly. The following steps

should help you

1The terminology is slightly mis-applied here. in-sample is the performance predicted by the model ie. over the data that was seen

by the model. Out-of-sample refers to the performance over unseen data from the same distribution, usually this is the performance of

the investment decision if implemented in real life (or over a larger unseen data set). In the remainder of the assignment sheet I will

refer to the out-of-sample performance as the exepcted shortfall when evaluated over the complete 100000 scenario data set, although

some of that (for 3(b) even all of that) has been seen by the model.

1

• You can adjust the Matlab scripts RecCost.m and StochasticGradient.m from Lab Session 5.

• In RecCost.m you need to evaluate sfs in (1) as a function of x and rs and its derivative with respect

to x.

• In StochasticGradient.m you need to do a projection onto the set {x :

P

i

xi = 1, xi ≥ 0} (the

unit simplex). Since now x ∈ IR8 you cannot use the formula from Lab Session 5 (which was only

valid in IR2

). However on Learn you can download the Matlab function proj unit simplex(x).m

that does the projection.

In principle you can do the projection by setting up an optimization problem in CVX. For the purpose

of this question, however, this takes too long – not because of the optimization itself, this should be

very fast, but because of CVX’s overhead which takes some time to get started.

• For the random scenarios to be used for the stochastic gradient method, you can either sample from

the 100000 scenarios or do a complete sweep (ie. use all scenarios in order). You can even do two

or three sweeps. This should take very little time (well under 1 min).

Again report on the best investmemt decision obtained in this way and the expected shortfall this

achieves over the 100,000 scenarios in retm.mat. Also comment on the computational effort compared

to the scenario based approaches under 3(a). [30]

Submission

You should hand in (electronically on Learn):

• The Matlab file minesf.m that solves part 2(b).

• Any Matlab files that you have used for 3)

• A document that contains

1. The optimization model in 2(a)

2. The in-sample and out-of-sample expected shortfall for 2(c)/2(d).

3. A description of what you have done for 3).

In addition the document should also be submitted in on Turnitin.

The answer to 2(a) requires to write mathematics. If you don’t know how to use Latex and find it too cumbersome

with a word processor, you can write the answer out by hand. In that case please hand-in the sheet of paper

(containing 2(a) and only 2(a)) marking clearly your name and matriculation number to MTO (JCMB room

5211). You can also submit a scan of the sheet on Learn as long as it is less than 1MB in size.

2

EasyDue™ 支持PayPal, AliPay, WechatPay, Taobao等各种付款方式!

**E-mail:** easydue@outlook.com **微信:**easydue

**EasyDue™是一个服务全球中国留学生的专业代写公司
专注提供稳定可靠的北美、澳洲、英国代写服务
专注提供CS、统计、金融、经济、数据科学专业的作业代写服务**