Main Content

setGroupRatio

Set up group ratio constraints for portfolio weights

Description

obj = setGroupRatio(obj,GroupA,GroupB,LowerRatio) sets up group ratio constraints for portfolio weights for Portfolio, PortfolioCVaR, or PortfolioMAD objects. For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

example

obj = setGroupRatio(___,UpperRatio) sets up group ratio constraints for portfolio weights for portfolio objects with an additional optional argument for UpperRatio.

Given base and comparison group matrices GroupA and GroupB and LowerRatio or UpperRatio bounds, group ratio constraints require any portfolio in Port to satisfy the following:

(GroupB * Port) .* LowerRatio <= GroupA * Port <= (GroupB * Port) .* UpperRatio

Caution

This collection of constraints usually requires that portfolio weights be nonnegative and that the products GroupA * Port and GroupB * Port are always nonnegative. Although negative portfolio weights and non-Boolean group ratio matrices are supported, use with caution.

example

Examples

collapse all

Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolio never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). Group ratio constraints can be set with:

GA = [ true true true false false false ];    % financial companies
GB = [ false false false true true true ];    % nonfinancial companies
p = Portfolio;
p = setGroupRatio(p, GA, GB, [], 0.5);

disp(p.NumAssets);
     6
disp(p.GroupA);
     1     1     1     0     0     0
disp(p.GroupB);
     0     0     0     1     1     1
disp(p.UpperRatio);
    0.5000

To add additional Group ratio constraints, use addGroupRatio.

Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolio never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). Group ratio constraints can be set with:

GA = [ true true true false false false ];    % financial companies
GB = [ false false false true true true ];    % nonfinancial companies
p = PortfolioCVaR;
p = setGroupRatio(p, GA, GB, [], 0.5);

disp(p.NumAssets);
     6
disp(p.GroupA);
     1     1     1     0     0     0
disp(p.GroupB);
     0     0     0     1     1     1
disp(p.UpperRatio);
    0.5000

To add additional Group ratio constraints, use addGroupRatio.

Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolio never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). Group ratio constraints can be set with:

GA = [ true true true false false false ];    % financial companies
GB = [ false false false true true true ];    % nonfinancial companies
p = PortfolioMAD;
p = setGroupRatio(p, GA, GB, [], 0.5);

disp(p.NumAssets);
     6
disp(p.GroupA);
     1     1     1     0     0     0
disp(p.GroupB);
     0     0     0     1     1     1
disp(p.UpperRatio);
    0.5000

To add additional Group ratio constraints, use addGroupRatio.

Input Arguments

collapse all

Object for portfolio, specified using Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Data Types: object

Matrix that forms base groups for comparison, specified as a matrix for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

The group matrices GroupA and GroupB are usually indicators of membership in groups, which means that their elements are usually either 0 or 1. Because of this interpretation, GroupA and GroupB matrices can be either logical or numerical arrays.

Data Types: double | logical

Matrix that forms comparison groups, specified as a matrix Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

The group matrices GroupA and GroupB are usually indicators of membership in groups, which means that their elements are usually either 0 or 1. Because of this interpretation, GroupA and GroupB matrices can be either logical or numerical arrays.

Data Types: double | logical

Lower bound for ratio of GroupB groups to GroupA groups, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

If input is scalar, LowerRatio undergoes scalar expansion to be conformable with the group matrices.

Data Types: double

Upper bound for ratio of GroupB groups to GroupA groups, specified as a vector for a Portfolio, PortfolioCVaR, or PortfolioMAD input object (obj).

Note

If input is scalar, UpperRatio undergoes scalar expansion to be conformable with the group matrices.

Data Types: double

Output Arguments

collapse all

Updated portfolio object, returned as a Portfolio, PortfolioCVaR, or PortfolioMAD object. For more information on creating a portfolio object, see

Tips

  • You can also use dot notation to set up group ratio constraints for portfolio weight.

    obj = obj.setGroupRatio(GroupA, GroupB, LowerRatio, UpperRatio);

  • To remove group ratio constraints, enter empty arrays for the corresponding arrays. To add to existing group ratio constraints, use addGroupRatio.

Version History

Introduced in R2011a