Exponentially Weighted Geometric Mean

The Exponentially Weighted Geometric Mean compounds the Exponentially Weighted Mean over a year, the yearly growth that the recent average return per period implies.

The formula for the Exponentially Weighted Geometric Mean starts from the smoothing factor alpha of the span n, the number of periods over which the weights spread:

\[\alpha = \frac{2}{n + 1}\]

It averages the returns \(r_{i , t}\) of asset i over the T periods with weights (1 - alpha)^(T - t) and compounds the average \(m_{i}\) over P, the number of periods in a year:

\[m_{i} = \frac{\sum_{t=1}^{T} (1 - \alpha)^{T - t} \cdot r_{i,t}}{\sum_{t=1}^{T} (1 - \alpha)^{T - t}}\] \[\mu_{i} = (1 + m_{i})^{P} - 1\]

It reads as a compounded annual return weighted towards the recent past, and lies above the Exponentially Weighted Mean for a positive average, as compounding adds the returns on returns.

It shows how much the choice moves the input that mean-variance weights are most sensitive to. The expected return of an asset can only be estimated from a short and noisy history: the precision of an average return grows with the length of the history in years, not with the number of periods within them, so even decades of data leave it imprecise. An optimizer that takes such estimates at face value bets most on the assets whose averages happen to be highest in the sample. The estimators differ in how they deal with this: by weighting recent periods, by deriving the returns from a model of risk, by shrinking the averages towards a common value or by using only an ordering of the assets.

Also known as: compounded EWMA return.

In the Finance Toolkit this is get_expected_returns_estimate with method="exponential_geometric", the same function as Expected Returns Estimate.

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

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

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_expected_returns_estimate(method="exponential_geometric", show_columns=["Mean", "Geometric", "Bayes-Stein", "James-Stein", "Bodnar-Okhrin-Parolya"])

Which returns:

References

  • Library Referenced against PyPortfolioOpt’s ema_historical_return (Exponentially Weighted Mean, Exponentially Weighted Geometric Mean)
Share