You are on page 1of 10

TIME SERIES ANALYSIS 2 - FORECASTING

In this lecture we shall produce forecasts using a seasonal model. Non-seasonal forecasting is covered by Chapter 13 of Business statistics. Last week we produced an Additive model for the Ice-cream sales data. Was this appropriate? If so: 1. The plot of the observed data should show a steady repeated pattern and be close to that of the fitted values; 2. the plot of the trend should be fairly smooth and steady without too many fluctuations; 3. the first residuals, those between the trend and the observed values, should have a mean which is much smaller than the observed values; 4. the second residuals, those between the fitted and observed values, should have a mean of zero and a much reduced standard deviation from that of the observed values. 1 and 2 See the incomplete graph from last week repeated on the last page. 3 and 4 Summary Statistics (as calculated last week) Sales First residuals Second residuals Mean = 54.375 Mean = - 0.366 Mean = - 0.002 Standard deviation = 20.238 Standard deviation = 16.935 Standard deviation = 2.770

This model therefore seems satisfactory so we shall use it to predict future Ice-cream sales. Forecasting using an Additive model (from last week) Additive model Observed Sales value A = = Trend value T + + Seasonal factor S + + Random factor R

The Trend value is the value of the sales had the seasonal effect been 'averaged out'. The Seasonal factor is the average effect of it being a particular quarter. The Random factor is the random variation due to neither of the previous variables. When using this model for forecasting the Random factor is left out of the equation for the single figure forecast but re-introduced when the likely accuracy is estimated as a range. The Trend value is estimated from the extended trend line over the next four quarters on your graph. Use your own best judgement in extending this line. If you have any background information concerning future sales, this should be taken into account. The Seasonal factor is the average of the previous deviations from the trend line for that particular season. Forecast Extended Seasonal = + Additive model Sales value Trend value factor F = T + S

Forecasts Read off the values from your extended trend line, note them in the table below, and add to them the appropriate seasonal factor to get your forecast. Additive model Extended Trend value (T) + Seasonal factor (S) (- 14.17) (+ 6.08) (+22.92) (-16.25) = Forecast Sales value (F)

2001 Quarter 1 2001 Quarter 2 2001 Quarter 3 2001 Quarter 4

+ + + +

= = = =

Add your forecasts to your graph to check that the past pattern follows into the future. Maximum likely error in forecasts How good are these forecasts?

