What is a time series?
A time series is data collected at equal time gaps: every day, month, quarter (3 months) or year. Examples: monthly rainfall, a city's daily temperature, a company's quarterly sales, India's yearly population.
We draw it as a time series graph: time on the x-axis, the value on the y-axis, points joined by straight lines. The lines in between only show the order; they are not real readings.
Trend, seasonal, cyclic and random variation
- Trend: the long-term direction (going up, down or flat).
- Seasonal variation: a pattern that repeats in a fixed period, such as every year (more umbrellas sold in the rainy season).
- Cyclic variation: longer waves that are not fixed in length, such as business booms and slumps lasting several years.
- Random variation: small, unpredictable ups and downs (a strike, a festival in a different month).
The seasonal ups and downs hide the trend. Moving averages remove them.
How to calculate a moving average
For quarterly data, use a 4-point moving average (4 quarters = 1 whole year, so each average contains every season once).
- Add the first 4 values and divide by 4.
- Drop the first value, add the next one, divide by 4 again.
- Keep going to the end.
Plot each average at the middle of its 4 time points (between the 2nd and 3rd). For monthly data you would use a 12-point average; for days of a school week, a 5-point average.
From 12 values you get 12 − 4 + 1 = 9 moving averages.
Trend line and seasonal variation (higher)
Draw a line of best fit through the moving-average points. This is the trend line. Its gradient tells how fast the values change per time step.
Seasonal variation for one point = actual value − trend value. Work it out for every Q1 (or every Q4 …) and take the mean: this is the mean seasonal variation for that season.
Forecast = trend value read from the extended trend line + mean seasonal variation. Forecasts are only estimates, and the further into the future, the less reliable.
Try it
In the 3D, slide the yellow box from start to end and write down all 9 moving averages. What is the difference between each? At home: write down your family's electricity bill (or phone data use) for each of the last 8 months. Find the 4-point moving averages. Is the trend rising or falling?
Key formulas and definitions
- 4-point moving average = (sum of 4 consecutive values) ÷ 4
- Number of n-point moving averages from N values = N − n + 1
- Plot each moving average at the middle of its time points
- Seasonal variation = actual value − trend value
- Mean seasonal variation = mean of the seasonal variations for that season
- Forecast = trend value + mean seasonal variation
Worked examples
1. Quarterly sales (₹ thousand): 20, 32, 28, 44, 24. Find the first two 4-point moving averages.
1st: (20 + 32 + 28 + 44) ÷ 4 = 124 ÷ 4 = 31. 2nd: drop 20, add 24: (32 + 28 + 44 + 24) ÷ 4 = 128 ÷ 4 = 32.
2. Where do you plot the first 4-point moving average for quarters 1 to 4?
At the middle of quarters 1, 2, 3, 4, which is 2.5 (halfway between quarter 2 and quarter 3).
3. How many 4-point moving averages can be found from 3 years of quarterly data?
3 years = 12 values. 12 − 4 + 1 = 9 moving averages.
4. Monthly visitors to a museum for one week (Mon–Sun) are recorded for 3 weeks. What size moving average should you use and why?
A 7-point moving average, because the pattern repeats every 7 days; each average then contains every day of the week once.
5. The trend line gives 40.5 for quarter 12, and the actual value is 52. Find the seasonal variation.
Seasonal variation = actual − trend = 52 − 40.5 = +11.5. The value is 11.5 above the trend.
6. The trend for quarter 13 is 41.5. The Q1 seasonal variations were −9.5, −9.5 and −9.5. Forecast quarter 13 (a Q1).
Mean seasonal variation for Q1 = −9.5. Forecast = 41.5 + (−9.5) = 32.
Common mistakes
- Plotting the moving average at the last of the 4 points instead of the middle.
- Using a 3-point or 5-point average for quarterly data; use 4 so each average holds one full year.
- Writing seasonal variation as trend − actual; it is actual − trend, and the sign matters.
- Drawing the trend line through the original points instead of the moving averages.