Mean-Semideviation Optimization

The Semideviation is the deviation of the portfolio returns below a minimum acceptable return, the downside risk that Markowitz (1959) proposed as the semivariance and that Estrada (2008) made practical for portfolio optimization. Returns above the threshold do not count, so the portfolio is not penalized for its upside.

The formula for the Semideviation starts from the return \(X_{t}\) of the portfolio in each of the T periods, with \(w_{i}\) the weight and \(r_{i , t}\) the return of asset i of the N assets, and the minimum acceptable return tau:

\[X_{t} = \sum_{i=1}^{N} w_{i} \cdot r_{i,t}\] \[\text{SD} = \sqrt{\frac{\sum_{t=1}^{T} \min\left(X_{t} - \tau, 0\right)^{2}}{T}}\]

Below the average return \(\mu_{p}\) of the portfolio instead of a fixed threshold, it divides by T - 1:

\[\text{SD} = \sqrt{\frac{\sum_{t=1}^{T} \min\left(X_{t} - \mu_{p}, 0\right)^{2}}{T - 1}}\]

The squares make deep losses weigh most. A threshold of zero penalizes losses only, and the mean as the threshold penalizes every period below average, whose square is about half the variance for symmetric returns.

It is the portfolio with the lowest risk, the lowest risk at a target return, or the highest ratio of the average excess return to the risk. Mean-variance analysis measures risk by the variance; the mean-risk portfolios keep its trade-off between expected return and risk and measure the risk of the historical portfolio returns in another way. Measures that only count losses leave upside swings unpenalized, the dispersion measures count deviations in proportion to their size rather than their square, and the drawdown measures penalize deep and long falls, which are what investors feel and what ends strategies.

There are two objectives. The minimum risk portfolio minimizes the risk measure, at a target expected return when one is given. The maximum ratio portfolio maximizes the expected excess return over the risk measure, with the transformation of Charnes and Cooper (1962) that turns the ratio into a problem of the same kind as the minimum risk one; with the volatility as the measure, it would be the maximum Sharpe ratio portfolio.

Also known as: semi-deviation, downside deviation, mean-semivariance, Sortino-optimal portfolio.

In the Finance Toolkit this is get_mean_risk_weights with risk_measure="semideviation", the same function as Mean-Risk Weights.

Example · AAPL, MSFT, JNJ, XOM · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_mean_risk_weights:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT", "JNJ", "XOM"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.portfolio.get_mean_risk_weights(
    risk_measure="semideviation", objective="maximum_ratio"
)[["Weight", "Expected Return", "Semideviation", "Semideviation Ratio"]]

Which returns:

References

  • Paper Charnes, A. and Cooper, W. W. (1962). “Programming with Linear Fractional Functionals.” Naval Research Logistics Quarterly, 9(3-4), 181-186.
  • Paper Markowitz, H. (1959). “Portfolio Selection: Efficient Diversification of Investments.” John Wiley & Sons, New York.
  • Paper Estrada, J. (2008). “Mean-Semivariance Optimization: A Heuristic Approach.” Journal of Applied Finance, 18(1), 57-72.
Share