主要内容

Black-Litterman Portfolio Optimization

This example shows the workflow to implement the Black-Litterman model with the文件夹class. The Black-Litterman model is an asset allocation approach that allows investment analysts to incorporate subjective views (based on investment analyst estimates) into market equilibrium returns. By blending analyst views and equilibrium returns instead of relying only on historical asset returns, the Black-Litterman model provides a systematic way to estimate the mean and covariance of asset returns.

In the Black-Litterman model, the blended expected return is μ - = [ P T ω - 1 P + C - 1 ] - 1 [ P T ω - 1 q + C - 1 π ] and the estimation uncertainty is cov ( μ ) = [ P T ω - 1 P + C - 1 ] - 1 。To use the Black-Litterman model, you must prepare the inputs: P , q , ω , π , and C 。The inputs for P , q , and ω 由投资分析师与视图相关和定义。 π is the equilibrium return and C is the uncertainty in prior belief. This example guides you to define these inputs and use the resulting blended returns in a portfolio optimization. For more information on the concept and derivation of the Black-Litterman model, see the Appendix section贝叶斯框架下的黑列者模型

违抗ne the Universe of Assets

Thedowportfolio.xlsx数据集包括30个资产和一个基准。该数据集中的七个资产包括此示例中的投资宇宙。假定无风险费率为零。

t =可读取('dowPortfolio.xlsx');

违抗ne the asset universe and extract the asset returns from the price data.

AssetNames = ["AA",“ AIG”,"WMT","MSFT","BA",“ GE”,"IBM"]; benchmarkName ="DJI"; head(T(:,["Dates"benchmarkName assetNames]))
ans=8×9 tableDates DJI AA AIG WMT MSFT BA GE IBM ___________ _____ _____ _____ _____ _____ _____ _____ _____ 03-Jan-2006 10847 28.72 68.41 44.9 26.19 68.63 33.6 80.13 04-Jan-2006 10880 28.89 68.51 44.99 26.32 69.34 33.56 80.03 05-Jan-2006 10882 29.12 68.6 44.38 26.34 68.53 33.47 80.56 06-Jan-2006 10959 29.02 68.89 44.56 26.26 67.57 33.7 82.96 09-Jan-2006 11012 29.37 68.57 44.4 26.21 67.01 33.61 81.76 10-Jan-2006 11012 28.44 69.18 44.54 26.35 67.33 33.43 82.1 11-Jan-2006 11043 28.05 69.6 45.23 26.63 68.3 33.66 82.19 12-Jan-2006 10962 27.68 69.04 44.43 26.48 67.9 33.25 81.61
retnst = tick2ret(t(:,2:end));AssetRetns = retnst(:,, assetNames);benchretn = retnst(:,,,"DJI");numAssets = size(assetRetns, 2);

Specify Views of the Market

这些观点代表投资分析师关于未来市场变化的主观观点,称为 q = P * μ + ε , ε ~ N ( 0 , ω ) , ω = 诊断 ( ω 1 , ω 2 , ω v ) , wherevis total number of views. For more information, see the Appendix sectionAssumptions and Views。Withvviews andkassets, P is av-经过-kmatrix, q is av-经过-1 vector, and ω is av-经过-v诊断onal matrix (representing the independent uncertainty in the views). The views do not necessarily need to be independent among themselves and the structure of ω can be chosen to account for investment analyst uncertainties in the views [4]。The smaller the ω i in ω ,分布的差异越小ith view, and the stronger or more certain the investor'sith view. This example assumes three independent views.

  1. AIG is going to have 5% annual return with uncertainty 1e-3. This is a weak absolute view due to its high uncertainty.

  2. WMT is going to have 3% annual return with uncertainty 1e-3. This is a weak absolute view due to its high uncertainty.

  3. MSFT is going to outperform IBM by 5% annual return with uncertainty 1e-5. This is a strong relative view due to its low uncertainty.

v = 3;%总计3次观看p =零(v,numassets);Q =零(V,1);欧米茄=零(v);%的观点1P(1, assetNames==“ AIG”)= 1;q(1) = 0.05; Omega(1, 1) = 1e-3;% View 2P(2, assetNames=="WMT")= 1;Q(2)= 0.03;Omega(2,2)= 1E-3;%视图3P(3,AssetNames =="MSFT")= 1;P(3,AssetNames =="IBM") = -1; q(3) = 0.05; Omega(3, 3) = 1e-5;

Visualize the three views in table form.

viewTable = array2table([P q diag(Omega)],'VariableNames', [assetNames"View_Return""View_Uncertainty")))
viewTable=3×9 tableAA AIG WMT MSFT BA GE IBM View_Return View_Uncertainty __ ___ ___ ____ __ __ ___ ___________ ________________ 0 1 0 0 0 0 0 0.05 0.001 0 0 1 0 0 0 0 0.03 0.001 0 0 0 1 0 0 -1 0.05 1e-05

Because the returns fromdowportfolio.xlsx数据集是每日收益,视图是在年收益中,您必须将视图转换为每日收益。

bizyear2bizday = 1/252; q = q*bizyear2bizday; Omega = Omega*bizyear2bizday;

Estimate the Covariance from the Historical Asset Returns

σ is the covariance of the historical asset returns.

Sigma = cov(assetRetns.Variables);

违抗ne the UncertaintyC

The Black-Litterman model makes the assumption that the structure of C is proportional to the covariance σ 。Therefore, C = τ σ , where τ is a small constant. A smaller τ 表明对先前信念具有更高的信心 μ 。The work of He and Litterman uses a value of 0.025. Other authors suggest using 1/nwheren是用于生成协方差矩阵的数据点[3]。This example uses 1/n

tau = 1/size(assetRetns.Variables, 1); C = tau*Sigma;

市场均衡回报

In the absence of any views, the equilibrium returns are likely equal to the implied returns from the equilibrium portfolio holding. In practice, the applicable equilibrium portfolio holding can be any optimal portfolio that the investment analyst would use in the absence of additional views on the market, such as the portfolio benchmark, an index, or even the current portfolio [2]。In this example, you use linear regression to find a market portfolio that tracks the returns of the DJI benchmark. Then, you use the market portfolio as the equilibrium portfolio and the equilibrium returns are implied from the market portfolio. ThefindMarketPortfolioAndImpliedReturnfunction, defined inLocal Functions, implements the equilibrium returns. This function takes historical asset returns and benchmark returns as inputs and outputs the market portfolio and the corresponding implied returns.

[wtsMarket, PI] = findMarketPortfolioAndImpliedReturn(assetRetns.Variables, benchRetn.Variables);

Compute the Estimated Mean Return and Covariance

Use the P , q , ω , π , and C inputs to compute the blended asset return and variance using the Black-Litterman model.

You can compute μ - and cov ( μ ) 直接使用此矩阵操作:

μ - = [ P T ω - 1 P + C - 1 ] - 1 [ P T ω - 1 q + C - 1 π ] , cov ( μ ) = [ P T ω - 1 P + C - 1 ] - 1

mu_bl = (P'*(Omega\P) + inv(C)) \ ( C\PI + P'*(Omega\q)); cov_mu = inv(P'*(Omega\P) + inv(C));

比较黑人列者模型的混合预期回报与预期回报的先前信念 π , you find that the expected return from Black-Litterman model is indeed a mixture of both prior belief and investor views. For example, as shown in the table below, the prior belief assumes similar returns for MSFT and IBM, but in the blended expected return, MSFT has a higher return than IBM by more than 4%. This difference is due to the imposed strong view that MSFT outperforms IBM by 5%.

table(assetNames', PI*252, mu_bl*252,'VariableNames', ["Asset_Name",。。。"Prior_Belief_of_Expected_Return","Black_Litterman_Blended_Expected_Return")))
ans=7×3 tableAsset_Name Prior_Belief_of_Expected_Return Black_Litterman_Blended_Expected_Return __________ _______________________________ _______________________________________ "AA" 0.19143 0.19012 "AIG" 0.14432 0.13303 "WMT" 0.15754 0.1408 "MSFT" 0.14071 0.17557 "BA" 0.21108 0.2017 "GE" 0.13323 0.12525 "IBM" 0.14816 0.12877

文件夹Optimization and Results

The文件夹object in Financial Toolbox™ implements the Markowitz mean variance portfolio optimization framework. Using a文件夹object, you can find the efficient portfolio for a given risk or return level, and you can also maximize the Sharpe ratio.

UseestimateMaxSharpeRatiowith the文件夹object to find allocations with the maximum Sharpe ratio for the following portfolios:

  • 文件夹with asset mean and covariance from historical asset returns

  • 文件夹with blended asset return and covariance from the Black-Litterman model

端口=投资组合('NumAssets', numAssets,'磅', 0,'预算', 1,'Name','Mean Variance');port = setAssetMoments(port, mean(assetRetns.Variables), Sigma); wts = estimateMaxSharpeRatio(port); portBL = Portfolio('NumAssets', numAssets,'磅', 0,'预算', 1,'Name','Mean Variance with Black-Litterman');PORTBL = SetAssetMoments(PortBl,Mu_bl,Sigma + Cov_mu);wtsbl = estionAtemaxSharperatio(portbl);AX1 =子图(1,2,1);IDX = WTS> 0.001;PIE(AX1,WTS(IDX),AssetNames(IDX));标题(ax1,port.name,'位置', [-0.05, 1.6, 0]); ax2 = subplot(1,2,2); idx_BL = wtsBL>0.001; pie(ax2, wtsBL(idx_BL), assetNames(idx_BL)); title(ax2, portBL.Name ,'位置', [-0.05, 1.6, 0]);

table(assetNames', wts, wtsBL,'VariableNames', ["AssetName","Mean_Variance",。。。"Mean_Variance_with_Black_Litterman")))
ans=7×3 tableAssetName Mean_Variance Mean_Variance_with_Black_Litterman _________ _____________ __________________________________ "AA" 6.5494e-11 0.1115 "AIG" 6.6964e-12 0.23314 "WMT" 2.6063e-12 0.098048 "MSFT" 0.059393 0.15824 "BA" 0.32068 0.10748 "GE" 7.3366e-10 0.1772 "IBM" 0.61993 0.11439

When you use the values for the blended asset return and the covariance from the Black-Litterman model in a mean-variance optimization, the optimal allocations reflect the views of the investment analyst directly. The allocation from the Black-Litterman model is more diversified, as the pie chart shows. Also, the weights among the assets in the Black-Litterman model agree with the investment analyst views. For example, when you compare the Black-Litterman result with the plain mean-variance optimization result, you can see that the Black-Litterman result is more heavily invested in MSFT than in IBM. This is because the investment analyst has a strong view that MSFT will outperform IBM.

Local Functions

function[wtsMarket, PI] = findMarketPortfolioAndImpliedReturn(assetRetn, benchRetn)% Find the market portfolio that tracks the benchmark and its corresponding implied expected return.

暗示回报是通过反向优化计算的。假定无风险费率为零。Markowitz优化问题给出了投资组合优化的一般公式: arg max ω ω T μ - δ 2 ω T σ ω 。Here ω is anN- 资产权重的元素向量, μ is anN-element vector of expected asset returns, σ is theN-经过-Ncovariance matrix of asset returns, and δ is a positive risk aversion parameter. Given δ , in the absence of constraints, a closed form solution to this problem is ω = 1 δ σ - 1 μ 。Therefore, with a market portfolio, the implied expected return is π = δ σ ω m k t

To compute an implied expected return, you need σ , ω m k t , δ

1) Find σ

σ is calculated from historical asset returns.

Sigma = cov(assetRetn);

2) Find the market portfolio.

要找到市场组合,请回归DJI。施加的约束仅全面投入,并且很长一段时间: i = 1 n ω i = 1 , 0 ω i , i { 1 , , n }

numassets = size(Assetretn,2);lb =零(1,numassets);AEQ =一个(1,numassets);beq = 1;opts = optimoptions('lsqlin','算法',“内点”,'展示',"off");wtsMarket = lsqlin(assetRetn, benchRetn, [], [], Aeq, Beq, LB, [], [], opts);

3) Find δ

乘以 π = δ σ ω m k t with ω m k t T to output δ = S h a r p e R a t i o σ m 。在这里,假定基准是最大化夏普比率,并且相应的值用作市场夏普比。另外,您可以校准年度夏普比率为0.5,这导致shpr=0.5/sqrt(252)[1]。 σ m 是市场组合的标准偏差。

shpr = mean(benchRetn)/std(benchRetn); delta = shpr/sqrt(wtsMarket'*Sigma*wtsMarket);

4)计算隐含的预期收益。

Assuming that the market portfoliomaximizes the Sharpe ratio, the implied return, without the effects from constraints, is computed directly as π = δ σ ω

PI = delta*Sigma*wtsMarket;end

附录:贝叶斯框架下的黑色列者模型

Assumptions and Views

