Calcite | Level 5

## VaR and Optimization Code

Hello,

I am having trouble with coming up with the correct code to find VaR and
the optimal solution using proc optmodel. I have attached below the code I am using for a mean/variance approach to the optimal solution, but I'd like to use the mean/VaR approach as well. The code includes the expected returns and the
covariance matrix.

Could anyone help me in modifying my code to include finding VaR at the .05 level and to find the optimal allocation to each region?

proc optmodel;
/* x1, x2, x3 amount of available resources allocated to each of the three
region */
var x{1..3} >= 0;

num coeff{1..3, 1..3} = [0.0168011611 0.0164661727 0.0179412346
0.0164661727 0.0254631245 0.0178165208
0.0179412346 0.0178165208 0.0289536036];

num r{1..3}=[-0.0903476 -0.1342186 -0.1498193];

/* Minimize variance */
min f = sum{i in 1..3, j in 1..3} coeff[i,j]*x*x;

/* subject to the following constraints */
/* Total resources in 2006*/
con BUDGET: sum{i in 1..3}x = 56288890475;

solve with qp;

/* print the optimal solution */
print x 20.0;

Thank you so much for your help,

Steve Leon
Calcite | Level 5

## Re: VaR and Optimization Code

Hi Steve,

I am not exactly sure what you are doing in the codes but I cannot find the expected return statement/constraint anywhere. Can you advise me on your product list as I think VAR should be computed external of this optimization run.

Regards,
Murphy
Discussion stats