Google Classroom
GeoGebraGeoGebra Classroom

Exponentially-Weighted Moving Average

This applet shows the behavior of a simple EWMA smoothing filter; EWMA stands for "Exponentially-Weighted Moving Average." The raw data is Normally-distributed, with a mean of 10, then an abrupt shift to 30, then back to 10, and an adjustable standard deviation ("zsigma" slider). The gain, or smoothing constant, for the EWMA is controlled with the "alpha" slider. The horizontal dotted lines are for the +/- "2-sigma" bounds for the raw data and the EWMA output (for the constant mean of 10). The variance reduction ratio (VRR) for this recursive filter can be shown to be alpha / (2 - alpha); see, e.g., Montgomery and Johnson "Forecasting and Time Series Analysis", Eq. 3-8, p52. Smaller values of alpha produce more variance reduction ("smoothing"), but at the price of a slower response to transients. This simple EWMA will also lag behind a linear trend; higher-order filters can account for this. Adaptive methods are available that can provide good variance reduction and, simultaneously, good transient response (e.g., see the Trigg and Leach method in Montgomery and Johnson, p176). Note that changing the zsigma slider will generate a new set of raw data. Select the slider (or the alpha slider) and then use the arrow keys for finer adjustments. Selecting the slider and then press the space bar for animation; this is most effective for the alpha slider. Notice that at the extremes, alpha = 0 produces just the starting value, constant across time, while alpha = 1 reproduces the original raw data. This follows from the EWMA recursion EMWA_out = alpha * RawInput + (1 - alpha)* EWMA_out where the initial EWMA_out is usually the average of the first few data points (here, we just use the known mean value of 10).