topic badge
AustraliaVIC
VCE 12 General 2023

4.03 Smoothing with moving median

Lesson

Introduction

Another method of smoothing time series data is using moving medians rather than means. This can help identify trends in the data by reducing or removing large fluctuations.

Calculate a moving median

Instead of finding the mean of a group of values, moving medians finds the median of a group of values. Recall that to find the median, the data must be ordered, and the middle number determined.

To calculate x, notice that the centre is in alignment with the three data points indicated in blue. These three data points are used to calculate the median.

The image shows a table of time period, raw data, 3-point median, and 5-point median. Ask your teacher for more information.

Looking at the data values for time periods 3,4, and 5, we can write them in ascending order to give 86,105,131. The median of these is 105.

So the three-point median value for time period 4 is 105. Therefore, x=105.

Similarly, to calculate y indicated in green use the using five-point moving median.

Arranging in ascending order we have 105,115,115,130,141. So the new value given for time period 9 using five-point moving median is 115.

The graph below illustrates the smoothing effect of these moving medians.

The image shows a graph with the raw data, 3-point median, and 5-point median. Ask your teacher for more information.

As with the moving means, the three-point moving median is better able to smooth the data compared with the five-point moving median, again because there are 3 seasons or points per cycle.

Note also that data points are lost when using moving medians, as with the process of moving means.

(Moving medians can be done with an even number of points too, but is not necessary in this course.)

Examples

Example 1

Consider the following table:

Calculate and fill in the missing values of the table.

\text{Time Period}\text{Data}\text{3 Point Median}
154\text{N/A}
245
35047
447
54247
64848
74948
843
94847
104747
113946
1246\text{N/A}
Worked Solution
Create a strategy

Arrange the group of three data points aligned to the missing value in ascending order to find the median.

Apply the idea

The first missing value is aligned to data points 54,45,50 which when arranged in ascending order will be 45,54,50, so the median is 54.

The third missing value is aligned to data points 49,43,48 which when arranged in ascending order will be 43,48,49, so the median is 48.

The second missing value is a data point aligned to the median 47 which means that it is included to the group of data points 50 and 42, so the missing data point is 47.

\text{Time Period}\text{Data}\text{3 Point Median}
154\text{N/A}
24554
35047
44747
54247
64848
74948
84348
94847
104747
113946
1246\text{N/A}
Idea summary

We can a smooth time series data by calculating the moving medians of each 3 or 5 data points in a table.

Work graphically

The method of moving medians is often easier to do directly onto a time series plot as in the following question.

Examples

Example 2

Consider the following Time Series Data.

Plot the 5 point moving median to the graph.

1
2
3
4
5
6
7
8
9
10
\text{time}
10
15
y
Worked Solution
Create a strategy

Find the median of a group of five x-coordinates and y-coordinates.

Apply the idea
1
2
3
4
5
6
7
8
9
10
\text{time}
10
15
y

The median of the first five x-coordinates is 3 and median of the first five y-coordinates is 4. So the first 5-point moving median is at (3,4).

The median of the second five x-coordinates is 4 and median of the second five y-coordinates is 13. So the second 5-point moving median is at (4,13).

Repeating the same steps will give us the next 5-point moving medians at (5,13),(6,13),(7,15), and (8,17).

Idea summary

We can smooth graphically by setting the median of a group of 3 or 5 x-coordinates and y-coordinates as the coordinates of 3 or 5 moving medians.

Outcomes

U3.AoS1.28

identify key qualitative features of a time series plot including trend (using smoothing if necessary), seasonality, irregular fluctuations and outliers, and interpret these in the context of the data

What is Mathspace

About Mathspace