The second residuals are the measure of the discrepancy in the past between the model and the observed data. Assuming that the conditions from the past are continuing into the future, there seems no reason why they should not remain, on average, the same size. They are therefore used to estimate the size of the forecasting errors. If they are shown to be small and randomly distributed about zero, then it can be assumed that the error in the forecasts is not likely to be more than twice the standard deviation of the second residuals. (Think 95% confidence interval!) The standard deviation of the second residuals = 2.770 ('000) so the maximum likely error is 2 x 2 700 = 5540. Your forecasts should therefore be quoted as: 2001 Quarter 1 2001 Quarter 2 2001 Quarter 3 2001 Quarter 4 5540 5540 5540 5540 = = = =

A final rounding to the nearest hundred seems reasonable. 2001 Quarter 1 2001 Quarter 2 2001 Quarter 3 2001 Quarter 4 5500 5500 5500 5500 = = = =

Deseasonalising seasonal data In order to compare figures from consecutive quarters the effect due to it being a particular quarter needs to be eliminated. How can we compare the ice-cream sales in summer with those in winter? We 'deseasonalise' the observed sales figures. Observed Sales 2000 Quarter 1 2000 Quarter 2 2000 Quarter 3 2000 Quarter 4 50 70 100 50 Seasonal factor Deseasonalised sales

= = = = =

So having removed the amount due to each quarter we can see that quarters 1 and 2 were very similar but that quarter 3 showed an increase, in real terms, of 13 120 over quarter 2. This was followed by a decrease in sales of 10 830 between quarters 3 and 4. It now makes sense to calculate percentage changes, compare with published indexes, etc. The deseasonalised values can be compared to the trend value at any point in time to see whether, say, sales are progressing better or worse than the general trend at that time.

Minitab output for this data


Time series plot for Ice-cream Sales
100 90

Ice cream sales

80 70 60 50 40 30 0 5 10 15

Quarters

We can see that this is quarterly data which can be described well by an additive model. Time series Decomposition
ROW 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 QUARTER 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 THE DATA 40 60 80 35 30 50 60 30 35 60 80 40 50 70 100 50 TREND * * 52.500 50.000 46.250 43.125 43.125 45.000 48.750 52.500 55.625 58.750 62.500 66.250 * * 1ST.RESD * * 27.500 -15.000 -16.250 6.875 16.875 -15.000 -13.750 7.500 24.375 -18.750 -12.500 3.750 * * SEASONAL * * 22.9167 -16.2500 -14.1667 6.0417 22.9167 -16.2500 -14.1667 6.0417 22.9167 -16.2500 -14.1667 6.0417 * * FITTED * * 75.4167 33.7500 32.0833 49.1667 66.0417 28.7500 34.5833 58.5417 78.5417 42.5000 48.3333 72.2917 * * 2ND.RESD * * 4.58334 1.25000 -2.08333 0.83333 -6.04166 1.25000 0.41667 1.45833 1.45834 -2.50000 1.66667 -2.29166 * *

These figures, with the addition of 'Seasonal', are the same as those calculated last week for this data. Note the quarterly repetition in the 'Seasonal' column - this is the average deviation for a quarter so is the 'Seasonal factor' for use in both forecasting and deseasonalising..

Plotting the trend line with the original data shows its smoothed fit.
Time series plot for Ice cream Sales with Trend
100 90 80 S ale s
S ale s 100 90 80 70 60 50 40 30

Fitted values added

70 60 50 40 30 Index 5 10 15

Index

10

15

The first diagram could, in theory, be used to estimate the future trend but it would be difficult to extend the trend line and read values from it with any accuracy. A hand drawn graph is therefore preferable. Adding the Fitted values to the previous graph shows how well the model has fitted the observed data in the past. The second composite graph indicates a fairly close match but the residuals still need to be analysed before the accuracy of any predictions can be estimated numerically. Residual analysis Remember that residuals are required to be small, with a mean of zero and a 'small' standard deviation and be randomly distributed in time. Summary statistics
FOR THE DATA MEAN = ST.DEV. = 54.375 20.238
5

Plot of Second residuals against Time

2ND.RESD

FOR THE FIRST RESIDUALS MEAN = ST.DEV. = -0.36458 16.955

-5

FOR THE SECOND RESIDUALS MEAN =9.536743E-07 ST.DEV. = 2.7696


0 5 10 15

QUARTER

Are they randomly distributed chronologically? No obvious seasonal pattern is evident. These residuals seem to satisfy the required conditions and also give us the additional information that our forecasts will be accurate to within 2 x 2.77 i.e. 5540

SPSS output for this data Time series Decomposition

-> VARIABLE LABELS SALES "ice cream sales (000)". -> DATE YEAR 1997 QUARTER 1 4. -> * Seasonal Decomposition. -> /MODEL=ADDITIVE -> /MA=CENTERED. Results of SEASON procedure for variable SALES. Additive Model. Centered MA method. Period = 4. Moving averages . . 52.500 50.000 46.250 43.125 43.125 45.000 48.750 52.500 55.625 58.750 62.500 66.250 . . Seasonal factors -13.802 6.406 23.281 -15.885 -13.802 6.406 23.281 -15.885 -13.802 6.406 23.281 -15.885 -13.802 6.406 23.281 -15.885

Dates can be described in many ways. Years and quarters used here. Method: Additive with centred moving average.

Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4

DATE_ 1997 1997 1997 1997 1998 1998 1998 1998 1999 1999 1999 1999 2000 2000 2000 2000

SALES 40.000 60.000 80.000 35.000 30.000 50.000 60.000 30.000 35.000 60.000 80.000 40.000 50.000 70.000 100.000 50.000

Ratios . . 27.500 -15.000 -16.250 6.875 16.875 -15.000 -13.750 7.500 24.375 -18.750 -12.500 3.750 . .

Seasonally Smoothed adjusted trend- Irregular series cycle component 53.802 55.573 -1.771 53.594 54.705 -1.111 56.719 52.969 3.750 50.885 50.098 .787 43.802 45.978 -2.176 43.594 43.177 .417 36.719 42.413 -5.694 45.885 45.098 .787 48.802 48.756 .046 53.594 52.622 .972 56.719 55.747 .972 55.885 58.432 -2.546 63.802 62.645 1.157 63.594 65.955 -2.361 76.719 68.733 7.986 65.885 70.122 -4.236

The following new variables are being created: Name ERR_1 SAS_1 SAF_1 STC_1 Label Error for SALES from SEASON, MOD_1 ADD CEN 4 Seas adj ser for SALES from SEASON, MOD_1 ADD CEN 4 Seas factors for SALES from SEASON, MOD_1 ADD CEN 4 Trend-cycle for SALES from SEASON, MOD_1 ADD CEN 4

The moving averages are the trend figures calculated by hand previously and the Ratios, a term more suited to a multiplicative model, are the same first residuals. The 'seasonal factors' and the 'smoothed trend cycle' describe the average effect due to a particular quarter and the sales level without that effect. These differ slightly from our calculated figures as they have been further smoothed and also extended to cover the first and last two time periods. We shall look at seasonally adjusted series later. No 'fitted values' from the model have been produced by default but these can easily be obtained as the sum of 'smoothed trend cycle' and 'seasonal factors' which have automatically been produced and saved by SPSS as STC_1 and SAF_1. The errors and deseasonalised sales have also been saved.

Time series plot for Ice cream Sales


120

Quarterly Icecream Sales ('000)

100

80

60

40

20
01 20 4 1 Q 2 00 3 01 Q 20 1 2 0 Q 20 0 1 0 Q 20 4 0 Q 200 3 00 Q 20 0 2 0 Q 20 1 9 Q 199 4 99 Q 19 9 3 9 Q 19 2 9 Q 1 99 1 98 Q 19 8 4 9 Q 9 1 3 98 Q 19 8 2 Q 199 1 97 Q 19 7 4 9 Q 19 3 7 Q 199 2 97 Q 19 1 Q

Date

Plotting the trend line with the original data shows its smoothed fit.

Trend added
120

100

80

60 Icecream Sales ('000) Trend


01 20 4 01 Q 20 1 3 0 Q 20 2 01 Q 20 0 1 0 Q 20 4 00 Q 20 0 3 0 Q 20 2 00 Q 20 9 1 9 Q 19 9 4 9 Q 19 9 3 9 Q 19 9 2 9 Q 19 8 1 9 Q 19 8 4 9 Q 19 8 3 9 Q 19 8 2 9 Q 19 1 97 Q 19 7 4 9 Q 19 3 97 Q 19 7 2 9 Q 19 1 Q

40

20

Date

This diagram could, in theory, be used to estimate the future trend but it would be difficult to extend the trend line and read values from it with any accuracy. A hand drawn graph is therefore preferable.

Adding the Fitted values to the previous graph shows how well the model has fitted the observed data in the past.
Fitted values added to Sales and Trend
120

100

80 Quarterly Icecream S 60 ales ('000) TREND Fitted values from t 20 he Additive model
01 20 1 4 0 Q 20 1 3 0 Q 20 1 2 0 Q 20 0 1 0 Q 20 0 4 0 Q 20 0 3 0 Q 20 0 2 0 Q 20 9 1 9 Q 19 9 4 9 Q 1 9 99 3 Q 19 9 2 9 Q 19 8 1 9 Q 19 8 4 9 Q 19 8 3 9 Q 19 8 2 9 Q 19 7 1 9 Q 19 7 4 9 Q 19 7 3 9 Q 19 7 2 9 Q 19 1 Q

40

Date

This composite graph indicates a fairly close match but the residuals still need to be analysed before the accuracy of any predictions can be estimated numerically. Residual analysis Remember that residuals are required to be small, with a mean of zero and a 'small' standard deviation and be randomly distributed in time.
De scriptiv e Statistics N Quarterly Icecream Sales ('000) First residuals Second residuals Valid N (listwise) 16 12 12 12 Minimum 30 -18.75 -6.04 Maximum 100 Mean 54.38 Std. Deviation 20.24 16.9534 2.7702

27.50 -.3658 4.59 1.667E-03

Are they randomly distributed chronologically? No obvious seasonal pattern is evident.

Plot of second residuals against time


6 4 2

RESID2

These residuals seem to satisfy the required conditions and also give us the additional information that our forecasts will be accurate to within 2 x 2.77 i.e. 5540

0 -2 -4 -6 -8
Q 01 20 4 1 Q 200 1 3 Q 00 2 1 2 Q 2 00 0 1 Q 2 00 4 00 Q 20 3 0 Q 00 2 0 2 Q 2 00 9 1 Q 1 99 9 4 Q 1 99 3 99 Q 19 2 9 Q 199 8 1 Q 1 99 4 8 Q 1 99 8 3 Q 1 99 8 2 Q 1 99 1 97 Q 19 7 4 Q 1 99 7 3 Q 1 99 7 2 Q 1 99 1

Date

Sales (000)

100 90 80 70 60 50 40 30 20 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 Q1 Q2 Q3 Q4 1997 1998 1999 2000 2001

Date 1997 Q1 Q2 Q3 Q4 1998 Q1 Q2 Q3 Q4 1999 Q1 Q2 Q3 Q4 2000 Q1 Q2 Q3 Q4

Sales (A) Cycle Trend (T) ('000) Average Moving average 40 60 53.75 80 51.25 35 48.75 30 43.75 50 42.50 60 43.75 30 46.25 35 51.25 60 53.75 80 57.50 40 60.00 50 65.00 70 67.50 100 50 66.25 62.50 58.75 55.63 52.50 48.75 45.00 43.13 43.13 46.25 50.00 52.50

First Resid. Fitted value S = (A - T) F = (T + S)

2nd Resid. R = (A - F)

+27.50 -15.00 -16.25 + 6.87 +16.87 -15.00 -13.75 + 7.50 +24.37 -18.75 -12.50 + 3.75

75.42 33.75 32.08 49.17 66.04 28.75 34.58 58.54 78.54 42.50 48.33 72.29

+4.58 +1.25 -2.08 +0.83 -6.04 +1.25 +0.42 +1.46 +1.46 -2.50 +1.67 -2.29

Seasonal Factor (S) - Average seasonal deviation from Trend Quarter 1 -16.25 -13.75 -12.50 Total Average -42.50 -14.17 Quarter 2 + 6.87 + 7.50 + 3.75 +18.12 +6.04 Quarter 3 +27.50 +16.87 +24.37 +68.74 +22.91 Quarter 4 -15.00 -15.00 -18.75 -48.75 -16.25

You might also like