Sometimes, you may want to validate either your inputs to, or outputs from, a portfolio optimization problem. Although most error checking that occurs during the problem setup phase catches most difficulties with a portfolio optimization problem, the processes to validate MAD portfolio sets and portfolios are time consuming and are best done offline. So, the portfolio optimization tools have specialized functions to validate MAD portfolio sets and portfolios. For information on the workflow when using投资组合
对象,请参阅PortfolioMAD对象的工作流。
Since it is necessary and sufficient that your MAD portfolio set must be a nonempty, closed, and bounded set to have a valid portfolio optimization problem, the估计
函数使您可以检查投资组合设置以确定它是否是非发行的,并且,如果非发行,是否是有限的。假设您有以下MAD投资组合集,这是一个空集,因为初始投资组合在0
is too far from a portfolio that satisfies the budget and turnover constraint:
p =投资组合('NumAssets', 3,'预算',1);p = setturnover(p,0.3,0);
If a MAD portfolio set is empty,估计
returnsNaN
边界并设置isbounded
flag to[]
:
[LB,UB,ISBOUNDED] =估计值(P)
lb = NaN NaN NaN ub = NaN NaN NaN isbounded = []
假设您创建一个无限的MAD投资组合集,如下所示:
p =投资组合('AInequality', [1 -1; 1 1 ],“ binequality', 0); [lb, ub, isbounded] = estimateBounds(p)
lb = -Inf -Inf ub = 1.0e-008 * -0.3712 Inf isbounded = 0
估计
returns (possibly infinite) bounds and sets theisbounded
flag tofalse
。结果表明哪些资产是无限的,因此您可以根据需要应用界限。
Finally, suppose that you created a投资组合
既非空和有限的对象。估计
not only validates the set, but also obtains tighter bounds which are useful if you are concerned with the actual range of portfolio choices for individual assets in your portfolio:
p = portfoliomad;p = setBudget(p,1,1);p = setBounds(p,[-0.1; 0.2; 0.3; 0.2],[0.5; 0.3; 0.9; 0.9; 0.8]);[LB,UB,ISBOUNDED] =估计值(P)
lb = -0.1000 0.2000 0.3000 0.2000 ub = 0.3000 0.3000 0.7000 0.6000 isbounded = 1
In this example, all but the second asset has tighter upper bounds than the input upper bound implies.
Given a MAD portfolio set specified in a投资组合
object, you often want to check if specific portfolios are feasible with respect to the portfolio set. This can occur with, for example, initial portfolios and with portfolios obtained from other procedures. ThecheckFeasibility
function determines whether a collection of portfolios is feasible. Suppose that you perform the following portfolio optimization and want to determine if the resultant efficient portfolios are feasible relative to a modified problem.
First, set up a problem in the投资组合
objectp
,估计有效的投资组合pwgt
, and then confirm that these portfolios are feasible relative to the initial problem:
m = [ 0.05; 0.1; 0.12; 0.18 ]; C = [ 0.0064 0.00408 0.00192 0; 0.00408 0.0289 0.0204 0.0119; 0.00192 0.0204 0.0576 0.0336; 0 0.0119 0.0336 0.1225 ]; m = m/12; C = C/12; AssetScenarios = mvnrnd(m, C, 20000); p = PortfolioMAD; p = setScenarios(p, AssetScenarios); p = setDefaultConstraints(p); pwgt = estimateFrontier(p); checkFeasibility(p, pwgt)
ans = 1 1 1 1 1 1 1 1 1 1
Next, set up a different portfolio problem that starts with the initial problem with an additional a turnover constraint and an equally weighted initial portfolio:
q = setTurnover(p, 0.3, 0.25); checkFeasibility(q, pwgt)
ans = 0 0 1 1 1 0 0 0 0 0
投资组合
objectq
。Solving the second problem usingcheckFeasibility
demonstrates that the efficient portfolio for投资组合
objectq
is feasible relative to the initial problem:
qwgt = estimateFrontier(q); checkFeasibility(p, qwgt)
ans = 1 1 1 1 1 1 1 1 1 1