主要内容

Working with Group Constraints Using PortfolioCVaR Object

Group constraints are optional linear constraints that group assets together and enforce bounds on the group weights (seeGroup Constraints). Although the constraints are implemented as general constraints, the usual convention is to form a group matrix that identifies membership of each asset within a specific group with Boolean indicators (either真的或者false或者with1或者0) for each element in the group matrix. Group constraints have propertiesGroupMatrixfor the group membership matrix,LowerGroupfor the lower-bound constraint on groups, andUpperGroupfor the upper-bound constraint on groups.

Setting Group Constraints Using thePortfolioCVaR功能

The properties for group constraints are set through thePortfolioCVaRobject. Suppose that you have a portfolio of five assets and want to ensure that the first three assets constitute no more than 30% of your portfolio, then you can set group constraints:

G = (1 1 1 0 0);p= PortfolioCVaR('groupmatrix', G,'UpperGroup',0.3);disp(p.numassets)disp(p.groupmatrix)disp(p.uppergroup)
5 1 1 1 0 0 0.3000

组矩阵G也可以是逻辑矩阵,因此以下代码可以实现相同的结果。

g = [true true true false];p= PortfolioCVaR('groupmatrix', G,'UpperGroup',0.3);disp(p.numassets)disp(p.groupmatrix)disp(p.uppergroup)
5 1 1 1 0 0 0.3000

Setting Group Constraints Using thesetGroupsaddGroups功能s

您还可以使用使用setGroups。假设您拥有五个资产的投资组合,并希望确保前三项资产占投资组合的30%。给定PortfolioCVaRobjectp, 利用setGroups设置组约束:

g = [true true true false];p = portfoliocvar;p = setGroups(p,g,[],0.3);disp(p.numassets)disp(p.groupmatrix)disp(p.uppergroup)
5 1 1 1 0 0 0.3000

在此示例中,您将设置LowerGroupproperty to be empty ([]).

Suppose that you want to add another group constraint to make odd-numbered assets constitute at least 20% of your portfolio. Set up an augmented group matrix and introduce infinite bounds for unconstrained group bounds or use theaddGroups功能以建立组约束。对于此示例,为第二组约束创建另一个组矩阵:

p = portfoliocvar;g = [true true true false];% group matrix for first group constraintp = setGroups(p,g,[],0.3);G = [ true false true false true ];第二组约束的%组矩阵p= addGroups(p, G, 0.2); disp(p.NumAssets) disp(p.GroupMatrix) disp(p.LowerGroup) disp(p.UpperGroup)
5 1 1 1 0 0 1 0 1 0 1 -Inf 0.2000 0.3000 Inf
addGroups确定哪些范围是无限的,因此您只需要专注于要设置的约束。

ThePortfolioCVaR目的,setGroups, 和addGroupsimplement scalar expansion on either theLowerGroup或者UpperGroup基于属性中组矩阵的尺寸的属性GroupMatrix。Suppose that you have a universe of 30 assets with 6 asset classes such that assets 1–5, assets 6–12, assets 13–18, assets 19–22, assets 23–27, and assets 28–30 constitute each of your asset classes and you want each asset class to fall from 0% to 25% of your portfolio. Let the following group matrix define your groups and scalar expansion define the common bounds on each group:

p = portfoliocvar;G = blkdiag(true(1,5), true(1,7), true(1,6), true(1,4), true(1,5), true(1,3)); p = setGroups(p, G, 0, 0.25); disp(p.NumAssets) disp(p.GroupMatrix) disp(p.LowerGroup) disp(p.UpperGroup)
30 Columns 1 through 16 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 17 through 30 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0.2500 0.2500 0.2500 0.2500 0.2500 0.2500

See Also

|||||||||

Related Examples

More About

External Websites