Forecast Friday Topic: Decomposing a Time Series

(Twentieth in a series)

Welcome to our 20th Forecast Friday post. The last four months have been quite a journey, as we went through the various time series methods like moving average models, exponential smoothing models, and regression analysis, followed by in-depth discussions of the assumptions behind regression analysis and the consequences and remedies of violating those assumptions. Today, we resume the more practical aspects of time series analysis, with a discussion of decomposing a time series. If you recall from our May 3 post, a time series consists of four components: a trend component; a seasonal component; a cyclical component; and an irregular, or random, component. Today, we will show you how to isolate and control for these components, using the fictitious example of Billie Burton, a self-employed gift basket maker.

Billie Burton’s Gifts

Billie Burton has always loved making gift baskets and care packages, and has run her own business for the last 10 years. Billie knows that business seems to be increasing year after year, but she also knows that her business is seasonal. Billie is also certain that people don’t buy as many care packages and gift baskets when the economy is slow. She is trying to assess the impact of each of these components on her business. Since Billie’s business is a one-person shop and all her gift baskets are handmade (she doesn’t make the baskets or their contents, but assembles them, wraps them decoratively, and ships them), she is more concerned right now with forecasting the number of gift basket orders, rather than sales, so that she could estimate her workload.

So Billie pulls together her monthly orders for the years 2005-2009. They look like this:

Month 

TOTAL GIFT BASKET ORDERS 

2005 

2006 

2007 

2008 

2009 

January 

15 

18 

22 

26 

31 

February 

30 

36 

43 

52 

62 

March 

25 

18 

22 

43 

32 

April 

15 

30 

36 

27 

52 

May 

13 

16 

19 

23 

28 

June 

14 

17 

20 

24 

29 

July

12 

14 

17 

20 

24 

August 

22 

26 

31 

37 

44 

September 

20 

24 

29 

35 

42 

October 

14 

17 

20 

24 

29 

November 

35 

42 

50 

60 

72 

December 

40 

48 

58 

70 

84 

 

Trend Component

When a variable exhibits a long-term increase or decrease over the course of time, it is said to have a trend. Billie’s gift basket orders for the past five years exhibit a long-term, upward trend, as shown by the time series plot below:

Although the graph looks pretty busy and bumpy, you can see that Billie’s monthly orders seem to be moving upward over the course of time. Notice that we fit a straight line across Billie’s time series. This is a linear trend line. Most times, we plot the data in a time series and then draw a straight line freehand to show whether a trend is increasing or decreasing. Another approach to fitting a trend line – like the one I used here – is to use simple regression analysis, using each time period, t, as the independent variable, and numbering each period in sequential order. Hence, January 2005 would be t=1 and December 2009 would be t=60. This is very similar to the approach we discussed in our May 27 blog post when we demonstrated how our other fictitious businesswoman, Sue Stone, could forecast her sales.

In using regression analysis, to fit our trend line, we would get the following equation:

Ŷ= 0.518t +15.829

Since the slope of the trend line is positive, we know that the trend is upward. Billie’s orders seem to increase by slightly more than half an order each month, on average. However, when we look at the R2, we get just .313, suggesting the trend line doesn’t fit the actual data well. But that is because of the drastic seasonality in the data set, which we will address shortly. For now, we at least know that the trend is increasing.

Seasonal Component

When a time series shows a repeating pattern over time, usually during the same time of the year, that pattern is known as the seasonal component in the time series. Some time series have more than one period in the year in which seasonality is strong; others have no seasonality. If you look at each of the January points, you’ll notice that it is greatly lower than the preceding December and the following February. Also, if you look at each December, you’ll see that it is the highest point of orders for each year. This strongly suggests seasonality in the data.

But what is the impact of the seasonality? We find out by isolating the seasonal component and creating a seasonal index, known as the ratio to moving average. Computing the ratio to moving average is a four-step process:

First, take the moving average of the series

Since our data is monthly, we will be taking a 12-month moving average. If our data was quarterly, we would do a 4-quarter moving average. We’ve essentially done this in the third column of the table below.

Second, center the moving averages

Next, we center the moving averages by taking the average of each successive pair of moving averages, the result is shown in the fourth column.

Third, compute the ratio to moving average

To obtain the ratio to moving average, divide the number of orders for a given month by the centered 12-month moving average that corresponds to that month. Notice that July 2005 is the first month to have a centered 12-month moving average. That is because we lose data points when we take a moving average. For July 2005, we divide its number of orders, 12, by its centered 12-month moving average, 21.38, and get .561 (the number’s multiplied by 100 for percentages, in this example).

Month 

Orders 

12-Month Moving Average 

Centered 12-Month Moving Average

Ratio to Moving Average (%) 

Jan-05 

15 

     

Feb-05 

30 

     

Mar-05 

25 

     

