**Have a Question?**

**Phone:** +1 (888) 427-9486

+1 (312) 257-3777

Contact Us

# EWMA 101

Attachment | Size | |
---|---|---|

EWMA-tutorial.pdf |

After receiving several inquiries about the exponential weighted moving average (EWMA) function in NumXL, we decided to dedicate this issue to exploring this simple function in greater depth.

The main objective of EWMA is to estimate the next-day (or period) volatility of a time series and closely track the volatility as it changes.

## Background

Define as the volatility of a market variable on day n, as estimated at the end of day n-1. The variance rate is The square of volatility,, on day n.

Suppose the value of the market variable at the end of day i is . The continuously compounded rate of return during day i (between end of prior day (i.e. i-1) and end of day i) is expressed as:

Next, using the standard approach to estimate from historical data, we’ll use the most recent m-observations to compute an unbiased estimator of the variance:

Where is the mean of :

Next, let’s assume and use the maximum likelihood estimate of the variance rate:

So far, we have applied equal weights to all , so the definition above is often referred to as the equally-weighted volatility estimate.

Earlier, we stated our objective was to estimate the current level of volatility , so it makes sense to give higher weights to recent data than to older ones. To do so, let’s express the weighted variance estimate as follows:

Where:

- is the amount of weight given to an observation i-days ago.

So, to give higher weight to recent observations,

### Long-run average variance

A possible extension of the idea above is to assume there is a long-run average variance , and that it should be given some weight:

Where:

The model above is known as the ARCH (m) model, proposed by Engle in 1994.

## EWMA

EWMA is a special case of the equation above. In this case, we make it so that the weights of variable decrease exponentially as we move back through time.

Unlike the earlier presentation, the EWMA includes all prior observations, but with exponentially declining weights throughout time.

Next, we apply the sum of weights such that they equal the unity constraint:

For , the value of

Now we plug those terms back into the equation. For the estimate:

And the estimate can be expressed as follows:

Now, to understand the equation better:

For a larger data set, the is sufficiently small to be ignored from the equation.

The EWMA approach has one attractive feature: it requires relatively little stored data. To update our estimate at any point, we only need a prior estimate of the variance rate and the most recent observation value.

A secondary objective of EWMA is to track changes in the volatility. For small values, recent observations affect the estimate promptly. For values closer to one, the estimate changes slowly based on recent changes in the returns of the underlying variable.

The RiskMetrics database (produced by JP Morgan and made public available) uses the EWMA with for updating daily volatility.

**IMPORTANT:** The EWMA formula does not assume a long run average variance level. Thus, the concept of volatility mean reversion is not captured by the EWMA. The ARCH/GARCH models are better suited for this purpose.

### Lambda

A secondary objective of EWMA is to track changes in the volatility, so for small values, recent observation affect the estimate promptly, and for values closer to one, the estimate changes slowly to recent changes in the returns of the underlying variable.

The RiskMetrics database (produced by JP Morgan) and made public available in 1994, uses the EWMA model with for updating daily volatility estimate. The company found that across a range of market variables, this value of gives forecast of the variance that come closest to realized variance rate. The realized variance rates on a particular day was calculated as an equally-weighted average of on the subsequent 25 days.

Similarly, to compute the optimal value of lambda for our data set, we need to calculate the realized volatility at each point. There are several methods, so pick one. Next, calculate the sum of squared errors (SSE) between EWMA estimate and realized volatility. Finally, minimize the SSE by varying the lambda value.

Sounds simple? It is. The biggest challenge is to agree on an algorithm to compute realized volatility. For instance, the folks at RiskMetrics chose the subsequent 25-day to compute realized variance rate. In your case, you may choose an algorithm that utilizes Daily Volume, HI/LO and/or OPEN-CLOSE prices.

## FAQ

**Q 1:** Can we use EWMA to estimate (or forecast) volatility more than one step ahead?

The EWMA volatility representation does not assume a long-run average volatility, and thus, for any forecast horizon beyond one-step, the EWMA returns a constant value:

**Q 2:** What is the initial value of the variance (i.e. ) in the NumXL EWMA function? Can I set a different value?

Currently, we set the value to zero, but we set the variance at the end of first period equal to the square of return on that period to start the EWMA.

For a large data set, the value has very little impact on the calculated value.

Going forward, we are planning to avail an argument to accept user-defined initial volatility value.

**Q 3:** What is EWMA’s relationship to ARCH/GARCH Model?

EWMA is basically a special form of an ARCH() model, with the following characteristics:

- The ARCH order is equal to the sample data size.
- The weights are exponentially declining at rate throughout time.

**Q 4:** Does EWMA revert to the mean?

**NO.** EWMA does not have a term for the long-run variance average; thus, it does not revert to any value.

**Q 5:** What is the variance estimate for horizon beyond one day (or step) ahead?

As in Q1, the EWMA function returns a constant value equal to the one-step estimate value.

**Q 6:** I have weekly/monthly/annual data. Which value of I should use?

You may still use 0.94 as a default value, but if you wish to find the optimal value, you’d need to set up an optimization problem for minimizing the SSE or MSE between EWMA and realized volatility.

See our volatility 101 tutorial in “Tips and Hints” on our website for more details and examples.

**Q 7:** if my data does not have a zero mean, how can I use the function?

For now, use the DETREND function to remove the mean from the data before you pass it to the EWMA functions.

In future NumXL releases, the EWMA will remove the mean automatically on your behalf.

## References

- Hull, John C.; Options, Futures and Other Derivatives Financial Times/ Prentice Hall (2003),pp 372-374, ISBN 1-405-886145
- Hamilton, J .D.; Time Series Analysis , Princeton University Press (1994), ISBN 0-691-04289-6
- Tsay, Ruey S.; Analysis of Financial Time Series John Wiley & SONS. (2005), ISBN 0-471-690740

Attachment | Size |
---|---|

EWMA-tutorial.pdf | 187.24 KB |