跳到正文

组合理论:分散化与有效前沿

现代组合理论表明,组合资产可以在不牺牲预期回报的情况下降低风险。这是机构组合如何构建的基础。

第 29 篇 · 共 30 篇 约 3 分钟

1952年,Harry Markowitz发表了一篇改变金融学的论文:组合选择。核心洞见是数学的:通过组合资产,你可以在不牺牲预期回报的情况下降低风险。这就是现代组合理论(MPT)。

核心洞见:分散化

不同资产不会完全同向变动。当一个下跌,另一个可能上涨。通过组合它们,你可以降低组合的整体波动性。

两资产组合方差的关键公式:

σp2=w12σ12+w22σ22+2w1w2σ1σ2ρ1,2\sigma_p^2 = w_1^2 \sigma_1^2 + w_2^2 \sigma_2^2 + 2w_1 w_2 \sigma_1 \sigma_2 \rho_{1,2}

其中:

  • w1,w2w_1, w_2 = 组合权重
  • σ12,σ22\sigma_1^2, \sigma_2^2 = 各资产方差
  • ρ1,2\rho_{1,2} = 资产间相关系数(-1到+1)

关键洞见: 如果ρ<1\rho < 1,组合方差小于各资产方差的加权平均。

当ρ=−1\rho = -1时: 你可以通过完美组合两个资产来构建一个无风险组合。

当ρ=+1\rho = +1时: 分散化没有好处。

最小方差组合

给定一组资产,什么权重使组合方差最小?

对于两个资产,你可以解析求解。对于多个资产,需要用优化:

wMVP=arg⁡min⁡w wTΣww_{MVP} = \arg\min_w \ w^T \Sigma w s.t. ∑wi=1\text{s.t.} \ \sum w_i = 1

其中Σ\Sigma是资产回报的协方差矩阵。

最小方差组合(MVP) 始终位于有效前沿上。

有效前沿

有效前沿是一组在给定风险水平下提供最高预期回报的组合。

对于前沿上的任何点:

  • 没有其他组合提供相同风险下的更高预期回报
  • 没有其他组合提供相同预期回报下的更低风险

关键形态:

  • 前沿下方的组合次优(相同风险,回报更低)
  • 资本市场线(CML) 从无风险利率延伸到与有效前沿相切的位置——在切点,你拥有最优风险组合(在CAPM中称为市场组合)

组合预期回报

组合预期回报就是各资产预期回报的加权平均:

E(Rp)=∑iwi⋅E(Ri)E(R_p) = \sum_i w_i \cdot E(R_i)

这是线性的且简单。复杂性在于方差。

相关系数与分散化

相关系数(ρ\rho)衡量两个资产一起变动的程度:

相关系数含义
+1.0资产完全同向变动
+0.5中度正相关
0无线性关系
-0.5中度负相关
-1.0资产完全反向变动

分散化的好处在相关系数低或为负时最大。

在危机时期,相关系数通常飙升趋近1——所有资产一起下跌。这就是为什么真正的分散化比看起来更难。

Python实现组合优化

import numpy as np
import pandas as pd
from scipy.optimize import minimize

def portfolio_return(weights, expected_returns):
    """Calculate portfolio expected return."""
    return np.dot(weights, expected_returns)


def portfolio_volatility(weights, cov_matrix):
    """Calculate portfolio volatility (standard deviation)."""
    return np.sqrt(np.dot(weights.T, np.dot(cov_matrix, weights)))


def minimum_variance_portfolio(expected_returns, cov_matrix):
    """
    Find the minimum variance portfolio.
    """
    n_assets = len(expected_returns)

    def portfolio_vol(w):
        return np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))

    constraints = {'type': 'eq', 'fun': lambda w: np.sum(w) - 1}
    bounds = tuple((-1, 1) for _ in range(n_assets))  # Allow shorting
    initial_weights = np.ones(n_assets) / n_assets

    result = minimize(portfolio_vol, initial_weights, method='SLSQP',
                     bounds=bounds, constraints=constraints)
    return result.x


def efficient_frontier(expected_returns, cov_matrix, n_portfolios=100):
    """
    Compute the efficient frontier.
    """
    n_assets = len(expected_returns)
    target_returns = np.linspace(np.min(expected_returns),
                                 np.max(expected_returns),
                                 n_portfolios)

    frontier = []

    for target in target_returns:
        def portfolio_vol(w):
            return np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))

        constraints = [
            {'type': 'eq', 'fun': lambda w: np.sum(w) - 1},
            {'type': 'eq', 'fun': lambda w: np.dot(w, expected_returns) - target}
        ]
        bounds = tuple((-1, 1) for _ in range(n_assets))
        initial_weights = np.ones(n_assets) / n_assets

        result = minimize(portfolio_vol, initial_weights, method='SLSQP',
                        bounds=bounds, constraints=constraints)

        if result.success:
            frontier.append({
                'target_return': target,
                'volatility': result.fun,
                'weights': result.x
            })

    return pd.DataFrame(frontier)


def max_sharpe_ratio_portfolio(expected_returns, cov_matrix, rf=0.0):
    """
    Find portfolio with maximum Sharpe ratio.
    """
    n_assets = len(expected_returns)

    def neg_sharpe(w):
        ret = np.dot(w, expected_returns)
        vol = np.sqrt(np.dot(w.T, np.dot(cov_matrix, w)))
        return -(ret - rf) / vol

    constraints = {'type': 'eq', 'fun': lambda w: np.sum(w) - 1}
    bounds = tuple((-1, 1) for _ in range(n_assets))
    initial_weights = np.ones(n_assets) / n_assets

    result = minimize(neg_sharpe, initial_weights, method='SLSQP',
                     bounds=bounds, constraints=constraints)
    return result.x

提示词

用 numpy、pandas 和 scipy.optimize.minimize 写一组马科维茨组合函数:组合预期回报、波动率、最小方差组合、有效前沿、最大夏普比率组合。

MPT的局限性

1. 输入敏感: 预期回报或相关系数的微小变化会产生截然不同的组合。

2. 相关系数不稳定: 相关系数随时间变化,尤其在危机时期。

3. 估计误差: 预期回报难以准确估计。协方差相对容易,但仍有噪声。

4. 正态性假设: MPT使用均值和方差,但回报分布有厚尾。

5. 卖空约束: 实践中许多投资者无法卖空。

这些局限性是Black-Litterman(1992年)和其他方法被开发出来的原因——解决输入敏感性问题。

核心要点

  • 当相关系数小于1时,分散化降低组合风险
  • 有效前沿包含所有最优组合(给定风险下最大回报)
  • 最小方差组合是前沿上风险最低的组合
  • 最大夏普比率组合是切点组合(CAPM中的最优风险组合)
  • MPT有真实局限性——输入有噪声,相关系数不稳定

参考文献

  • Markowitz, “Portfolio Selection.” Journal of Finance, 1952.
  • Sharpe, “Capital Asset Prices.” Journal of Finance, 1964.
  • Ang, Asset Management. Oxford University Press, 2014. ISBN: 978-0-19-995932-3.
  • Litterman, Modern Investment Management. Wiley, 2003. ISBN: 978-0-471-44375-7.