Skip to Main Content Skip to Search
Product Documentation

addGroups - Class: Portfolio

Add group constraints for portfolio weights to existing group constraints

Syntax

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

Description

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

obj = addGroups(obj, GroupMatrix, LowerGroup, UpperGroup) to add 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:

LowerGroup <= GroupMatrix * Port <= UpperGroup

Tips

Input Arguments

obj

A 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 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

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

To add another group constraint to ensure that the odd-numbered assets constitute at least 20% of a portfolio, use addGroups to build up group constraints by creating another group matrix for a second group constraint:

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

See Also

Portfolio | setGroupRatio

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS