Convert constraints from absolute to active format
ActiveConSet = abs2active(AbsConSet, Index)
ActiveConSet = abs2active(AbsConSet, Index) transforms a constraint matrix to an equivalent matrix expressed in active weight format (relative to the index).
Portfolio linear inequality constraint matrix expressed in absolute weight format. AbsConSet is formatted as [A b] such that A*w <= b, where A is a number of constraints (NCONSTRAINTS) by number of assets (NASSETS) weight coefficient matrix, and b and w are column vectors of length NASSETS. The value w represents a vector of absolute asset weights whose elements sum to the total portfolio value. See the output ConSet from portcons for additional details about constraint matrices.
NASSETS-by-1 vector of index portfolio weights. The sum of the index weights must equal the total portfolio value (for example, a standard portfolio optimization imposes a sum-to-one budget constraint).
The transformed portfolio linear inequality constraint matrix expressed in active weight format, also of the form [A b] such that A*w <= b. The value w represents a vector of active asset weights (relative to the index portfolio) whose elements sum to zero.
abs2active transforms a constraint matrix to an equivalent matrix expressed in active weight format (relative to the index). The transformation equation is
The initial constraint matrix consists of NCONSTRAINTS portfolio linear inequality constraints expressed in absolute weight format. The index portfolio vector contains NASSETS assets.
Set up constraints for a portfolio optimization for portfolio w0 with constraints in the form A*w <= b, where w is absolute portfolio weights. (Absolute weights do not depend on the tracking portfolio.) Use abs2active to convert constraints in terms of absolute weights into constraints in terms of active portfolio weights, defined relative to the tracking portfolio w0. Assume three assets with the following mean and covariance of asset returns:
m = [ 0.14; 0.10; 0.05 ]; C = [ 0.29^2 0.4*0.29*0.17 0.1*0.29*0.08; 0.4*0.29*0.17 0.17^2 0.3*0.17*0.08;... 0.1*0.29*0.08 0.3*0.17*0.08 0.08^2 ];
Absolute portfolio constraints are the typical ones (weights sum to 1 and fall from 0 through 1), create the A and b matrices using portcons:
AbsCons = portcons('PortValue',1,3,'AssetLims', [0; 0; 0], [1; 1; 1;]);
The efficient frontier is:
portopt(m, C, , , AbsCons);
The tracking portfolio w0 is:
w0 = [ 0.1; 0.55; 0.35 ];
Use abs2active to compute the constraints for active portfolio weights:
ActCons = abs2active(AbsCons, w0)
ActCons = 1.0000 1.0000 1.0000 0 -1.0000 -1.0000 -1.0000 0 1.0000 0 0 0.9000 0 1.0000 0 0.4500 0 0 1.0000 0.6500 -1.0000 0 0 0.1000 0 -1.0000 0 0.5500 0 0 -1.0000 0.3500
The efficient frontier demonstrates expected returns and risk relative to the tracking portfolio w0:
portopt(m, C, , , ActCons);