Apr-05 

15 

     

May-05 

13 

     

Jun-05 

14 

21.25  

   

Jul-05 

12 

21.50  

21.38  

56.1  

Aug-05 

22 

22.00  

21.75  

101.1  

Sep-05 

20 

21.42  

21.71  

92.1  

Oct-05 

14 

22.67  

22.04  

63.5  

Nov-05 

35 

22.92  

22.79  

153.6  

Dec-05 

40 

23.17  

23.04  

173.6  

Jan-06 

18 

23.33  

23.25

77.4  

Feb-06 

36 

23.67  

23.50  

153.2  

Mar-06 

18 

24.00  

23.83  

75.5  

Apr-06 

30 

24.25  

24.13  

124.4  

May-06 

16 

24.83  

24.54  

65.2  

Jun-06 

17 

25.50  

25.17  

67.5  

Jul-06 

14 

25.83  

25.67  

54.5  

Aug-06 

26 

26.42  

26.13  

99.5  

Sep-06 

24 

26.75  

26.58  

90.3  

Oct-06 

17 

27.25  

27.00

63.0  

Nov-06 

42 

27.50  

27.38  

153.4  

Dec-06 

48 

27.75  

27.63  

173.8  

Jan-07 

22 

28.00  

27.88  

78.9  

Feb-07 

43 

28.42  

28.21  

152.4  

Mar-07 

22 

28.83  

28.63  

76.9  

Apr-07 

36 

29.08  

28.96  

124.3  

May-07 

19 

29.75  

29.42  

64.6  

Jun-07 

20 

30.58  

30.17  

66.3  

Jul-07 

17 

30.92  

30.75  

55.3  

Aug-07 

31 

31.67  

31.29  

99.1  

Sep-07 

29 

33.42  

32.54  

89.1  

Oct-07 

20 

32.67  

33.04  

60.5  

Nov-07 

50 

33.00  

32.83  

152.3  

Dec-07 

58 

33.33  

33.17  

174.9  

Jan-08 

26 

33.58  

33.46  

77.7  

Feb-08 

52 

34.08  

33.83  

153.7  

Mar-08 

43 

34.58  

34.33  

125.2  

Apr-08 

27 

34.92  

34.75  

77.7  

May-08 

23 

35.75  

35.33  

65.1  

Jun-08 

24 

36.75  

36.25  

66.2  

Jul-08 

20 

37.17  

36.96  

54.1  

Aug-08 

37 

38.00  

37.58  

98.4  

Sep-08 

35 

37.08  

37.54  

93.2  

Oct-08 

24 

39.17  

38.13  

63.0  

Nov-08 

60 

39.58  

39.38  

152.4  

Dec-08 

70 

40.00  

39.79  

175.9  

Jan-09 

31 

40.33  

40.17  

77.2  

Feb-09 

62 

40.92  

40.63  

152.6  

Mar-09 

32 

41.50  

41.21  

77.7  

Apr-09 

52 

41.92  

41.71  

124.7  

May-09 

28 

42.92  

42.42  

66.0  

Jun-09 

29 

44.08  

43.50  

66.7  

Jul-09 

24 

     

Aug-09 

44 

     

Sep-09 

42 

     

Oct-09 

29 

     

Nov-09 

72 

     

Dec-09 

84 

  

  

  

 

We have exactly 48 months of ratios to examine. Lets plot each year’s ratios on a graph:

At first glance, it appears that there are only two lines on the graphs, those for years three and four. However, all four years are represented on this graph. It’s just that all the turning points are the same, and the ratio to moving averages for each month are nearly identical. The only difference is in Year 3 (July 2007 to June 2008). Notice how the green line for year three doesn’t follow the same pattern as the other years, from February to April. Year 3’s ratio to moving average is actually higher for March than in all previous years, and lower for April. This is because Easter Sunday fell in late March 2008, so the Easter gift basket season was moved a couple weeks earlier than in prior years.

Finally, compute the average seasonal index for each month

We now have the ratio to moving averages for each month. Let’s average them:

RATIO TO MOVING AVERAGES 

Month 

Year 1 

Year 2 

Year 3 

Year 4 

Average 

July 

0.56 

0.55 

0.55 

0.54 

0.55 

August 

1.01 

1.00 

0.99 

0.98 

1.00 

September 

0.92 

0.90 

0.89 

0.93 

0.91 

October 

0.64 

0.63 

0.61 

0.63 

0.62 

November

1.54 

1.53 

1.52 

1.52 

1.53 

December 

1.74 

1.74 

1.75 

1.76 

1.75 

January 

0.77 

0.79 

0.78 

0.77 

0.78 

February 

1.53 

1.52 

1.54 

1.53 

1.53 

March 

0.76 

0.77 

1.25 

0.78 

0.89 

April 

1.24 

1.24 

0.78 

1.25 

1.13 

May 

0.65 

0.65 

0.65 

0.66 

0.65 

June 

0.68 

0.66 

0.66 

0.67 

0.67

Hence, we see that August is a normal month (the average seasonal index =1). However, look at December. Its seasonal index is 1.75. That means that Billie’s orders are generally 175 percent higher than the monthly average in December. Given the Christmas gift giving season, that’s expected in Billie’s gift basket business. We also notice higher seasonal indices in November (when the Christmas shopping season kicks off), February (Valentine’s Day), and in April (Easter). The other months tend to be below average.

Notice that April isn’t superbly high above the baseline and that March had one year where it’s index was 1.25 (when in other years it was under 0.80). That’s because Easter sometimes falls in late March. Stuff like this is important to keep track of, since it can dramatically impact planning. Also, if a given month has five weekends one year and only 4 weekends the next; or if leap year adds one day in February every four years, depending on your business, these events can make a big difference in the accuracy of your forecasts.

The Cyclical and Irregular Components

Now that we’ve isolated the trend and seasonal components, we know that Billie’s orders exhibit an increasing trend and that orders tend to be above average during November, December, February, and April. Now we need to isolate the cyclical and seasonal components. Cyclical variations don’t repeat themselves in a regular pattern, but they are not random variations either. Cyclical patterns are recognizable, but they almost always vary in intensity (the height from peak to trough) and timing (frequency with which the peaks and troughs occur). Since they cannot be accurately predicted, they are often analyzed with the irregular components.

The way we isolate the cyclical and irregular components is by first isolating the trend and seasonal components like we did above. So we take our trend regression equation from above, plug in each month’s sequence number to get the trend value. Then we multiply it by that month’s average seasonal ratio to moving average to derive the statistical normal. To derive the cyclical/irregular component, we divide the actual orders for that month by the statistical normal. The following table shows us how:

Month 

Orders  

Time Period 

Trend Value

Seasonal Index Ratio 

Statistical Normal 

Cyclical – Irregular Component (%) 

Y 

t 

T 

S 

T*S 

100*Y/(T*S) 

Jan-05 

15 

1 

16 

0.78  

12.72  

117.92  

Feb-05 

30 

2 

17 

1.53  

25.80  

116.27  

Mar-05 

25 

3 

17 

0.89  

15.44  

161.91  

Apr-05 

15 

4 

18 

1.13  

20.19  

74.31  

May-05 

13 

5 

18 

0.65  

12.01  

108.20  

Jun-05 

14 

6 

19 

0.67  

12.63  

110.86  

Jul-05

12 

7 

19 

0.55  

10.71  

112.09  

Aug-05 

22 

8 

20 

1.00  

19.88  

110.64  

Sep-05 

20 

9 

20 

0.91  

18.69  

107.02  

Oct-05 

14 

10 

21 

0.62  

13.13  

106.63

Nov-05 

35 

11 

22 

1.53  

32.92  

106.31  

Dec-05 

40 

12 

22 

1.75  

38.48  

103.95  

Jan-06 

18 

13 

23 

0.78  

17.56  

102.52  

Feb-06 

36 

14 

23 

1.53  

35.31

101.94  

Mar-06 

18 

15 

24 

0.89  

20.96  

85.86  

Apr-06 

30 

16 

24 

1.13  

27.20  

110.30  

May-06 

16 

17 

25 

0.65  

16.07  

99.57  

Jun-06 

17 

18 

25 

0.67

16.77  

101.34  

Jul-06 

14 

19 

26 

0.55  

14.13  

99.10  

Aug-06 

26 

20 

26 

1.00  

26.07  

99.72  

Sep-06 

24 

21 

27 

0.91  

24.36  

98.53  

Oct-06 

17

22 

27 

0.62  

17.02  

99.91  

Nov-06 

42 

23 

28 

1.53  

42.43  

98.99  

Dec-06 

48 

24 

28 

1.75  

49.33  

97.30  

Jan-07 

22 

25 

29 

0.78  

22.40  

98.23  

Feb-07 

43 

26 

29 

1.53  

44.83  

95.92  

Mar-07 

22 

27 

30 

0.89  

26.49  

83.06  

Apr-07 

36 

28 

30 

1.13  

34.21  

105.23  

May-07 

19 

29 

31 

0.65  

20.13  

94.41  

Jun-07 

20 

30 

31 

0.67  

20.92  

95.60  

Jul-07 

17 

31 

32 

0.55  

17.55  

96.88  

Aug-07 

31 

32 

32 

1.00  

32.26  

96.08  

Sep-07 

29 

33 

33 

0.91  

30.03  

96.58  

Oct-07 

20 

34 

33 

0.62  

20.90  

95.69  

Nov-07 

50 

35 

34 

1.53  

