Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

setGroupRatio

Set up group ratio constraints for portfolio weights

Use the setGroupRatio function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to set up group ratio constraints for portfolio weights for portfolio objects.

For details on the respective workflows when using these different objects, see Portfolio Object Workflow, PortfolioCVaR Object Workflow, and PortfolioMAD Object Workflow.

Syntax

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

Description

example

obj = setGroupRatio(obj,GroupA) sets up group ratio constraints for portfolio weights for portfolio objects

example

obj = setGroupRatio(obj,GroupA,GroupB,LowerRatio,UpperRatio) sets up group ratio constraints for portfolio weights for portfolio objects with additional options specified for GroupB, LowerRatio, and 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.

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

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

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

Input Arguments

collapse all

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

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

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

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.

Introduced in R2011a

Was this topic helpful?