Accelerating the pace of engineering and science

# getGroupRatio

Obtain group ratio constraint arrays from PortfolioMAD object

## Syntax

[GroupA,GroupB,LowerRatio,UpperRatio] = getGroupRatio(obj)

## Description

[GroupA,GroupB,LowerRatio,UpperRatio] = getGroupRatio(obj) obtains the group ratio constraint arrays from a MAD portfolio object.

## Tips

You can also use dot notation to obtain group ratio constraint arrays from the MAD portfolio object.

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

## Output Arguments

 GroupA Matrix that forms base groups for comparison [matrix]. GroupB Matrix that forms comparison groups [matrix]. LowerRatio Lower bound for ratio of GroupB groups to GroupA groups [vector]. UpperRatio Upper bound for ratio of GroupB groups to GroupA groups [vector].

## Attributes

 Access public Static false Hidden false

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

## Examples

expand all

### Obtain Group Ratio Constraints

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 = setGroupRatio(p, GA, GB, [], 0.5);
[GroupA, GroupB, LowerRatio, UpperRatio] = getGroupRatio(p)
```
```GroupA =

1     1     1     0     0     0

GroupB =

0     0     0     1     1     1

LowerRatio =

[]

UpperRatio =

0.5000

```