Skip to main content

Someone wanted to learn this too, so Grasp built them a personal learning path.

You can keep exploring this one or create your own

Understanding the Sortino Ratio

Hello! Welcome to your next lesson on advanced performance and risk-adjusted returns.

In our last session, we mastered the Sharpe ratio, a powerful tool for measuring risk-adjusted returns. We saw how it helps compare different investments by asking, "Am I being sufficiently compensated for the total risk I'm taking?" However, we also touched upon its main limitation: the Sharpe ratio penalizes an investment for all volatility, both the painful plunges and the pleasant surprises.

This brings us to today's learning outcome: Calculate the Sortino ratio to assess risk-adjusted returns focusing on downside risk. The Sortino ratio is a refinement of the Sharpe ratio, designed for investors who intuitively feel that risk is about losing money, not about unexpected gains. For you as a real estate investor, this metric offers a more nuanced view, especially when comparing a volatile but high-growth opportunity against a more stable, income-focused property.

1. The Problem with "Good" Volatility

Let's revisit our two properties from the previous lesson:

  • Property A (Stable): Had steady returns around 6.9%. Its volatility was low.
  • Property B (Volatile): Had returns that swung from -1% to 12%. Its volatility was high.

The Sharpe ratio penalized Property B heavily for its high standard deviation. But was all of that volatility bad? A year with a 12% return is a positive event, not a risk in the conventional sense. The Sortino ratio addresses this by changing a single, crucial component: instead of using total volatility (standard deviation), it uses downside deviation.

2. Understanding Downside Deviation

Downside deviation (or downside risk) is a measure of volatility that only considers returns falling below a minimum acceptable return (MAR). It answers the question: "When this investment performs poorly, how volatile are those poor returns?"

Let's think about this conceptually. Imagine you are calculating the standard deviation for the following returns: [15%, -5%, 10%, -2%]. Standard deviation would consider the variation of all four numbers around the average.

To calculate downside deviation, you first set a threshold (your MAR, which we'll typically set as the risk-free rate). Let's say our MAR is 3%.

  1. We look at each return and see if it's below our 3% MAR.
  2. The returns 15% and 10% are above the MAR, so for the purpose of downside deviation, their deviation is treated as zero. We are not punished for these.
  3. The returns -5% and -2% are below the MAR. These are the only ones that contribute to our downside deviation calculation.

Essentially, we are calculating a standard deviation of only the "bad" outcomes.

The article below provides a great introduction to this idea.

Understanding Real Estate Performance through Sortino ...

The article 'Understanding Real Estate Performance through Sortino Ratios' explains how this metric modifies the Sharpe ratio to focus specifically on downside risk.

Read the section that begins 'A limitation of Sharpe Ratios...' and ends just before the comparison of Toronto and Vancouver. Pay close attention to the rationale for measuring only negative returns.

3. The Sortino Ratio Formula

With the concept of downside deviation in hand, the Sortino ratio formula is straightforward:

Let's break this down:

  • : The average return of the portfolio (or property).
  • : The Minimum Acceptable Return. This is your target. For consistency, we'll continue using the risk-free rate (e.g., the Spanish 10-year bond yield) as our MAR.
  • : The excess return over your minimum target. This is identical to the numerator of the Sharpe ratio.
  • : The downside deviation, our new measure of risk.

The image below provides a fantastic summary of the formula and its Python implementation.

The Sortino Ratio in Python
This image provides a concise overview of the Sortino Ratio, its formula for downside risk (DR), its key characteristics, and a Python code implementation.

4. A Worked Example: Sharpe vs. Sortino

Let's recalculate the risk-adjusted returns for our two properties using the Sortino ratio. We'll use the same MAR of 3.0%.

Property A (Stable)

  • Projected Returns: [6.5%, 7.0%, 5.5%, 8.0%, 7.5%]
  • Average Return (): 6.9%
  • Excess Returns vs. MAR: [3.5%, 4.0%, 2.5%, 5.0%, 4.5%]
  • Returns below MAR: None.
  • Downside Deviation (): 0.
  • Sortino Ratio: (infinite)

An infinite Sortino ratio means the investment never failed to meet your minimum acceptable return. It's a sign of extremely low downside risk.

Property B (Volatile)

  • Projected Returns: [2%, 12%, 5%, 11%, -1%]
  • Average Return (): 5.8%
  • Excess Returns vs. MAR: [-1.0%, 9.0%, 2.0%, 8.0%, -4.0%]
  • Returns below MAR: -1.0% and -4.0%.
  • Downside Deviation (): To calculate this, we take only the negative excess returns, square them, find the average over the entire sample, and then take the square root.
  • Sortino Ratio:

Comparison:

Metric Property A (Stable) Property B (Volatile)
Sharpe Ratio 4.06 0.51
Sortino Ratio 1.52

Notice that for Property B, the Sortino ratio (1.52) is much higher than its Sharpe ratio (0.51). This is because the Sortino ratio ignores the "good" volatility from the 12% and 11% return years and focuses only on the years that underperformed. It judges the property's risk-adjusted return more favorably because its upside potential is not penalized.

5. Python Implementation

Now, let's codify this logic. Your background in software engineering will make this implementation intuitive. We'll create a function that isolates the downside returns to calculate . The numpy library is perfect for this.

The following resource provides a very clean and professional Python function for the Sortino ratio.

How to measure your risk-adjusted returns with the Sortino ...

The article 'How to measure your risk-adjusted returns with the Sortino ratio' from PyQuant News offers a step-by-step guide to implementing this metric in Python.

Focus on 'Step 2: Compute the Sortino Ratio' and the associated 'A note on downside deviation'. The Python function presented uses np.clip, which is a very efficient way to isolate negative values. We will adapt this function for our real estate use case.

Here is the adapted Python code for our annual real estate projections.

import numpy as np

def calculate_sortino_ratio(projected_returns, min_acceptable_return):
    """
    Calculates the Sortino Ratio for a series of projected annual returns.
    
    Args:
        projected_returns (list or np.array): A list of projected annual returns.
        min_acceptable_return (float): The annual minimum acceptable return (e.g., risk-free rate).
        
    Returns:
        float: The annualized Sortino Ratio.
    """
    returns_arr = np.asanyarray(projected_returns)
    
    # Calculate the mean of the projected returns
    mean_return = np.mean(returns_arr)
    
    # Calculate returns relative to the MAR
    returns_risk_adj = returns_arr - min_acceptable_return
    
    # Isolate downside returns. np.clip sets all values > 0 to 0.
    downside_diff = np.clip(returns_risk_adj, np.NINF, 0)
    
    # Square the downside returns
    np.square(downside_diff, out=downside_diff)
    
    # Calculate annualized downside deviation
    # We use .mean() to divide by the total number of periods N.
    # Since our returns are annual, no sqrt(252) annualization factor is needed.
    downside_deviation = np.sqrt(downside_diff.mean())

    # Avoid division by zero
    if downside_deviation == 0:
        return np.inf

    # Calculate the Sortino Ratio
    sortino_ratio = (mean_return - min_acceptable_return) / downside_deviation
    
    return sortino_ratio

# --- Example Usage ---

# Data from our lesson
property_A_returns = [0.065, 0.070, 0.055, 0.080, 0.075] 
property_B_returns = [0.02, 0.12, 0.05, 0.11, -0.01]

# Set the Minimum Acceptable Return (MAR)
# (e.g., Spanish 10-year bond yield)
spanish_mar = 0.03

# Calculate Sortino Ratios
sortino_A = calculate_sortino_ratio(property_A_returns, spanish_mar)
sortino_B = calculate_sortino_ratio(property_B_returns, spanish_mar)

print("--- Downside Risk-Adjusted Return Analysis ---")
print(f"Property A Sortino Ratio: {sortino_A:.2f}")
print(f"Property B Sortino Ratio: {sortino_B:.2f}")

The output of this code confirms our manual calculations, demonstrating how the Sortino ratio provides a different, and often more intuitive, perspective on risk.

Test your understanding!

You are analyzing two properties in Valencia.

  • Property C (El Cabanyal): A riskier, up-and-coming area. Projected annual returns are [15%, -5%, 12%, -2%, 10%].
  • Property D (L'Eixample): A prime, stable district. Projected annual returns are [4%, 5%, 3.5%, 6%, 4.5%].

Assume the MAR is 3.0%. For both properties, calculate their Sharpe Ratio (from the last lesson's code) and their Sortino Ratio. Which property is superior according to each metric? Why do the metrics tell a potentially different story?

Show answer

Let's run the numbers. MAR = 0.03.

Property C (El Cabanyal):

  • Mean Return: 6.0%
  • Standard Deviation (Total Volatility): 8.75%
  • Excess Returns vs MAR: [12%, -8%, 9%, -5%, 7%]
  • Downside Deviation:
  • Sharpe Ratio: (0.06 - 0.03) / 0.0875 = 0.34
  • Sortino Ratio: (0.06 - 0.03) / 0.0422 = 0.71

Property D (L'Eixample):

  • Mean Return: 4.6%
  • Standard Deviation (Total Volatility): 0.96%
  • Excess Returns vs MAR: [1%, 2%, 0.5%, 3%, 1.5%]
  • Downside Deviation: (no returns are below the MAR)
  • Sharpe Ratio: (0.046 - 0.03) / 0.0096 = 1.67
  • Sortino Ratio: (0.046 - 0.03) / 0 =

Analysis:

  • According to the Sharpe Ratio, Property D (1.67) is vastly superior to Property C (0.34). The high total volatility of Property C makes it look very inefficient.
  • According to the Sortino Ratio, Property D () is still the clear winner. However, notice that Property C's Sortino ratio (0.71) is more than double its Sharpe ratio (0.34). This tells us that much of Property C's "risk" was actually upside volatility (the 15% and 12% years). While still riskier than Property D, the Sortino ratio acknowledges that its downside is not as bad as its total volatility might suggest. An aggressive investor might find Property C more interesting after seeing its Sortino ratio, even if Property D remains the more prudent choice.

Conclusion

Today, you've added a more sophisticated tool to your risk analysis toolkit. By isolating downside risk, the Sortino ratio aligns more closely with what most investors fear: the potential for losses.

Key Takeaways:

  • The Sortino Ratio improves upon the Sharpe ratio by penalizing only downside volatility.
  • It replaces total standard deviation () with downside deviation (), which measures the volatility of returns that fall below a Minimum Acceptable Return (MAR).
  • The formula is .
  • A higher Sortino ratio indicates a better return for the amount of "bad" risk taken. An infinite ratio means the investment never underperformed your target.
  • It is particularly useful for evaluating investments with asymmetric return profiles (i.e., those with the potential for large gains but also some losses).

Preview of the Next Lesson:
The Sharpe and Sortino ratios provide statistical measures of risk based on the dispersion of returns. But what if you want to know the single worst-case scenario that occurred in your historical or projected data? In our next lesson, we will learn to calculate the maximum drawdown, a metric that quantifies the largest peak-to-trough decline an investment has experienced. This gives us yet another crucial perspective on risk.

Can't find a good explanation? Sign up and we'll make it for you

Sign up