51.94  

96.27  

Dec-07 

58 

36 

34 

1.75  

60.19  

96.37

Jan-08 

26 

37 

35 

0.78  

27.23  

95.47  

Feb-08 

52 

38 

36 

1.53  

54.34  

95.70  

Mar-08 

43 

39 

36 

0.89  

32.01  

134.34  

Apr-08 

27 

40 

37 

1.13  

41.22  

65.50  

May-08 

23 

41 

37 

0.65  

24.18  

95.12  

Jun-08 

24 

42 

38 

0.67  

25.07  

95.75  

Jul-08 

20 

43 

38 

0.55  

20.97  

95.38  

Aug-08 

37 

44 

39 

1.00

38.45  

96.22  

Sep-08 

35 

45 

39 

0.91  

35.70  

98.05  

Oct-08 

24 

46 

40 

0.62  

24.79  

96.83  

Nov-08 

60 

47 

40 

1.53  

61.44  

97.65  

Dec-08 

70

48 

41 

1.75  

71.04  

98.54  

Jan-09 

31 

49 

41 

0.78  

32.07  

96.66  

Feb-09 

62 

50 

42 

1.53  

63.85  

97.10  

Mar-09 

32 

51 

42 

0.89  

37.53  

85.26  

Apr-09 

52 

52 

43 

1.13  

48.23  

107.81  

May-09 

28 

53 

43 

0.65  

28.24  

99.16  

Jun-09 

29 

54 

44 

0.67  

29.21  

99.27  

Jul-09 

24 

55 

44 

0.55  

24.39  

98.40  

Aug-09 

44 

56 

45 

1.00  

44.64  

98.56  

Sep-09 

42 

57 

45 

0.91  

41.37  

101.53  

Oct-09 

29 

58 

46 

0.62  

28.67  

101.14  

Nov-09 

72 

59 

46 

1.53  

70.95  

101.48  

Dec-09 

84 

60 

47 

1.75  

81.89  

102.58  

 

For the most part, Billie’s orders don’t seem to exhibit much cyclical or irregular behavior. In most months, the cyclical-irregular component ratio is pretty close to 100. Given her kind of business, we know this would be either not true or a fluke, since the recession of 2008 through 2009 would likely have meant a reduction in orders. In much of those months, we would expect to see a ratio well below 100. We do see that in much of 2005, the cyclical-irregular component for Billie’s gift basket orders are well above 100. It is very likely that in these years, Billie’s business was seeing a positive cyclical pattern. We then see irregular patterns in March and April of later years, where the cyclical-irregular component is also well above 100. That’s again the irregularity of when Easter falls. Not surprisingly, Easter has both a seasonal and irregular component!

This does not mean that Billie can kick up her feet and rest assured knowing that her business doesn’t suffer much from cyclical or irregular patterns. A deepening of the recession can ultimately sink her orders; a war can cut off the materials that are used to produce her gift baskets; a shortage or drastic price increase in the materials she uses can also force her prices higher, which in turn lowers her orders; her workshop could be destroyed in a flood or fire; and so on. To handle some of these irregular patterns – which are almost impossible to plan for – Billie would purchase insurance.

**********************************

Knowing the composition of a time series is an important element of forecasting. Decomposing the time series helps decision makers know and explain the variability in their data and how much of it to attribute it to trend, seasonal, cyclical and irregular components. In next week’s Forecast Friday post, we’ll discuss how to forecast using data that is seasonally-adjusted.

Advertisements

Tags: , , , , , , , , , , , ,

5 Responses to “Forecast Friday Topic: Decomposing a Time Series”

  1. Brian Says:

    Fantastic! Keep up this great work

  2. ted Says:

    uh – you need to redo your numbers and revise your conclusions. Your error is not aligning your moving averages to the proper month: the first 12 mos moving average is available in dec 2005 but you have it in jul 2005. that error then propagates through all of your numbers. In fact, quite a bit of seasonality is experienced.

    • analysights Says:

      Ted,

      In this case, we are trying to obtain centered moving averages, from which we could develop seasonal indices. The situation you seem to be describing would be more conducive to generating a forecast for January 2006 by taking the average of sales from January 2005 through December 2005. Centering is required for smoothing the time series in order to isolate the seasonal component.

      • ted Says:

        you are showing a 12 mos moving avg of 21.25 in Jun 05, which is the 6th data point in your series. however, 21.25 is the average of the 12 data points starting in jan 05 thru dec 05. shouldn’t then the 21.25 average be for Dec 05 not Jun 05?

  3. Forecast Friday Topic: Stationarity in Time Series Data « Insight Central Says:

    […] adjust for nonstationarity; in our discussions of regression analysis, we ensured stationarity by decomposing the time series (removing the trend, seasonal, cyclical, and irregular components), adding seasonal dummy variables […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: