| Contents | Index |
Portfolio object for mean-variance portfolio optimization and analysis
The portfolio object implements mean-variance portfolio optimization and is derived from the abstract portfolio optimization class AbstractPortfolio. Portfolio objects implement all methods in the AbstractPortfolio class along with methods that are specific to mean-variance portfolio optimization.
The main workflow for portfolio optimization is to create an instance of a portfolio object that completely specifies a portfolio optimization problem and to operate on the portfolio object to obtain and analyze efficient portfolios. A mean-variance optimization problem is completely specified with the following three elements:
A universe of assets with estimates for the prospective mean and covariance of asset total returns for a period of interest.
A portfolio set that specifies the set of portfolio choices in terms of a collection of constraints.
A model for portfolio return and risk, which, for mean-variance optimization, is either the gross or net mean of portfolio returns and the standard deviation of portfolio returns.
After you specify three elements in an unambiguous way, you can solve and analyze portfolio optimization problems. The simplest mean-variance portfolio optimization problem has:
A mean and covariance of asset total returns
Nonnegative weights for all portfolios that sum to 1 (the summation constraint is known as a budget constraint)
Built-in models for portfolio return and risk that use the mean and covariance of asset total returns
Given mean and covariance of asset returns in the variables AssetMean and AssetCovar, this problem is completely specified by:
p = Portfolio('AssetMean', AssetMean, 'AssetCovar', AssetCovar,...
'LowerBound', 0, 'Budget')or equivalently by:
p = Portfolio; p = p.setAssetMoments(AssetMean, AssetCovar); p = p.setDefaultConstraints;
p = Portfolio constructs an empty portfolio object for mean-variance portfolio optimization and analysis. You can then add elements to the portfolio object using Add Methods and Set Methods.
p = Portfolio(Name,Value) constructs a portfolio object for mean-variance portfolio optimization and analysis with additional options specified by one or more Name,Value pair arguments. Name is a property name and Value is its corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,…,NameN,ValueN.
p = Portfolio(p, Name,Value) constructs a portfolio object for mean-variance portfolio optimization and analysis using a previously constructed portfolio object p with additional options specified by one or more Name,Value pair arguments.
p |
(Optional) Previously constructed portfolio object (p). |
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
The following properties are from the Portfolio class.
BuyTurnover |
Turnover constraint on purchases ([] or [scalar]).
Attributes:
|
RiskFreeRate |
Risk-free rate ([] or scalar).
Attributes:
| ||||
SellCost |
Proportional sales costs ([] or vector).
Attributes:
|
SellTurnover |
Turnover constraint on sales ([] or [scalar]).
Attributes:
|
Turnover |
Turnover constraint ([] or [scalar]).
Attributes:
|
The following properties are inherited from the AbstractPortfolio class.
AEquality |
Linear equality constraint matrix ([] or [matrix]).
Attributes:
| ||||
AInequality |
Linear inequality constraint matrix ([] or [matrix]).
Attributes:
| ||||
AssetList |
Names or symbols of assets in universe ([] or [vector cell of strings]).
Attributes:
| ||||
bEquality |
Linear equality constraint vector ([] or [vector]).
Attributes:
| ||||
bInequality |
Linear inequality constraint vector ([] or [vector]). Attributes:
| ||||
GroupA |
Group A weights to be bounded by group B ([] or [matrix]).
Attributes:
| ||||
GroupB |
Group B weights ([] or [matrix]).
Attributes:
| ||||
GroupMatrix |
Group membership matrix ([] or [matrix]).
Attributes:
| ||||
InitPort |
Initial portfolio ([] or vector).
Attributes:
| ||||
LowerBound |
Lower-bound constraint ([] or [vector]).
Attributes:
| ||||
LowerBudget |
Lower-bound budget constraint ([] or [scalar]).
Attributes:
| ||||
LowerGroup |
Lower-bound group constraint ([] or [vector]).
Attributes:
| ||||
LowerRatio |
Mnimum ratio of allocations between groups A and B ([] or [vector]).
Attributes:
| ||||
Name |
Name for instance of the portfolio object ([] or [string]).
Attributes:
| ||||
NumAssets |
Number of assets in universe ([] or [integer scalar]).
Attributes:
| ||||
UpperBound |
Upper-bound constraint ([] or [vector]).
Attributes:
| ||||
UpperBudget |
Upper-bound budget constraint ([] or [scalar]). Attributes:
| ||||
UpperGroup |
Upper-bound group constraint ([] or [vector]).
Attributes:
| ||||
UpperRatio |
Maximum ratio of allocations between groups A and B ([] or [vector]).
Attributes:
|
The following methods are inherited from the AbstractPortfolio class.
| addEquality | Add linear equality constraints for portfolio weights to existing constraints |
| addGroupRatio | Add group ratio constraints for portfolio weights to existing group ratio constraints |
| addGroups | Add group constraints for portfolio weights to existing group constraints |
| addInequality | Add linear inequality constraints for portfolio weights to existing constraints |
| checkFeasibility | Check feasibility of input portfolios against a portfolio object |
| estimateBounds | Estimate global lower and upper bounds for set of portfolios |
| estimateFrontier | Estimate specified number of optimal portfolios over entire efficient frontier |
| estimateFrontierByReturn | Estimate optimal portfolios with targeted portfolio returns |
| estimateFrontierByRisk | Estimate optimal portfolios with targeted portfolio risks |
| estimateFrontierLimits | Estimate optimal portfolios at endpoints of efficient frontier |
| estimateMaxSharpeRatio | Estimate efficient portfolio to maximize Sharpe ratio |
| estimatePortReturn | Estimate mean of portfolio returns (portfolio return) |
| estimatePortRisk | Estimate standard deviation of portfolio returns (portfolio risk) |
| getBounds | Obtain bounds for portfolio weights from portfolio object |
| getBudget | Obtain budget constraint bounds from portfolio object |
| getEquality | Obtain equality constraint arrays from portfolio object |
| getGroupRatio | Obtain group ratio constraint arrays from portfolio object |
| getGroups | Obtain group constraint arrays from portfolio object |
| getInequality | Obtain inequality constraint arrays from portfolio object |
| plotFrontier | Plot efficient frontier |
| setAssetList | Set up list of identifiers for assets |
| setBounds | Set up bounds for portfolio weights |
| setBudget | Set up budget constraints |
| setDefaultConstraints | Set up portfolio constraints with nonnegative weights that must sum to 1 |
| setEquality | Set up linear equality constraints for portfolio weights |
| setGroupRatio | Set up group ratio constraints for portfolio weights |
| setGroups | Set up group constraints for portfolio weights |
| setInequality | Set up linear inequality constraints for portfolio weights |
| setInitPort | Set up initial or current portfolio |
| setOptions | Set hidden properties in portfolio object |
| setSolver | Choose main solver and specify associated solver options for portfolio optimization |
| estimateAssetMoments | Estimate mean and covariance of asset returns from data |
| estimatePortMoments | Estimate moments of portfolio returns |
| getAssetMoments | Obtain mean and covariance of asset returns from portfolio object |
| getCosts | Obtain buy and sell transaction costs from portfolio object |
| getOneWayTurnover | Obtain one-way turnover constraints from portfolio object |
| setAssetMoments | Set moments (mean and covariance) of asset returns |
| setCosts | Set up proportional transaction costs |
| setOneWayTurnover | Set up one-way portfolio turnover constraints |
| setTurnover | Set up maximum portfolio turnover constraint |
For more information on the theory and definition of mean-variance optimization supported by portfolio optimization tools in Financial Toolbox software, see Portfolio Optimization Theory.
Value. To learn how value classes affect copy operations, see Copying Objects in the MATLAB Programming Fundamentals documentation.
Efficient portfolios can be obtained with:
load CAPMuniverse
p = Portfolio('AssetList',Assets(1:12));
p = p.estimateAssetMoments(Data(:,1:12),'missingdata',true);
p = p.setDefaultConstraints;
p.plotFrontier;
pwgt = p.estimateFrontier(5);
pnames = cell(1,5);
for i = 1:5
pnames{i} = sprintf('Port%d',i);
end
Blotter = dataset([{pwgt},pnames],'obsnames',p.AssetList);
disp(Blotter);
Port1 Port2 Port3 Port4 Port5
AAPL 0.017926 0.058247 0.097816 0.12955 0
AMZN 0 0 0 0 0
CSCO 0 0 0 0 0
DELL 0.0041906 0 0 0 0
EBAY 0 0 0 0 0
GOOG 0.16144 0.35678 0.55228 0.75116 1
HPQ 0.052566 0.032302 0.011186 0 0
IBM 0.46422 0.36045 0.25577 0.11928 0
INTC 0 0 0 0 0
MSFT 0.29966 0.19222 0.082949 0 0
ORCL 0 0 0 0 0
YHOO 0 0 0 0 0

For a complete list of references for the portfolio object and portfolio optimization tools, see Portfolio Optimization.
You can also perform portfolio optimization using a collection of special-purpose functions in Financial Toolbox software. For more information, see Portfolio Optimization Functions.
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |