Deriving Finite-Window EWMA Weights for Returns
Summary
The document derives a finite-history form of an exponentially weighted moving average (EWMA) when only the latest M observations are available. Starting from the recursive mean update, it repeatedly substitutes earlier updates to express the current estimate as a weighted sum of past returns plus a remaining term for the estimate before the observed window.
When that older estimate is unavailable, the derivation drops the residual term. The resulting truncated weights sum to less than one, so it rescales them by their total, yielding normalized weights across the M observations. A geometric-series calculation verifies the original weights total 1 minus lambda raised to M. The author says the same substitution logic can be applied to variance and covariance. The note gives an algebraic derivation, but does not discuss how to choose lambda, the effect of truncation on estimates, or whether normalization is appropriate for every application.
Key ideas
- Repeated substitution expands the recursive EWMA mean into a weighted sum of past returns and a residual older estimate.
- With only M observations, dropping the residual leaves weights that sum to less than one.
- Dividing by the retained weight total normalizes the finite-window weights.
- The derivation can be adapted to variance and covariance estimates.
Tags
Full text
# How to get formulas for EWMA model with M-day records
# How to get formulas for EWMA model with M-day records
Given following formula in exponential weighted moving average (EWMA) model
i: stock i t: time t rit: actual return for stock i at time t
If we only know latest M-day situation, how can we derive formula in below form
## Answer by Magic is in the chain (score 1, accepted)
https://quant.stackexchange.com/a/49271
Let's try the mean formula, and you can then apply the same logic to variance and covariance. We have:
$\mu_t=\left(1-\lambda\right)r_{t-1}+\lambda \mu_{t-1}$
Which means:
$\mu_{t-1}=\left(1-\lambda\right)r_{t-2}+\lambda \mu_{t-2}$
$\mu_{t-2}=\left(1-\lambda\right)r_{t-3}+\lambda \mu_{t-3}$
Now we can take the first formula:
$\mu_t=\left(1-\lambda\right)r_{t-1}+\lambda \mu_{t-1}$
and substitute for $\mu_{t-1}$:
$\mu_t=\left(1-\lambda\right)r_{t-1}+\lambda \left(1-\lambda\right)r_{t-2}+\lambda^2 \mu_{t-2}$
Then substitute for $\mu_{t-2}$:
$\mu_t=\left(1-\lambda\right)r_{t-1}+\lambda \left(1-\lambda\right)r_{t-2}+\lambda^2 \left(1-\lambda\right)r_{t-3}+\lambda^3 \mu_{t-3}$
You can continue, but let's try a short cut. We can write the above using the summation:
$\mu_t=\left(1-\lambda\right) \left(r_{t-1}+\lambda r_{t-2}+\lambda^2 r_{t-3} \right)+\lambda^3 \mu_{t-3}$
$\mu_t=\left(1-\lambda\right) \sum_{m=1}^3{\lambda^{m-1} r_{t-m}} +\lambda^3 \mu_{t-3}$
Now we can replace 3 by M:
$\mu_t=\left(1-\lambda\right) \sum_{m=1}^M{\lambda^{m-1} r_{t-m}} +\lambda^M \mu_{t-M}$
We don't know the terms beyond M, so we discard the $\mu_{t-M}$ term, but then the weight won't sum to 1 - the sum of the weights would be $1-\lambda^M$ as you can easily verify. So if we divide by $1-\lambda^M$, the weights will sum to one:
$\mu_t=\frac{1-\lambda}{1-\lambda^M} \sum_{m=1}^M{\lambda^{m-1} r_{t-m}} $
And that's the formula for the mean. You can apply the same logic to variance and covariance.
re-comment, how the weights sum to $1-\lambda^M$, expand the summation:
$S_w=\left(1-\lambda\right) \sum_{m=1}^M{\lambda^{m-1} }$
$S_w=\left(1-\lambda\right) \left(1+\lambda+\lambda^2+\dots+\lambda^{M-1} \right)$
Multiply by $\lambda$
$\lambda S_w=\left(1-\lambda\right) \left(\lambda+\lambda^2+\dots+\lambda^M \right)$
and then subtract from the original, and simplify:
$S_w-\lambda S_w=\left(1-\lambda\right)\left(1-\lambda^M \right)$
$ S_w=\frac{\left(1-\lambda\right)\left(1-\lambda^M \right)}{1-\lambda}=1-\lambda^M$
as desired.Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.