Exponentially Weighted Mean

The Exponentially Weighted Mean is the average return with weights that fall geometrically with the age of a period, so recent periods count most and the estimate follows changes in the trend.

The formula for the Exponentially Weighted 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 scales the average \(m_{i}\) to a year with 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} = P \cdot m_{i}\]

A short span reacts quickly to recent returns and is noisier still than the Historical Mean; recent winners get the highest expected returns, a bet on momentum rather than an estimate that is more precise.

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: EWMA return, exponential mean return.

In the Finance Toolkit this is get_expected_returns_estimate with method="exponential", 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", 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)
  • Library Referenced against Riskfolio-Lib’s mean_vector (Exponentially Weighted Mean, the recursion)
Share