statrefs home‎ > ‎Main‎ > ‎Methods‎ > ‎Time Series‎ > ‎

Simple Moving Average


General Notes
 

Simple Moving Averages

SMAs are a form of smoothing, sometimes referred to as a linear data smoother or a linear filter.

The SMA is based on an average of the N most recent observations within the defined span (N).  The weights (1/N) are equally assigned to each observation.
  • MT = (1/N)*(yT + yT-1 + yT-2 + ... + yT-N+1)

Hanning Filter

A Hanning filter uses a centered moving average based on varying weights within the span..
  • An example:  MHt = 0.25*yt+1 + 0.5*yt + 0.25*yt-1

Centered Moving Average

A centered moving average is similar to the simple moving average, but is centered around the point at time T, with a span of S in each direction.  The total span N is equal to 2*S + 1.

NIST - centered moving average

Moving Medians

Moving Medians, sometimes also referred to as Running Medians, may be used then the time series has unusual values or outliers that have a disproportionate effect on the moving average


Effect on Variance

Effect on the variance of the original time series:
  • Assuming that the variance of each Yt is σ2 and the observations are independent (which is not always a good assumption for time series data, as many time series are autocorrelated), then the variance of the moving average is σ2/N; therefore, moving averages with larger spans will have less variation than those with smaller spans.


Other considerations

Even it the original time series data are independent (not autocorrelated), the moving averages will be autocorrelated because adjacent moving averages share N-1 observations.


A moving average filters out (smooths) high frequency aspects of the time series signal, and might be thought of as a low-pass filter.  Combining the effects of two moving averages with different spans produces something similar to a band-pass filter.



Possible disadvantages of a moving average:
  • There are robust approaches to smoothing that can reduce the impact of outliers.  One example is a Running Median (aka Odd Span Moving Median).
  • Example:  m[3] = med(yt-1, yt, yt+1)


Several R functions for moving average smoothing are noted in the file "01 Smoothing - Moving Average.docx" attached below.


 

Assumptions
 
 



References