Portfolio Optimization with LASSO
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 ?0 Kommentare
Antworten (2)
Ameer Hamza
am 12 Okt. 2020
Bearbeitet: Ameer Hamza
am 12 Okt. 2020
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 Kommentare
Ameer Hamza
am 12 Okt. 2020
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
Siehe auch
Kategorien
Mehr zu Linear Programming and Mixed-Integer Linear Programming finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
