Moving averages and means to smoothen noisy (time series) data, unearthing the underlying trends. The process is also known as filtering the data.
Moving averages (MA) are a series of averages estimated on a pre-defined number of consecutive data. For example, MA5 contains the set of all the averages of 5 successive members of the original series. The following relationship represents how a centred or two-sided moving average is estimated.
MA5 = (Xt-2 + Xt-1 + Xt + Xt+1 + Xt+2)/5
‘t’ represents the time at which the moving average is estimated. t-1 is the observation just before t, and t+1 means one observation immediately after t. To illustrate the concept, we develop the following table representing consecutive 10 points (electric signals) in a dataset.
Date | Signal |
1 | 72.5052 |
2 | 70.6720 |
3 | 62.4502 |
4 | 57.4714 |
5 | 55.3151 |
6 | 58.0904 |
7 | 62.6202 |
8 | 63.2485 |
9 | 60.5846 |
10 | 56.3154 |
The centred MA starts from point 3 (the midpoint of 1, 2, 3, 4, 5). The value at 3 is the mean of the first five points (72.5052 + 70.6720 + 62.4502 + 57.4714 + 55.3151) /5 = 63.68278.
Date | Signal | Average |
1 | 72.5052 | |
2 | 70.6720 | |
3 | 62.4502 | 63.68278 |
4 | 57.4714 | |
5 | 55.3151 | |
6 | 58.0904 | |
7 | 62.6202 | |
8 | 63.2485 | |
9 | 60.5846 | |
10 | 56.3154 |
This process is continued – MA on point 4 is the mean of points 2, 3, 4, 5 and 6, etc.
Date | Signal | MA |
1 | 72.5052 | |
2 | 70.6720 | |
3 | 62.4502 | 63.68278 [1-5] |
4 | 57.4714 | 60.79982 [2-6] |
5 | 55.3151 | 59.18946 [3-7] |
6 | 58.0904 | 59.34912 [4-8] |
7 | 62.6202 | 59.97176 [5-9] |
8 | 63.2485 | 60.17182 [6-10] |
9 | 60.5846 | |
10 | 56.3154 |
The one-sided moving average is different. It estimates MA at the end of the interval.
MA5 = (Xt-4 + Xt-3 + Xt-2 + Xt-1 + Xt)/5
Date | Signal | MA |
1 | 72.5052 | |
2 | 70.6720 | |
3 | 62.4502 | |
4 | 57.4714 | |
5 | 55.3151 | 63.68278 [1-5] |
6 | 58.0904 | 60.79982 [2-6] |
7 | 62.6202 | 59.18946 [3-7] |
8 | 63.2485 | 59.34912 [4-8] |
9 | 60.5846 | 59.97176 [5-9] |
10 | 56.3154 | 60.17182 [6-10] |
We will look at the impact of moving averages in the next post.