Main Content

getGroupRatio

Obtain group ratio constraint arrays from portfolio object

Description

Use the getGroupRatio function with a Portfolio, PortfolioCVaR, or PortfolioMAD object to obtain group ratio constraint arrays from portfolio objects.

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

[GroupA,GroupB,LowerRatio,UpperRatio] = getGroupRatio(obj) obtains equality constraint arrays from portfolio objects.

example

Examples

collapse all

Suppose you want to make sure that the ratio of financial to nonfinancial companies in your portfolios never goes above 50%. Assume you have 6 assets with 3 financial companies (assets 1-3) and 3 nonfinancial companies (assets 4-6). After setting group ratio constraints, obtain the values for GroupA, GroupB, LowerRatio, and UpperRatio.

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);
[GroupA, GroupB, LowerRatio, UpperRatio] = getGroupRatio(p)
GroupA = 1×6

     1     1     1     0     0     0

GroupB = 1×6

     0     0     0     1     1     1

LowerRatio =

     []
UpperRatio = 
0.5000

Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolios never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). After setting group ratio constraints, obtain the values for GroupA, GroupB, LowerRatio, and UpperRatio.

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);
[GroupA, GroupB, LowerRatio, UpperRatio] = getGroupRatio(p)
GroupA = 1×6

     1     1     1     0     0     0

GroupB = 1×6

     0     0     0     1     1     1

LowerRatio =

     []
UpperRatio = 
0.5000

Suppose you want to ensure that the ratio of financial to nonfinancial companies in your portfolios never exceeds 50%. Assume you have six assets with three financial companies (assets 1-3) and three nonfinancial companies (assets 4-6). After setting group ratio constraints, obtain the values for GroupA, GroupB, LowerRatio, and UpperRatio.

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);
[GroupA, GroupB, LowerRatio, UpperRatio] = getGroupRatio(p)
GroupA = 1×6

     1     1     1     0     0     0

GroupB = 1×6

     0     0     0     1     1     1

LowerRatio =

     []
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

Data Types: object

Output Arguments

collapse all

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

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

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

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

Tips

You can also use dot notation to obtain group ratio constraint arrays from portfolio objects.

[GroupA, GroupB, LowerRatio, UpperRatio] = obj.getGroupRatio;

Version History

Introduced in R2011a