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

Measuring Investment Volatility: Standard Deviation of Returns

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

In our previous lessons, we've focused on sophisticated ways to measure an investment's potential profitability, such as MIRR and the Profitability Index. These metrics are excellent for estimating how much you might earn. However, they don't tell the full story. A crucial part of any investment analysis is understanding the certainty or uncertainty of those projected returns.

Today, we shift our focus from return to risk. The learning outcome for this lesson is to calculate the standard deviation of projected returns to quantify investment volatility. Standard deviation is one of the most fundamental measures of risk in finance, and understanding it is the first step toward making truly risk-aware investment decisions.

1. What is Volatility and Why Does it Matter?

In investment terms, volatility is the degree of variation in an asset's returns over time. An investment with high volatility has returns that can swing dramatically, while one with low volatility has more stable, predictable returns.

Imagine two potential property investments, both with an expected average annual return of 8%:

  • Property A: Projections show its annual returns are likely to be in the 7% to 9% range.
  • Property B: Projections show its annual returns could be anywhere from -5% to +21%.

While both have the same average expected return, Property B is significantly riskier. Its outcomes are far more uncertain. Standard deviation is the statistical tool we use to put a precise number on this concept of "spread" or "dispersion."

For a conceptual overview of standard deviation as a measure of dispersion, the following resource provides a good starting point.

Standard Deviation & Variance - Python Tutorial

The article 'Standard Deviation & Variance - Python Tutorial' from Noble Desktop offers a clear explanation of what standard deviation represents.

Please read the initial section titled 'Standard Deviation Explained'. Focus on how standard deviation measures the spread of data around the mean and the visual intuition provided by the bell curve example.

2. The Mechanics of Calculating Standard Deviation

To calculate the standard deviation of a set of projected returns, we follow a clear, five-step process.

  1. Calculate the Mean (Average) Return: Sum all the projected annual returns and divide by the number of years (or scenarios).
  2. Calculate the Deviations: For each year's return, subtract the mean return. This tells you how far off that year's return is from the average.
  3. Square the Deviations: Square each of the deviations from Step 2. This makes all the values positive and gives more weight to larger deviations.
  4. Calculate the Variance: Sum all the squared deviations and divide by the number of periods minus one (n-1). This result is the variance.
  5. Calculate the Standard Deviation: Take the square root of the variance.

This process gives you a single number representing the typical deviation from the mean return.

Standard Deviation Formula and Example for Investments
This image shows the mathematical formula for standard deviation applied to investment returns, along with a worked example.

To see this calculation in action, let's watch a short video that walks through it step-by-step.

How to calculate Volatility using historical returns

The video 'How to calculate Volatility using historical returns' by Edspira provides an excellent, clear breakdown of the calculation process.

Watch the video from 0:40 to 4:10. Pay close attention to the sequence: calculating the mean, finding the squared deviations to get the variance, and finally taking the square root to find the standard deviation (volatility).

3. An Important Detail: Sample vs. Population

You might have noticed the video mentions dividing by n-1 (the number of data points minus one) instead of just n. This is a crucial distinction.

  • Population Standard Deviation: Used when you have data for an entire population. You divide by n.
  • Sample Standard Deviation: Used when your data is a sample of a larger population, which you are using to estimate the population's characteristics. You divide by n-1. This is known as Bessel's Correction.

In finance and real estate, we are always working with samples. Our projected returns are just a few scenarios out of a near-infinite number of possibilities. Therefore, we will always use the sample standard deviation to get a more accurate estimate of the investment's true volatility.

Exploring Standard Deviation Using Python
This summary image reinforces key concepts about standard deviation, including its formula, interpretation, and the important distinction of Bessel's Correction for sample data.

4. Applying Standard Deviation to Real Estate Projections

Unlike stocks, we don't have decades of historical daily prices for a specific property. Instead, we apply standard deviation to our projected returns from a multi-year cash flow model or from different scenarios (e.g., pessimistic, base, optimistic).

Let's say you've modeled the projected annual Cash-on-Cash (CoC) returns for a rental property over a 5-year holding period:

  • Year 1: 6.5%
  • Year 2: 7.0%
  • Year 3: 5.5%
  • Year 4: 8.0%
  • Year 5: 7.5%

Let's calculate the standard deviation for this stream of projected returns.

  1. Mean Return:
  2. Deviations and Squared Deviations:
Year Return Deviation (Return - Mean) Squared Deviation
1 6.5% -0.4% 0.0016%
2 7.0% 0.1% 0.0001%
3 5.5% -1.4% 0.0196%
4 8.0% 1.1% 0.0121%
5 7.5% 0.6% 0.0036%
Sum 0.0370%
  1. Variance (Sample):
  2. Standard Deviation (Sample):

Interpretation: For this investment, the projected average annual CoC return is 6.9%, with a standard deviation of 0.96%. This tells us the returns are expected to be quite stable. A higher standard deviation would indicate greater uncertainty in achieving the average return year after year.

5. Calculating Standard Deviation in Python

As a software engineer, you know there's a more efficient way to do this than by hand. The numpy library is the standard for numerical operations in Python.

