Optimization problem - Sequential Approximation - f(x(i)) = x(i) * E[r(i)|rp(x)<=VaR] - find the x such that all f(x) are equal

Dear all, I am trying to solve the following optimization/sequential approximation problem concerning an ERC portfolio.
I have n assets in portfolio. r(i) is a random variable which identify the asset's i return and rp( x ) is the portfolio's return, function of assets' returns ( x '* r ). x is the vector of portfolio weights.
Now, I have a Risk Contribution function which is:
RiskContribution(i) = x(i)* MarginalContribution(i)
= x(i) * E[r(i)|rp(x)<=VaR(rp(x))]
What I am looking for is the x * portfolio allocation such that the vector of Risk contributions RC = [RC(1) RC(2) … RC(n)] have all the same elements (RC(1)=RC(2)=…=RC(n)).
Does anybody have an idea of how to solve this problem?
I think that is impossible to solve it as a minimization problem because once I change the portfolio's weights, also portfolio returns rp(x) and VaR Value-at-Risk change.
PS: naturally, I need x(i)>0 for every i since short selling is not allowed in my problem [..and at least a minimum weight should be allocated to every asset]. An additional constraint could be the sum(x(i))= 1 but it is not compulsory (I can normalize weights in a second moment).
Thanks to everybody.

5 Comments

An additional constraint could be the sum(x(i))= 1 but it is compulsory (I can normalize weights in a second moment).
Did you mean to write that it is not compulsory? If so, then x(i)=0 for all i is a trivial solution.
I also don't see how you are free to post-scale the x(i). Does VaR(x) satisfy the following homogeneity property
VaR(c*x)= c*VaR(x)
for c>0. Otherwise, I don't see it.
Dear Matt,
thanks for your reply. I have changed the post [just added NOT COMPULSORY..I did a mistake, sorry]. I have also corrected the part in which I define the weights constraint [x(i)>0 for every asset].
a) I supposed to post scale the weights as y(i)=x(i)/sum(x(i)) with y(i) the new weights (which will sum up to 1).
b) Value-at-Risk satisfies the homogeneity property.
Do you have any idea of how to proceed?
Do you already have a means of evaluating
MarginalContribution(i,x) = E[r(i)|rp(x)<=VaR(rp(x))]
Is this a function you already have code for?
Yes, sure.
I have coded it in this way. Please, if the code looks not professional, I apologize (I am not an experienced MATLAB end user. I have learn it in less than 1 month).
the idea is to find the expected value of all the ith asset's returns in corrispondence of the portfolio returns lower than VaR.
So, easily I structured it in the following way:
%1) compute portfolio returns
returnsPortfolio= x*vertcat(returnsAsset1, returnsAsset2,..., returnsAssetN)
%2) build a matrix of all the returns as:
returnsAll = [returnsAsset1, returnsAsset2,..., returnsAssetN, returnsPortfolio]
%3) order the returns matrix, sorting for the portfolio returns in an increasing way
[Y,I] = sort(returnsAll(:,nAssets+1))
returnsAllSorted = returnsAll(I,:)
%4) compute the PortfolioVaR which will be used to select only portfolio returns <= PortfolioVaR
PortfolioVaR = quantile(returnsPortfolio, alpha)
%5) compute the marginal risk contribution of each asset i [marginal contribution will be a row vector of nAssets elements]. Below, consider that column nAssets+1 indicates the column of portfolio returns.
for i=1:nAssets
for j=1:FinalTime
if returnsAllSorted(j,nAssets+1) <= portfolioVaR
sum(i)=sum(i)+returnsAllSorted(j,i)
end
end
marginalContribution(i)=sum(i)./(nTrials*alpha)
end
% in vector "sum", each element is the sum of returns of asset i which are in corrispondence with portfolio returns <= VaR. Then, dividing by the number of elements summed, we obtain the expected value/mean.
Hope this could help you (and me).
Regards.
PS: this code works correctly. I have already checked.
Dear Matt,
I have just solved the problem applying the fmincon procedure and following an SQP algorithm.
Since this problem concerns Equal Risk Contribution, this means that RC(i)=RC(j) for every j and i. Moreover, we know that sum(RC(i))=ES [Expected Shortfall Portfolio].
So, I have minimized error=sum((RC(i)/ES - 1/n)^2) using fmincon and setting up 0 as lower bound and 1 as upper bound for weights.

Sign in to comment.

Answers (1)

Glad you got it working, Andrea. I'll just add as an Answer that LSQNONLIN might be better for an objective of the form
error=sum((RC(i)/ES - 1/n)^2)
and for constraints consisting only of upper and lower bounds. LSQNONLIN is more customized for least squares minimization than FMINCON.

Categories

Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange

Asked:

on 13 Jan 2014

Answered:

on 14 Jan 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!