# Time-series analysis- calculating the seasonality and trend

Time-series analysis

If I could correctly guess this weekend’s lottery numbers, then the next article would be written in the Cayman Islands (I would still write the article, as not only am I a man of integrity but I have absolutely no doubt that Graham Hambly would hunt me down to my beach-side villa).

# Time-series analysis- calculating the seasonality and trend

Time-series analysis

If I could correctly guess this weekend’s lottery numbers, then the next article would be written in the Cayman Islands (I would still write the article, as not only am I a man of integrity but I have absolutely no doubt that Graham Hambly would hunt me down to my beach-side villa).

The problem is that it’s virtually impossible to accurately predict the future, so I suppose that I will have to make do with writing on my sofa in Cambridge. In your studies, you’ll see a variety of numerical techniques that allow us to improve our predictions, including linear regression, index numbers, the high-low method and the one that I am interested in for this article; time-series analysis.

Time-series analysis involves looking at what has happened in the recent past to help predict what will happen in the near future. For further reading, please see our article Index Numbers – Predicting the future!.

A ‘time-series’ is a sequence of results over a period of time. Let’s say that the monthly sales made by a business over a period are:

 Month Sales (the time-series) A time series will consist of distinct patterns and if we can identify these it makes it far easier to predict what might happen in the future. The two main patterns you need to understand are: 1.      Seasonal variations 2.      Trends 1 70 2 80 3 150 4 130 5 140 6 210

With time-series analysis we need to calculate both the seasonal variation and the trend.

#### Seasonal variation

A Seasonal Variation (SV) is a regularly repeating pattern over a fixed number of months. If you look at our time-series you might notice that sales rise consistently from month 1 to month 3, and then similarly from month 4 to month 6. There appears to be a SV repeating over a three month period, where sales get higher each month for three months. We could expect this pattern to repeat in the future, so sales are likely to rise from month 7 to month 9.

Trend

A Trend (T) is a long-term movement in a consistent direction. Trends can be hard to spot because of the confusing impact of the SV. The easiest way to spot the Trend is to look at the months that hold the same position in each set of three period patterns. For example, month 1 is the first month in the pattern, as is month 4. The sales in month 4 are higher than in month 1.

#### Identifying the trend

To identify the T, we need to smooth out the impact of the SV. We do this by calculating what are known as ‘three-period moving averages’. This involves averaging the sales for three months at a time and then ’moving’ down to the next three months.

 Month Sales (the time-series) Three-period moving average You can see that compared to the original time-series, the three-period moving average figures show a much more consistent increase; in fact it is increasing by 20 each month. We would expect this trend to continue in the future. (Notice that you can’t work out figures for the first or last month). 1 70 2 80 300/3 = 100 3 150 360/3 = 120 4 130 420/3 = 140 5 140 480/3 = 160 6 210

#### Identifying the seasonal variation

Now that we know the trend we can identify the specific impact of the SV. We do this by comparing the time-series to the trend, to see whether it is above or below what we would expect. In month 2, the time series of 80 is 20 below the trend giving a SV of -20. In month 3, 150 is 30 above the trend giving a SV of +30.

 Month Sales (the time-series) Three-period moving average (the trend) Seasonal variation 1 70 2 80 100 -20 3 150 120 +30 4 130 140 -10 5 140 160 -20 6 210

#### Predicting the future

We can now use our knowledge of T and SV to make a prediction of what sales will be in month 7.

Extrapolating T – We would expect T to continue to rise by 20 each month (remember it is a long-term movement in a consistent direction). This means that T in month 6 would rise to 180, and then in month 7 it will rise to 200. This doesn’t mean that we expect to sell 200 in month 7, as the seasonal variations mean that any given month will be above or below T.

Incorporating SV– Given our repeating three-period SV, month 7 will be the first month of a new pattern of three months. This means that month 7’s SV can be expected to be the same as month 1 (for which we have no figure) and month 4 where we have -10. This tells us that the result in month 7 can be expected to be 10 below trend.

Our prediction for month 7 will therefore be 200 – 10 = 190! Bear in mind that this is still ultimately an estimate and sales in month 7 are highly unlikely to be exactly 190.

#### Now try this time-series analysis question:

Sales from months 1 to 6 were 105, 140, 190, 135, 170 and 220 respectively. Assuming a three-period seasonal variation, identify the trend, the seasonal variations and then predict sales for months 7 and 8.

Once you have had a go, you can watch me work my answers:

It is possible that you might get a written question on time-series analysis, check out our blog on written questions.

For more news and exclusive tips from First Intuition, visit FI Hub.