Assume that the investment universe is composed ofkassets and the vector of asset returns r is modeled as a random variable, following a multivariate normal distribution r ~ N ( μ , σ ) σ 是历史资产回报的协方差。未知模型参数是预期的回报 μ 。From the perspective of Bayesian statistics, the Black-Litterman model attempts to estimate μ 通过结合投资分析师的观点(或“对未来的观察”)和一些有关的先验知识 μ

此外,假设先验知道 μ is a normally distributed random variable μ ~ N ( π , C ) [1,2]。In the absence of any views (observations), the prior mean π is likely to be the equilibrium returns, implied from the equilibrium portfolio holding. In practice, the applicable equilibrium portfolio holding is not necessarily the equilibrium portfolio, but rather a target optimal portfolio that the investment analyst would use in the absence of additional views on the market, such as the portfolio benchmark, an index, or even the current portfolio. C 代表先验和黑色列者模型的不确定性,假设是 C is τ σ τ 是一个小常数,许多作者使用不同的值。关于 τ 可以在[3]。

观察对于执行对 μ 。In the Black-Litterman model, the observations are views about future asset returns expressed at the portfolio level. A view is the expected return of a portfolio composed of the universe ofk资产。通常,投资组合回报率uncertainty, so an error term is added to catch the departure. Assume that there is a total ofvviews. For a view i , p i is a row vector with dimension 1 xk, and q i is a scalar [2]。

q i = ε [ p i * r | μ ] + ε i , i = 1 , 2 , , v

你可以堆叠vviews vertically, and ω is the covariance of the uncertainties from all views. Assume that the uncertainties are independent.

q = ε [ P * r | μ ] + ε , ε ~ N ( 0 , ω ) , ω = 诊断 ( ω 1 , ω 2 , ω v )

Note that ω does not necessarily need to be a diagonal matrix. The investment analyst can choose the structure of ω to account for their uncertainties in the views [4]。

Under the previous assumption r ~ N ( μ , σ ) , 它遵循

q = P * μ + ε , ε ~ N ( 0 , ω ) , ω = 诊断 ( ω 1 , ω 2 , ω v )

The Bayesian Definition of the Black-Litterman Model

Based on Bayesian statistics, it is known that: posterior likelihood * prior

在黑人列者模型的背景下 posterior likelihood * prior is expressed as f ( μ | q ) f ( q | μ ) * f ( μ ) , where each Bayesian term is defined as follows [2]:

  • Thelikelihoodis how likely it is for the views to happen given μ and is expressed as f ( q | μ ) exp [ - 1 2 ( P μ - q ) ω - 1 ( P μ - q ) ]

  • Thepriorassumes the prior knowledge that μ ~ N ( π , C ) and is expressed as f ( μ ) exp [ - 1 2 ( μ - π ) C - 1 ( μ - π ) ]

  • Theposterioris the distribution of μ 给定的观点,并表示为 f ( μ | q ) exp [ - 1 2 ( P μ - q ) ω - 1 ( P μ - q ) - 1 2 ( μ - π ) C - 1 ( μ - π ) ]

As previously stated, the posterior distribution of μ is also a normal distribution. By completing the squares, you can derive the posterior mean and covariance as μ - = [ P T ω - 1 P + C - 1 ] - 1 [ P T ω - 1 q + C - 1 π ] , cov ( μ ) = [ P T ω - 1 P + C - 1 ] - 1

Finally, by combining the Bayesian posterior distribution of μ 的模型asset returns r ~ N ( μ , σ ) ,然后您将资产回报的后验预测为 r ~ N ( μ - , σ + cov ( μ ) )

参考

  1. Walters, J. "The Black-Litterman Model in Detail." 2014. Available at SSRN:https://papers.ssrn.com/sol3/papers.cfm?abstract_id=1314585

  2. Kolm, P. N., and Ritter, G. "On the Bayesian Interpretation of Black-Litterman."European Journal of Operational Research。卷。258,第2号,2017年,第564-572页。

  3. Attilio,M。“实践中的黑人列车人:一个五步的食谱,是对非正态市场的投入观点。”2006年。可在SSRN上找到:https://papers.ssrn.com/sol3/papers.cfm?abstract_id=872577

  4. Ulf, H. "Computing implied returns in a meaningful way."资产管理杂志。Vol 6, Number 1, 2005, pp. 53-64.

See Also

|||||||||

Related Examples

More About

外部网站