Portfolio Optimization with LASSO

I have to find the optimal portfolio adding the "l-1 norm" constraint to the classical mean-variance model. How can i write this optimization in matricial form ?

답변 (2개)

Ameer Hamza
Ameer Hamza 2020년 10월 12일
편집: Ameer Hamza 2020년 10월 12일

0 개 추천

This shows an example for the case of 5 portfolios
mu = rand(1, 5);
eta = 0.5;
Sigma = ones(5);
Aeq = [mu; ones(1, 5)];
Beq = [eta; 1];
x0 = rand(5,1); % initial guess
sol = fmincon(@(x) x.'*Sigma*x, x0, [], [], Aeq, Beq, [], [], @nlcon);
function [c, ceq] = nlcon(x)
c = sum(abs(x))-1;
ceq = [];
end

댓글 수: 4

ANDREA MUZI
ANDREA MUZI 2020년 10월 12일
I probably misplaced the question. I must obtain a portfolio, whose sum of the weights must be equal to 1, and the sum of the absolute value of the weights less than a certain t, so that when the t decreases some assets have weight equal to zero.
Ameer Hamza
Ameer Hamza 2020년 10월 12일
You want the weighted sum to be equal to eta or less than eta? I have corrected a mistake in my code, and now it implements the constraints as written in the question.
ANDREA MUZI
ANDREA MUZI 2020년 10월 12일
equal to eta
Then the code in my answer satisfies all the constraints. You can verify
mu = rand(1, 5);
eta = 0.5;
Sigma = ones(5);
Aeq = [mu; ones(1, 5)];
Beq = [eta; 1];
x0 = rand(5,1); % initial guess
sol = fmincon(@(x) x.'*Sigma*x, x0, [], [], Aeq, Beq, [], [], @nlcon);
function [c, ceq] = nlcon(x)
c = sum(abs(x))-1;
ceq = [];
end
Results
>> mu*sol % output is eta
ans =
0.5000
>> sum(sol) % sum is 1
ans =
1
>> sum(abs(sol)) % sum of absolute values is 1
ans =
1

댓글을 달려면 로그인하십시오.

ANDREA MUZI
ANDREA MUZI 2020년 10월 12일

0 개 추천

I thank you but it is not the result I expected; I try to rephrase the question. I found a way to linearize the constraint on the weights norm (photo). Basically I have to find the vector between tmin and tmax, in which tmin penalizes all the weights of the assets, bringing them to zero, except one whose weight will be equal to 1 and tmax, whose value will not penalize any asset

카테고리

도움말 센터File Exchange에서 Linear Programming and Mixed-Integer Linear Programming에 대해 자세히 알아보기

질문:

2020년 10월 12일

답변:

2020년 10월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by