Accelerating the pace of engineering and science

Documentation Center

• Trial Software

Contents

Class: Portfolio

Add group constraints for portfolio weights to existing group constraints

Description

obj = addGroups(obj,GroupMatrix,LowerGroup) adds group constraints for portfolio weights to existing group constraints subject to a lower bound on groups.

obj = addGroups(obj,GroupMatrix,LowerGroup,UpperGroup) adds the group constraints for portfolio weights to existing group constraints with an additional option 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 add group constraints for portfolio weights.

`obj = obj.addGroups(GroupMatrix, LowerGroup, UpperGroup)`
• To remove group constraints from a Portfolio object, enter empty arrays for the corresponding arrays.

Input Arguments

obj

Portfolio object [Portfolio].

GroupMatrix

Group constraint matrix [matrix].

 Note:   The group matrix GroupMatrix often indicates membership in groups, which means that its elements are usually either 0 or 1. Because of this interpretation,GroupMatrix can be 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

(Optional) 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

 Access public Static false Hidden false

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

Examples

expand all

Set a group constraint to ensure that the first three assets constitute at most 30% of a portfolio. Then add another group constraint to ensure that the odd-numbered assets constitute at least 20% of a portfolio.

```p = Portfolio;
G = [ true true true false false ];   % group matrix for first group constraint
p = p.setGroups(G, [], 0.3);
G = [ true false true false true ];   % group matrix for second group constraint
p = p.addGroups(G, 0.2);
disp(p.NumAssets);
disp(p.GroupMatrix);
disp(p.LowerGroup);
disp(p.UpperGroup);
```
```5

1     1     1     0     0
1     0     1     0     1

-Inf
0.2000

0.3000
Inf```