When using numpy or pandas, it's critical to be mindful of that sample vs. population distinction.

  • The numpy.std() function by default calculates the population standard deviation (divides by n). To calculate the sample standard deviation, you must specify ddof=1 (Delta Degrees of Freedom).
  • The pandas.Series.std() function, on the other hand, calculates the sample standard deviation by default (ddof=1).

Since we are always dealing with samples, you should almost always use ddof=1 with NumPy for financial calculations.

Let's write a Python function to perform this calculation.

import numpy as np

def calculate_return_volatility(projected_returns):
    """
    Calculates the mean and standard deviation (volatility) for a list of projected returns.
    
    Args:
        projected_returns (list of float): A list of projected annual returns.
        
    Returns:
        tuple: A tuple containing the mean return and the sample standard deviation.
    """
    
    # Calculate the mean return
    mean_return = np.mean(projected_returns)
    
    # Calculate the sample standard deviation (volatility)
    # ddof=1 is crucial for calculating the SAMPLE standard deviation.
    std_dev = np.std(projected_returns, ddof=1)
    
    return mean_return, std_dev

# --- Example Usage ---

# Our previous example: fairly stable returns
property_A_returns = [0.065, 0.070, 0.055, 0.080, 0.075] 

# A more volatile investment with the same average return
property_B_returns = [0.02, 0.12, 0.05, 0.11, -0.01]

# Calculate metrics for Property A
mean_A, vol_A = calculate_return_volatility(property_A_returns)
print("--- Property A (Stable) ---")
print(f"Average Projected Return: {mean_A:.2%}")
print(f"Volatility (Std. Dev.): {vol_A:.2%}\n")

# Calculate metrics for Property B
mean_B, vol_B = calculate_return_volatility(property_B_returns)
print("--- Property B (Volatile) ---")
print(f"Average Projected Return: {mean_B:.2%}")
print(f"Volatility (Std. Dev.): {vol_B:.2%}")

Expected Output:

--- Property A (Stable) ---
Average Projected Return: 6.90%
Volatility (Std. Dev.): 0.96%

--- Property B (Volatile) ---
Average Projected Return: 5.80%
Volatility (Std. Dev.): 5.50%

The code confirms our manual calculation for Property A. More importantly, it clearly quantifies the risk difference between the two hypothetical properties. Even though their average returns might be similar in another scenario, Property B's volatility of 5.50% is over five times higher than Property A's, signaling a much riskier investment.

The approach of using numpy.std(data, ddof=1) is standard practice, as shown in the resource below which uses it to analyze stock volatility. The principle is identical for real estate projections.

12 Risk metrics for investments with Python. From standard ...

The article '12 Risk metrics for investments with Python' shows the direct application of NumPy for calculating standard deviation on financial data.

Review the section 'Standard deviation'. Note how the Python function calculate_standard_deviation uses np.std(). While the article doesn't specify ddof=1 (a common omission in online tutorials), for financial analysis, it is best practice to include it.

Test your understanding!

You are analyzing a property in Seville. Your model projects the following annual returns on investment (ROI) over a 4-year holding period based on three different economic scenarios:

  • Pessimistic Scenario: [2%, 3%, 3%, 4%]
  • Optimistic Scenario: [8%, 9%, 10%, 11%]

Calculate the average projected ROI and the volatility (sample standard deviation) for both scenarios. Which scenario presents more risk, and by how much? You can use the Python code from the lesson to verify your answer.

Show answer

Let's analyze both scenarios:

Pessimistic Scenario:

  • Average ROI: (2 + 3 + 3 + 4) / 4 = 3.0%
  • Standard Deviation: np.std([0.02, 0.03, 0.03, 0.04], ddof=1) = 0.82%

Optimistic Scenario:

  • Average ROI: (8 + 9 + 10 + 11) / 4 = 9.5%
  • Standard Deviation: np.std([0.08, 0.09, 0.10, 0.11], ddof=1) = 1.29%

Conclusion: The optimistic scenario, while projecting much higher returns, also carries higher volatility (1.29% vs 0.82%). The returns are more spread out from their average, indicating a slightly higher level of uncertainty in achieving that 9.5% average each year compared to the pessimistic case.

Conclusion

Today we've taken a significant step into the world of risk analysis. You can now quantify the volatility of an investment's projected returns using one of the most widely recognized metrics in finance.

Key Takeaways:

  • Standard Deviation measures the dispersion of returns around their average, serving as a key indicator of volatility and risk.
  • A higher standard deviation implies greater uncertainty and risk.
  • The calculation involves finding the square root of the variance.
  • For financial projections, it's crucial to use the sample standard deviation, which involves dividing by n-1 (or using ddof=1 in numpy).
  • In real estate, we apply this metric to our set of projected multi-year returns or to returns from different what-if scenarios.

Preview of the Next Lesson:
Measuring return and risk independently is useful, but the real power comes from combining them. How do you decide between a low-return, low-risk investment and a high-return, high-risk one? In our next lesson, we will answer this by learning to calculate the Sharpe ratio, a classic metric that measures risk-adjusted return.

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

Sign up