addGroups

Class: PortfolioCVaR

Add group constraints for portfolio weights to existing group constraints for PortfolioCVaR object

Syntax

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

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

  • You can also use dot notation to add group constraints for portfolio weights.

    obj = obj.addGroups(GroupMatrix, LowerGroup, UpperGroup)
  • To remove group constraints from a CVaR portfolio object using dot notation, enter empty arrays for the corresponding arrays.

Input Arguments

obj

CVaR portfolio object [PortfolioCVaR].

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 conform with GroupMatrix.

UpperGroup

(Optional) Upper bound for group constraints [vector].

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

Output Arguments

obj

Updated CVaR portfolio object [PortfolioCVaR].

Attributes

Accesspublic
Staticfalse
Hiddenfalse

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

Examples

expand all

Add Group Constraints

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 = PortfolioCVaR;
G = [ true true true false false ];    % group matrix for first group constraint
p = setGroups(p, G, [], 0.3);
G = [ true false true false true ];    % group matrix for second group constraint
p = addGroups(p, 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

Was this topic helpful?