obj = setGroups(obj,GroupMatrix,LowerGroup)
obj = setGroups(obj,GroupMatrix,LowerGroup,UpperGroup)
obj = setGroups(obj,GroupMatrix,LowerGroup) sets up group constraints for portfolio weights subject to a lower bound on groups.
obj = setGroups(obj,GroupMatrix,LowerGroup,UpperGroup) to set up group constraints for portfolio weights with an additional options specified for UpperGroup.
Given GroupMatrix and either LowerGroup or UpperGroup, a portfolio Port must satisfy the following:
LowerGroup <= GroupMatrix * Port <= UpperGroup
You can also use dot notation to set up group constraints for portfolio weights.
obj = obj.setGroups(GroupMatrix, LowerGroup, UpperGroup);
To remove group constraints, enter empty arrays for the corresponding arrays. To add to existing group constraints, use addGroups.
Portfolio object [Portfolio].
Group constraint matrix [matrix].
Lower bound for group constraints [vector].
Upper bound for group constraints [vector].
To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.
Suppose you have a portfolio of five assets and you want to ensure that the first three assets constitute at most 30% of your portfolio. Given a Portfolio object p, set the group constraints with the following.
G = [ true true true false false ]; p = Portfolio; p = setGroups(p, G, , 0.3); disp(p.NumAssets); disp(p.GroupMatrix); disp(p.UpperGroup);
5 1 1 1 0 0 0.3000