Accelerating the pace of engineering and science

# Documentation Center

• Trial Software

# getGroupRatio

Class: PortfolioCVaR

Obtain group ratio constraint arrays from PortfolioCVaR object

## Syntax

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

## Description

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

## Tips

Use dot notation to obtain group ratio constraint arrays from the CVaR portfolio object.

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

## Input Arguments

 obj CVaR portfolio object [PortfolioCVaR].

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

1     1     1     0     0     0

GroupB =

0     0     0     1     1     1

LowerRatio =

[]

UpperRatio =

0.5000

```