Documentation Center

  • Trials
  • Product Updates

setGroups

Class: Portfolio

Set up group constraints for portfolio weights

Syntax

obj = setGroups(obj,GroupMatrix,LowerGroup)
obj = setGroups(obj,GroupMatrix,LowerGroup,UpperGroup)

Description

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

Tips

  • 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.

Input Arguments

obj

Portfolio object [Portfolio].

GroupMatrix

Group constraint matrix [matrix].

    Note:   The group matrix GroupMatrix is usually an indicator of membership in groups, which means that its elements are usually either 0 or 1. Because of this interpretation, GroupMatrix can be either a logical or numerical matrix.

LowerGroup

Lower bound for group constraints [vector].

    Note:   If input is scalar, LowerGroup undergoes scalar expansion to be conformable with GroupMatrix.

UpperGroup

Upper bound for group constraints [vector].

    Note:   If input is scalar, UpperGroup undergoes scalar expansion to be conformable with GroupMatrix.

Output Arguments

obj

Updated Portfolio object [Portfolio].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

To learn about attributes of methods, see Method Attributes in the MATLAB® Object-Oriented Programming documentation.

Examples

expand all

Set Group Constraints

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 = p.setGroups(G, [], 0.3);
disp(p.NumAssets);
disp(p.GroupMatrix);
disp(p.UpperGroup);
     5

     1     1     1     0     0

    0.3000

See Also

|

More About

Was this topic helpful?