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 propertiesGroupMatrix
for the group membership matrix,LowerGroup
for the lower-bound constraint on groups, andUpperGroup
for the upper-bound constraint on groups.
Setting Group Constraints Using thePortfolioCVaR
功能
The properties for group constraints are set through thePortfolioCVaR
object. 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 thesetGroups
和addGroups
功能s
您还可以使用使用setGroups
。假设您拥有五个资产的投资组合,并希望确保前三项资产占投资组合的30%。给定PortfolioCVaR
objectp
, 利用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
在此示例中,您将设置LowerGroup
property 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
, 和addGroups
implement 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
PortfolioCVaR
|setDefaultConstraints
|setBounds
|setBudget
|setGroups
|setGroupRatio
|setEquality
|setinequality
|定居
|setonewaytournover
Related Examples
- Creating the PortfolioCVaR Object
- 使用默认值使用CVAR投资组合约束
- Validate the CVaR Portfolio Problem
- Estimate Efficient Portfolios for Entire Frontier for PortfolioCVaR Object
- Estimate Efficient Frontiers for PortfolioCVaR Object
- Asset Returns and Scenarios Using PortfolioCVaR Object
- Hedging Using CVaR Portfolio Optimization
- Compute Maximum Reward-to-Risk Ratio for CVaR Portfolio