Minimize Tracking Error using Quadprog
2 views (last 30 days)
Show older comments
I have a set of benchmark weights Wb (N X 1) vector and a covariance matrix H (N X N) matrix . I want to get portfolio weights Wp that minimizes tracking error (TE) relative to Wb. So my objectivity function is
= 1/2 * Wp * H * Wp - (H * Wb)' * Wp
Currently the only constraint I have is lb >=0 and sum (Wp) = 1
With these conditions and no constraints, the quadprog should return Wb as the solution set so that with Wp = Wb, TE will be 0
However when I run the function below
nIds = numel(Wb);
Aeq =ones(1,nIds);
beq = 100;
opts = optimset('Algorithm','active-set','MaxIter',10000);
opts = optimset(opts,'tolFun',1e-15);
f = - H * Wb;
[x,fval,exitflag] = quadprog(H,f,[],[],Aeq,beq,lb,[],[],opts);
I get Wp that is close to Wb not exactly Wb. Can someone help?
0 Comments
Answers (0)
See Also
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!