# Question on effective days of an exponentially weighted moving average model

I have been reading the book "RiskMetrics —Technical Document" by Longerstaey (J.P.Morgan) and Spencer (Reuters) (4th Edition, 1996). I am wondering what the effective days of the exponentially weighted moving average model (EWMA) mentioned in the book would be if I use a 2-day percentage change as also explained below.

On pages 93-95 of the book, it is stated that $$K$$, the effective days of the EWMA, can be calculated by: $$K = \frac{\log(\alpha)}{\log(\lambda)}.$$

For example, if one is interested in a confidence level of $$\alpha=1\%$$ with $$\lambda=0.99$$, $$K$$ comes out as 458 days, as also shown in the table on page 94.

On page 93, it is also stated that the formula above for $$K$$ is what one gets if the following equation is solved for $$K$$:

$$\lambda^{K}(1-\lambda)(1+\lambda+\lambda^2+\dots)=\alpha.$$

I have proven this as follows:

\begin{align*} \lambda^{K}(1-\lambda)(1+\lambda+\lambda^2+\dots)&=\alpha \\ \lambda^{K}&=\frac{ \alpha}{(1-\lambda)(1+\lambda+\lambda^2+\dots)} \\ \log( \lambda^{K})&=\log\left(\frac{ \alpha}{(1-\lambda)(1+\lambda+\lambda^2+\dots)} \right) \end{align*}

Because $$1+\lambda+\lambda^2+\dots$$ is a geometric series and $$|\lambda|<1$$, it converges to $$\frac{1}{1-\lambda}$$. Then,

\begin{align*} K\log( \lambda) &= \log\left(\frac{ \alpha}{(1-\lambda)(\frac{1}{1-\lambda})} \right)\\ K\log( \lambda) &= \log(\alpha)\\ K &= \frac{\log(\alpha)}{\log( \lambda)}. \\ \end{align*}

My questions are:

1. What happens if I use a 2-day percentage change such as $$r_{t} = \frac{y_{t-2}}{y_t}-1$$?
2. With $$r_{t}$$ defined just as above, how would the effective number of days change when, for example, $$\lambda=0.99$$ and $$\alpha=1\%$$? Or would it remain the same at 458, and why?
• Hi: you're derivation of the formula is fine and I didn't read the article but I don't think the confidence interval interpretation is correct. As far as I can tell, K represents the number of days you would need to be exponentially smoothing so that the weight of the initial observation becomes $\alpha$ of what it was initially ( which is 1). Also, it's good to write out the exponential smoothing relation being used because there are always two different ways to write it. Sep 26, 2022 at 1:51
• I forgot to comment on your other question. Note that my interpretation wouldn't change if you use $r_t$. Keep in mind though that I didn't read the article so maybe what they mean by confidence is equivalent to my interpretation ? Sep 26, 2022 at 1:53
• In my point of view, the equation on p93 does not talk about confidence, but on error tolerance (on the side of the modeller). Clearly, the index of summation starts at $K$ going up to infinity, and it sums over the weights that we want to use in the EWMA formula. We are simply saying: "Ah, let's drop 1% of the relative weights' worth of data". Sep 26, 2022 at 8:00
• yes. I think that lines up with what I said about K being the number of smoothed periods needed so that the total sum of the weight equals whatever, I think it was $(1-\alpha)$. So, if you're stop smoothing at K days, you'll be giving your observation $(1-\alpha)$ so $\alpha$ was getting washed out to see which is what they call confidence when it's really tolerance. Sep 29, 2022 at 5:05
• Now I see what you mean regarding dividing them by $(1-\lambda^K)$ providing you're not doing anything past K. I didn't read the paper so I never saw the usage of this thing $K$ so when you said divide , I thought that you mean the whole series. but I'm getting a little better understanding now, given the definition.. I've dealt with ES for a long time and never saw this usage. So, my bad on that one. Sep 29, 2022 at 5:09

The EWMA is a weighting scheme. Calculating the EWMA $$Z$$ of some input signal $$X$$, the EWMA is defined as:

$$Z_t\equiv (1-\lambda)\sum_{t=1}^T \lambda^{t-1}X_t$$

At closer inspection, we find that, usually, $$T<<\infty$$, and hence the weights do not sum to 1:

$$(1-\lambda)\sum_{t=1}^T\lambda^{t-1}=(1-\lambda)\frac{1-\lambda^T}{1-\lambda}=1-\lambda^T<1$$

If you'd simply replace the leading $$1-\lambda$$ with $$\frac{1-\lambda}{1-\lambda^T}$$, there would be no need for a 'tolerance level'. It has nothing to do with a confidence level (in the statistical sense).

Regarding your question: It does not matter whether you use daily or 2-day returns. Instead of $$N$$ daily returns, you now use $$N$$ returns, looking back for a longer time period.

HTH?

• @KermitFrog: I see what you mean but as one smooths further and further out, the goal is to have the total weight of any individual past observation to sum to 1 so replacing the leading $(1−\lambda)$ with $\frac{1-\lambda}{1-\lambda^T}$ is not a good idea. Note that, given the summation and the finite-ness problem that you pointed out, my comment was wrong and should be changed to "$K$ is defined so that, as smoothing goes on and on, the % total weight given to the initial observation by the $K$th day approaches $(1-\alpha)$ in the limit". Thanks for your comment. It helped a lot. Sep 26, 2022 at 14:45
• My question is the 1 day returns or the 2 or the n th day returns are 458 under ewma framework?T how big might be according to the periodicity or the returns?I understand the “confidence” issue here but don’t stick to it too much. It is just a non parametric approach.The number of days is my main concern.Thank you in advance for for your clarified answer as posted.
– user64706
Sep 27, 2022 at 14:15
• Hi, please have a look at the updated answer. Sep 28, 2022 at 6:06
• Hi: As Kermittfrog explained, you just make sure that you smooth the thing that you want to smooth. Then the same formula for K holds only you can call it "smoothing periods" instead of days. Sep 28, 2022 at 13:34
• Note though that if you do that 2 day return calc, then create independent 2 day returns by making sure you don't overlap anything when calculating it. For example, 4 one day returns only results in 2 two day returns. No overlap on the raw observations. Sep 29, 2022 at 5:17

Define the continuous-time analogue of the discrete time EWMA: $$\quad e^{-H \tau} := \lambda^M$$

Therefore $$H = -252 ln (\lambda)$$, assuming $$M=252$$ (number of daily observations in $$\tau = 1yr$$)

We wish to calculate the effective window length, define as $$L = \frac{ \int_0^T \tau . e^{-H \tau} d \tau } { \int_0^T e^{-H \tau} d \tau }$$

Integrating top and bottom we find $$L = \frac{ \frac{1}{H^2} \Big [ 1 - e^{-H T}(1 + H T) \Big ] } { \frac{1}{H} \Big [ 1 - e^{-H T} \Big] }$$

As $$T \rightarrow \infty$$, we have $$L \rightarrow \frac{ \frac{1}{H^2} \Big [ 1 - 0 \Big ] } { \frac{1}{H} \Big [ 1 - 0 \Big] } = \frac{1}{H}$$

So given $$\lambda$$ (which is typically quoted as a daily-discrete observation, you find that the effective window length is $$\frac{1}{-252 ln(\lambda)}$$.

Obviously if your $$\lambda$$ is monthly, then this becomes $$L= \frac{1}{-12 ln(\lambda)}$$, etc

Aside: the nice thing about the continuous-time EWMA is it can be applied $$\textit{without adjustment}$$ to observations which are asynchronous. i.e. intraday measures where the return between adjacent spot observations include close-to-open as well as intraday ones.

• Sorry for the delay comment.So to my understanding this continuous time analog can be applied in the Intraday risk calculation under Ewma framework?
– user64706
Oct 1, 2022 at 9:31
• Sure, try it yourself and see Oct 1, 2022 at 15:23