Sub topic 2
Measuring returns: simple and compounded
Every risk measure in this tutorial starts from returns. Volatility is the spread of returns, and a drawdown is a cumulative return measured from a peak. This chapter defines the return formulas, shows how they combine over time, and covers the mistakes that distort them.
This chapter assumes you know basic percentages and averages, know what stocks, bonds, and funds are, and can read a price chart. The code uses only the Python standard library.
Simple return
A simple return is the percentage change in value over one period:
r = (P_end / P_start) - 1
A price that moves from 100 to 105 has a return of 105 / 100 - 1 = 0.05, or 5%. Using the ratio P_end / P_start keeps the formula the same whether the period is a day, a month, or a year.
Price return versus total return
Price return counts only the change in price. Total return also counts cash paid out along the way, such as dividends or bond coupons. If a share rises from 100 to 104 and pays a 3 dividend, the price return is 4% and the total return is (104 + 3) / 100 - 1 = 7%.
For a dividend-paying stock or fund, price return understates what you earned. Index charts often show price-only series, so check which one you are looking at before comparing numbers.
Combining returns across periods
Returns over consecutive periods multiply. They do not add. Each period's return applies to the value left by the previous period, so the growth factors 1 + r chain together:
total return = (1 + r1) × (1 + r2) × ... × (1 + rn) - 1
This is called geometric linking or compounding. The next program computes daily returns from the price series used throughout this tutorial. It then confirms that linking them gives the same answer as comparing the first and last prices.
import math
prices = [100, 102, 99, 103, 101, 105]
simple = [prices[i] / prices[i - 1] - 1 for i in range(1, len(prices))]
log_r = [math.log(prices[i] / prices[i - 1]) for i in range(1, len(prices))]
total = prices[-1] / prices[0] - 1
growth = 1.0
for r in simple:
growth *= 1 + r
linked = growth - 1
arithmetic_mean = sum(simple) / len(simple)
geometric_mean = growth ** (1 / len(simple)) - 1
print(f"Total return (first vs last): {total:.2%}")
print(f"Total return (linked): {linked:.2%}")
print(f"Arithmetic mean per period: {arithmetic_mean:.2%}")
print(f"Geometric mean per period: {geometric_mean:.2%}")
print(f"Sum of log returns: {sum(log_r):.4f}")
print(f"ln(last / first): {math.log(prices[-1] / prices[0]):.4f}")The output is:
Total return (first vs last): 5.00%
Total return (linked): 5.00%
Arithmetic mean per period: 1.02%
Geometric mean per period: 0.98%
Sum of log returns: 0.0488
ln(last / first): 0.0488The arithmetic mean (1.02%) is larger than the geometric mean (0.98%). Only the geometric mean, when compounded five times, reproduces the actual 5% gain.
Why the arithmetic average misleads
Suppose an investment gains 50% in year one and loses 50% in year two. The arithmetic average is 0%, which suggests you broke even. The actual path is 100 → 150 → 75, a loss of 25%.
The geometric mean gives the honest figure: sqrt(0.75) - 1, about -13.40% per year. Applying -13.40% twice takes 100 to 75.
The gap between the two averages grows as returns become more volatile. With a small gap, the arithmetic mean is a reasonable shortcut. With large swings, it overstates what a buy-and-hold investor earned. This is the first link between returns and risk: variability itself reduces compound growth.
Compound annual growth rate
When you know only the start value, the end value, and the time elapsed, the geometric mean is called the compound annual growth rate (CAGR):
CAGR = (end / start) ^ (1 / years) - 1
def cagr(start, end, years):
return (end / start) ** (1 / years) - 1
print(f"{cagr(100, 180, 5):.2%}") # 12.47%
# Price return versus total return with a 3 dividend
price_return = 104 / 100 - 1
total_return = (104 + 3) / 100 - 1
print(f"{price_return:.2%} vs {total_return:.2%}") # 4.00% vs 7.00%
# Real return: remove inflation by dividing, not subtracting
nominal, inflation = 0.07, 0.03
real = (1 + nominal) / (1 + inflation) - 1
print(f"Real return: {real:.2%}") # 3.88%CAGR describes a smooth path that would end at the same place. The real path may have been far bumpier. Two investments with the same CAGR can differ greatly in how much they fell along the way, which later chapters measure with volatility and drawdowns.
Log returns
A log return (continuously compounded return) is the natural logarithm of the price ratio:
r_log = ln(P_end / P_start)
Log returns add across periods, which makes them convenient for statistics: the sum of daily log returns equals the log return over the whole span, as the code above showed (0.0488 both ways). They are also symmetric around zero. A move up by a factor of 2 and down by a factor of 2 give +ln 2 and -ln 2.
| Simple return | Log return |
|---|---|
| +1% | +0.995% |
| +10% | +9.53% |
| +50% | +40.55% |
| -10% | -10.54% |
| -50% | -69.31% |
For small moves the two are almost identical. For large moves they diverge, and the gap is widest for large losses. Note the trade-off:
- Simple returns add across assets. A portfolio's return is the weighted sum of its holdings' simple returns.
- Log returns add across time. A multi-year log return is the sum of the yearly ones.
Neither one adds across both dimensions. Use simple returns when you aggregate holdings or report results to people. Use log returns when you do time-series arithmetic. Convert back with exp(r_log) - 1 before showing a number to a reader.
Common errors
- Averaging returns and calling it growth. Use the geometric mean or CAGR for what you earned. The arithmetic mean is an input to statistics, not a growth rate.
- Mixing percent and percentage points. Going from a 4% return to a 6% return is up 2 percentage points, but a 50% relative increase. State which you mean.
- Ignoring dividends. Price-only series understate income-paying assets, and the gap compounds over decades.
- Subtracting inflation. The accurate real return is
(1 + nominal) / (1 + inflation) - 1. Simple subtraction is close for low inflation but drifts when inflation is high. - Annualizing a short run. Doubling in a month does not mean 4,000%+ per year. Extrapolating a short period assumes the same return repeats, which is rarely justified.
- Ignoring costs and taxes. Fees, trading costs, and taxes come out of the return you keep. A 1% annual fee is a 1% reduction in each period's growth factor.
- Mismatched periods. Daily, monthly, and annual returns cannot be compared or averaged together without conversion.
What comes next
With a list of period returns, you can measure how much they vary, which is volatility. Chaining them from a peak gives drawdowns. The next chapters build on these formulas directly.
Exercise
A fund gains 40% in year one and loses 40% in year two. Starting from 1,000, what is the ending value, the total return, the arithmetic average return, and the geometric mean annual return?
Show answer
Year one: 1,000 × 1.40 = 1,400. Year two: 1,400 × 0.60 = 840. Total return is 840 / 1,000 - 1 = -16%. The arithmetic average is (40% + -40%) / 2 = 0%, which hides the loss. The geometric mean is sqrt(0.84) - 1, about -8.35% per year.
Exercise
A stock rises from 50 to 56 over a year and pays a dividend of 2. A second investor holds an index fund that is up 9% in total return over the same year, with inflation at 4%. What is the stock's price return and total return, which investment did better, and what is the fund's real return?
Show answer
The stock's price return is 56 / 50 - 1 = 12%. Its total return is (56 + 2) / 50 - 1 = 16%. The stock did better than the fund's 9%. The fund's real return is 1.09 / 1.04 - 1, about 4.81%.