Short-term fluctuations or random noise in the data can obscure the underlying trend. Rolling averages help to mitigate this noise, making it easier to discern the overall direction of the data. This section outlines Rolling Averages.
Definition
A rolling average, also known as a moving average, is a statistical technique used to analyse trends within a dataset over a specified period.
Instead of considering the entire dataset at once, a rolling average calculates the average of a subset of data points within a sliding window, continually updating as new data becomes available. This approach provides a smoothed representation of the underlying trend, helping to filter out short-term fluctuations and highlight longer-term patterns.
Calculation
To compute a rolling average:
- Select a window size, which determines the number of data points included in each average calculation.
- Move this window along the dataset one observation at a time, recalculating the average each time by including the latest observation and dropping the earliest one
- Continue until the window covers the entire dataset.
Example
Lets say we have the following rainfall data:
0.8, 1.6, 3.4, 1.1, 28.1, 19.3, 35.6, 32.6, 28.4, 11.7
We want to calculate a rolling average (mean) of this, with a window of 4:
- Our first value is then the mean of our first four values:
0.8, 1.6, 3.4, 1.1
. That gives a value of 1.75
.
- Our next value is the mean of the second to fifth value:
1.6, 3.4, 1.1, 28.1
. This gives a value of 8.55
.
We continue this until we have used all of our values. Overall, we have seven values in our rolling average:
1.725 8.550 12.975 21.025 28.900 28.975 27.075