Calculating moving medians
A moving median uses an odd number of consecutive responses. Order the responses, select the middle one and place it at the central time of the window
- Use a complete odd window Select the stated odd number of consecutive responses around the target period \(\displaystyle M_3=\operatorname{median}(x_1,x_2,x_3,x_4,x_5)\)
- Order the response values The median is the middle response after the values in the window are sorted \(\displaystyle \operatorname{median}(18,42,27,35,21)=\operatorname{median}(18,21,27,35,42)=27\)
- Keep the central time The selected response is placed at the time coordinate in the centre of the window \(\displaystyle M_3=27\text{ is placed at period }3\)
- Move through complete windows Move the window one period at a time and leave unsupported end periods without a median \(\displaystyle N=9,\ k=5\Rightarrow N-k+1=5\text{ supported values}\)
Worked example
A council depot records material collected over five consecutive weeks as 72, 55, 89, 61 and 78 tonnes. Find the 5-term moving median for Week 3
- \(\displaystyle 55<61<72<78<89\)Order the five responses from least to greatest
- \(\displaystyle \operatorname{median}(55,61,72,78,89)=72\)The third ordered response is the middle response
- \(\displaystyle M_3=72\text{ tonnes}\)Keep the central time of the window, which is Week 3
Common mistakes
Difficulty levels
Questions about this topic
Why must a moving-median window have an odd number of responses?+
An odd number of ordered responses has one middle response. An even window would require a separate midpoint convention rather than selecting one response
Why can a moving median reduce the effect of an isolated spike?+
If the spike is an extreme response in the window, it is placed at one end after sorting and may not change the middle response
Why are moving medians not assigned to the endpoints?+
The window must be complete and centred on the period. There are not enough observations to centre a full window at an endpoint
Can I use a calculator?+
A calculator is allowed unless a question is marked no calculator
Which year level and chapter is this?+
Year 12, VCE Units 3 & 4, General Mathematics, chapter 5: Time series