Description

MATLAB code

Results

Table 1. Solution of the Problem

Table 2. Optimal point

Figure 1. Efficient Frontier

Figure 2. Components of Optimal Solution Exceeding Lower Bounds

 

 

Description

Problem 1 (see Formal Problem Statement) in MATLAB Environment is solved with riskconstrparam PSG subroutine.

 

Main MATLAB code is in file CS_Drawdown_Deviation_Maximum_Single_Path.m.

Data are saved in file CDaR_Single_Path_data.zip.

 

MATLAB code

Let us describe the main operations. To run case study you need to do the following main steps:

 

In file CS_Drawdown_Deviation_Maximum_Single_Path.m:

 

Read annualized rates of returns of instruments in the portfolio over the time period [0,J]:

 

[header_matrix, matrix_arr] = read_matrix('matrix_annualized_returns.txt');

d = matrix_arr(1,2:size(matrix_arr,2)-2)';

 

Read scenarios of rates of returns of instruments in the portfolio:

 

[header_matrix, matrix_arr] = read_matrix('matrix_scenarios.txt');

H2 = matrix_arr(:,2:size(matrix_arr,2)-2);

 

Specify a set of values of parameter (upper bound on risk) for which runs should be conducted:

 

Parameters = [0.05 0.06 0.07 0.08 0.09 0.1 0.11 0.12 0.13 0.14 0.15 0.16 0.17];

 

Calculate number of values of the parameter:

 

N_Par = length(Parameters);

 

Read lower bounds on decision variables:

 

[header_point, point_arr] = read_point('point_lowerbounds.txt');

lb = point_arr';

 

Read upper bounds on decision variables:

 

[header_point, point_arr] = read_point('point_upperbounds.txt');

point_variables = strread(header_point, '%s');

ub = point_arr';

 

Set solver options:

 

options.Solver = 'VAN';

options.Precision  = 6;

 

Set graph options:

 

options.PlotGraph = 'On';

options.PlotType = 1;

 

 

Optimize problem 1 for specified  values of the parameter, and build efficient frontier (Figure 1):

 

[Objectives, Parameters, Points, GraphHandle]=riskconstrparam ([],'drawdown_dev_max', [], [], [], [], ...

   [], H2, [], [], d,  Parameters(1), [], [], [], [], lb, ub, 'r', [],[],N_Par,...

   [], [], Parameters, [], options);

warning('on', 'all');

 

 

 

Display the solution (Table 1 and Table 2):

 

fprintf('Points: %d\n', length(Parameters));

fprintf('Parameters (Risk)  Objectives (Return)\n');

fprintf('%14f\t%14f\n', [Parameters; Objectives]);

fprintf('Optimal Points:\n');

disp(Points');

 

Build graph showing components of the optimal solution corresponding to the first value of the parameter. Only components exceeding lower bounds are shown in Figure 2. Here is the code for generating Figure 2:

 

clear x;

clear y;

i = 0;

for j=1:1:size(H2,2)

  if Points(1,j)> lb(j)

       i = i+1;

       x(i) = point_variables(j);

       y(i) = Points(1,j);

  end

end

figure

bar(y,0.1,'c');

 set(gca,'XTick',1:1:length(x));

hAxes = gca;

set(hAxes, 'XTickLabel', x);

grid on;

xlabel('Components of Optimal Solution Exceeding Lower Bounds');

ylabel('Componnents Values');

title('Point #1: Drawdown Deviation Maximum = 0.05. Components of Optimal Solution Exceeding Lower Bounds');

 

Results

Table 1. Solution of the Problem

 

Points: 13

Parameters (Risk)  Objectives (Return)

     0.050000              0.353630

     0.060000              0.436715

     0.070000              0.511953

     0.080000              0.571342

     0.090000              0.618621

     0.100000              0.661458

     0.110000              0.697199

     0.120000              0.724282

     0.130000              0.747679

     0.140000              0.769130

     0.150000              0.787568

     0.160000              0.799176

     0.170000              0.809763

 

Table 2. Optimal point

 

 Columns 1 through 5

 

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.70471971904604

  0.20000000000000   0.39371781187216   0.80000000000000   0.55183431974612   0.55384407995755

  0.20000000000000   0.33311749159197   0.70221494213013   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.26375847077507   0.35548564349222   0.41336726927105

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.40347623926520   0.65128033382228

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.41601700357033   0.22950528892530   0.20000000000000   0.20000000000000

  0.69248077945411   0.65451242932194   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.58877451865112   0.65599893970045   0.80000000000000   0.80000000000000

  0.46944681192859   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.79583383457828   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.57541578713913   0.44291512471615   0.80000000000000   0.55224947029823   0.80000000000000

  0.20000000000000   0.20000000000000   0.24938656267178   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.20000000000000   0.25527420350623   0.35140620649144   0.42588835713564

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.33765621059130   0.68935897482574   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.35196254571170   0.41512437484287

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.20000000000000   0.20000000000000   0.63168332032737   0.80000000000000   0.80000000000000

  0.43587319649619   0.56483701897524   0.50654096906653   0.71737364816617   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.31416346783933   0.46509220039227

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.48107281316858   0.77230622348240   0.80000000000000   0.80000000000000   0.80000000000000

  0.26029166296605   0.47601767618542   0.71588194470962   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.63604220502734   0.80000000000000   0.80000000000000   0.56140571120448   0.74640748851212

 

 Columns 6 through 10

 

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.76555082735132   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.29765243840441   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.66854343253801   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.53901398580269   0.80000000000000   0.80000000000000   0.80000000000000

  0.70508555245885   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.65632192304271   0.80000000000000   0.80000000000000

  0.20000000000000   0.30826410429994   0.31341005566366   0.48799253878080   0.59044327967974

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.69427016241354   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.59356707712447   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.36010685912842   0.79751840139028

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.44000361662711   0.41397324064195   0.41111933665404   0.68871990764869   0.58322709036881

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.62093341069353   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000   0.20000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000   0.80000000000000

  0.27559029063672   0.43694650470352   0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.56480013007944   0.30577053859921   0.59624887955135

 

 Columns 11 through 13

 

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.32179454910693   0.53642783585818

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.20000000000000   0.20000000000000   0.20000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.73428482910596   0.80000000000000   0.80000000000000

  0.23572301948139   0.41101897161207   0.71638367099817

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.63652604445989   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.80000000000000   0.80000000000000   0.80000000000000

  0.72619581330643   0.80000000000000   0.80000000000000

 

Figure 1. Efficient Frontier

 

_amg2313

 

 

Figure 2. Components of Optimal Solution Exceeding Lower Bounds

 

_amg2314