Excellent descriptions of the history and basic concepts related to Exponentially Weighted Moving
Average (EWMA) are available in text books, journal articles, and numerous web pages on the Internet,
some of which are listed in the references section.

This page will therefore provide only a brief summary and description, suffice to quickly orientate
the user, and in support of the calculations in the Exponentially Weighted Moving Average Program Page
.

Only the simplest model, as described by the NIST manual (see references) is prrovided. A paper by Lucas and the Seccicci
described further improvements, but they are not available in by StatsToDo.

Conceptually, EWMA is the same as averaging a number of consecutive observations, and by so doing it smooths out
short term variations. This prevents outlying values from distorting the long term trend of a set of observations.

The advantages of EWMA over averaging a set number of observations are firstly the values are weighted,
so that the more recent observations have greater influence on the averaging, and secondly, there is no need to
maintain a database of all the numbers and no need to define the number of observations needed for the averaging.

**>The Exponentially Weighted Average and coefficient λ**

A weighting coefficient lambda (λ) is used to assign the weight to the current observation (Y_{t}),
in relationship to the immediately previous EWMA value (EWMA_{t-1}), and combine them to produce the current EWMA
value (EWMA_{t}), so that EWMA_{t} = λY_{t} + (1 - λ)EWMA_{t-1}.

λ is a value between 0 and 1, and governs the amount of weight the current observation has in relationship
to all previous observations. A λ close to 1 means a strong dominance by the current observation,
with very little averaging. A λ close to 0 means a greater level of averaging, produces a smoother trend line,
but the trend is less responsive to immediate changes in the observations.

**>The Reference Mean and Standard Deviation**
These are provided by the user, either as the standards by which the new data are to be plotted against, or values
obtained by previous studies.

**The Standard Deviation of EWMA**
With weighted average, outlying values are brought closer to the mean, so that the original Standard Deviation is reduced.
If SD is the original Standard Deviation, and λ is the weighting coefficient, the Standard Deviation
of the resulting EWMA is SD_{EWMA} = sqrt((λ(2-λ)SD^{2})

With smoothing by weighted average, and a reduced SD_{EWMA}, a trend in the measurements that departs from
the mean can be more easily identified

**Rescaling of EWMA Plot**
Conventionally, EWMA are plotting with consecutive sample numbers in the x axis, and the measurements in the y axis.
Alert lines are then drawn at ±3 SD_{EWMA} from the mean. An alarm that the trend has departed from
expected is then raised when EWMA crosses one of the alert lines.

The algorithm used in the Exponentially Weighted Moving Average Program Page
transform the EWMA values to a mean of 0 and SD of 1, using the formula
EWMA_{plot} = z = (EWMA - mean) / SD x SD_{EWMA}

In so doing, the EWMA plot is always represented as the number of Standard Deviations from the mean, and the probabilities
of observing any of the EWMA values can be estimated by using the table in Probability of z Explained and Table Page. The actual
EWMA values are presented during calculation, and the y axis of the plot can be rescaled by reversing the transformation.

96.1 |

99.3 |

98.8 |

107.9 |

102.3 |

108.1 |

95.2 |

110.3 |

97.2 |

107.7 |

107.3 |

109.5 |

105.3 |

110.9 |

105.9 |

99.8 |

99.5 |

91.4 |

105.4 |

97.6 |

94.9 |

111.2 |

98.5 |

81.5 |

101.1 |

93.5 |

82.1 |

100.4 |

103.1 |

131.5 |

96.9 |

90.2 |

108.0 |

108.7 |

101.4 |

108.3 |

103.7 |

114.7 |

110.2 |

113.0 |

100.8 |

100.2 |

126.0 |

103.0 |

120.2 |

105.0 |

118.5 |

116.5 |

105.2 |

102.3 |

We will use the default example in the

Exponentially Weighted Moving Average Program Page
. The data is computer generated to demonstrate
the methodology and is not real.

We are investment advisors, and have created our own stock market index. Over the last month or so,
we know that this index runs with a mean of 100 and Standard Deviation of 10. We keep a close eye on this index
as we expect a boom to occur in the near future, and will want to advise our clients to invest heavily when it starts.
We obtained the data as shown in the table to the right

The plot of the values (or EWMA with the weighting coefficient λ=1) is shown to the right.
The plot is rescaled to a mean of 0 and SD of 1, so that the values can be interpreted as number
of Standard Deviations from the mean. It can be seen that the first 30 values are around the mean value,
and there is an up-trend in the last 20 values.

However, other than a single outlier, a decision is hard to make
because the short term variations are relatively large.

The figure to the left shows the EWMA plot when the weighting coefficient is set to λ=0.1. It can be seen that
nearly all the short term variations are removed, so that the Standard Deviation of EWMA is now 2.29 and not 10.
Because of this, the long term trend, represented by EWMA has reached the third Standard Deviation by the 45^{th}
observation, 15 after the trend began.

The dots represents the original data value. They are shown as comparison, to show how EWMA, by weighted averaging,
has greatly reduced the short term variations.

In most cases however, it is not necessary to set the weighting coefficient to such a low level, and the
value for λ between 0.2 and 0.4 is commonly recommended. The figure to the right shows the final plot,
where a λ of 0.3 was used. It can be seen that a decision that a boom had begun can be made on the 48^{th}
observation, 18 after the trend began.

This example therefore demonstrate the general principles of EWMA. The overall Standard Deviation depends on both the
longer term trend and the short term variations. Weighted averaging remove the short term variations, and leave the trend.
The reduction in short term variation also reduces the overall Standard Deviation, so by comparison, the changes in the
long term trend can be better identified statistically.