Long distance –analysing time series data 9 Chapter objectives This chapter will help you to: ■ identify the components of time series ■ employ classical decomposition to analyse time se
Trang 1Long distance –
analysing time series data
9
Chapter objectives
This chapter will help you to:
■ identify the components of time series
■ employ classical decomposition to analyse time series data
■ produce forecasts of future values of time series variables
■ apply exponential smoothing to analyse time series data
■ use the technology: time series analysis in MINITAB and SPSS
■ become acquainted with business uses of forecastingOrganizations collect time series data, which is data made up of obser-vations taken at regular intervals, as a matter of course Look at theoperations of a company and you will find figures such as daily receipts,weekly staff absences and monthly payroll If you look at the annualreport it produces to present its performance you will find more timeseries data such as quarterly turnover and annual profit
The value of time series data to managers is that unlike a single figurerelating to one period a time series shows changes over time; maybeimprovement in the sales of some products and perhaps deterioration
in the sales of others The single figure is like a photograph that tures a single moment, a time series is like a video recording that shows
Trang 2cap-events unfolding This sort of record can help managers review thecompany performance over the period covered by the time series and
it offers a basis for predicting future values of the time series
By portraying time series data in the form of a time series chart it ispossible to use the series to both review performance and anticipatefuture direction If you look back at the time series charts in Figures5.16 and 5.17 in Chapter 5 you will see graphs that show the progres-sion of observations over time You can use them to look for an overall
movement in the series, a trend, and perhaps recurrent fluctuations
around the trend
When you inspect a plotted time series the points representing theobservations may form a straight line pattern If this is the case you canuse the regression analysis that we looked at in section 7.2 of Chapter 7,taking time as the independent variable, to model the series and pre-dict future values Typically time series data that businesses need toanalyse are seldom this straightforward so we need to consider differ-ent methods
9.1 Components of time series
Whilst plotting a time series graphically is a good way to get a ‘feel’ forthe way it is behaving, to analyse a time series properly we need to use
a more systematic approach One way of doing this is the decomposition method, which involves breaking down or decomposing the series into different components This approach is suitable for time series data that
has a repeated pattern, which includes many time series that occur
in business
The components of a time series are:
■ a trend (T ), an underlying longer-term movement in the series
that may be upward, downward or constant
■ a seasonal element (S), a short-term recurrent component,
which may be daily, weekly, monthly as well as seasonal
■ a cyclical element (C), a long-term recurrent component that
repeats over several years
■ an error or random or residual element (E ), the amount that
isn’t part of either the trend or the recurrent components.The type of ‘seasonal’ component we find in a time series depends on
how regularly the data are collected We would expect to find daily
components in data collected each day, weekly components in data
Trang 3collected each week and so on Seasonal components are usually a feature of data collected quarterly, whereas cyclical components, pat-terns that recur over many years, will only feature in data collectedannually.
It is possible that a time series includes more than one ‘seasonal’component, for instance weekly figures may exhibit a regular monthlyfluctuation as well as a weekly one However, usually the analysis of
a time series involves looking for the trend and just one recurrentcomponent
Number of Week Day customers (000s)
Trang 4Note that in Example 9.1 it is not possible to look for cyclical ponents as the data cover only three weeks Neither is it possible toidentify error components as these ‘leftover’ components can only bediscerned when the trend and seasonal components have been ‘siftedout’ We can do this using classical decomposition analysis.
com-9.2 Classical decomposition of
time series data
Classical decomposition involves taking apart a time series so that wecan identify the components that make it up The first stage we take indecomposing a time series is to separate out the trend We can do this
by calculating a set of moving averages for the series Moving averages
are sequential; they are means calculated from sequences of values in
40 30 20 10
0
Day
Trang 5The third MA (6 9 15 28 30 3 5)/7 96/7 13.714 etc.
each moving average will be the mean of one figure from each day ofthe week Because the moving average will be calculated from seven
observations it is called a seven-point moving average.
The first moving average in the set will be the mean of the figures forMonday to Sunday of the first week The second moving average will bethe mean of the figures from Tuesday to Sunday of the first week andMonday of the second week The result will still be the mean of sevenfigures, one from each day We continue doing this, dropping the firstvalue of the sequence out and replacing it with a new figure until wereach the end of the series
Number of Week Day customers (000s) 7-point MA
Trang 6In Figure 9.2 the original time series observations appear as the solid line,the moving average estimates of the trend are plotted as the dashed line.There are three points you should note about the moving averages
in Example 9.2 The first is that whilst the series values vary from 3 to
35 the moving averages vary only from 13.714 to 16.000 The movingaverages are estimates of the trend at different stages of the series Thetrend is in effect the backbone of the series that underpins the fluctu-ations around it When we find the trend using moving averages we are
‘averaging out’ these fluctuations to leave a relatively smooth trend.The second point to note is that, like any other average, we can think
of a moving average as being in the middle of the set of data fromwhich it has been calculated In the case of a moving average we asso-ciate it with the middle of the period covered by the observations that
we used to calculate it The first moving average is therefore associatedwith Thursday of Week 1 because that is the middle day of the firstseven days, the days whose observed values were used to calculate it,the second is associated with Friday of Week 1 and so on The process
of positioning moving averages in line with the middle of the
observa-tions they summarize is called centring.
The third point to note is that there are fewer moving averages (15)than series values (21) This is because each moving average summar-izes seven observations that come from different days In Example 9.2
we need a set of seven series values, one from each day of the week, tofind a moving average Three belong to days before the middle day ofthe seven; three belong to days after the middle There is no moving
Figure 9.2
The moving averages and series values in Example 9.2
0 5 10 15 20 25 30 35 40
1 3 5 7 9 11 13 15 17 19 21
Day
Trang 7average to associate with the Monday of Week 1 because we do nothave observations for three days before There is no moving average toassociate with the Sunday of Week 3 because there are no observationsafter it Compared with the list of customer numbers the list of movingaverages is ‘topped and tailed’.
In Example 9.1 there were seven daily values for each week; the
series has a periodicity of seven The process of centring is a little more
complicated if you have a time series with an even number of smallertime periods in each larger time period In quarterly time series datathe periodicity is four because there are observations for each of fourquarters in every year For quarterly data you have to use four-pointmoving averages and to centre them you split the difference betweentwo moving averages because the ones you calculate are ‘out of phase’with the time series observations
Example 9.3
Sales of beachwear (in £000s) at a department store over three years were:
Plot the data then calculate and centre four-point moving averages for them
Year Winter Spring Summer Autumn
4 3 2 1 4 3 2 1 4 3 2 1
50 40 30 20 10 0
Quarter
Figure 9.3
Sales of beachwear
Trang 8First MA (14.2 31.8 33.0 6.8)/4 85.8/4 21.450
Second MA (31.8 33.0 6.8 15.4)/4 87.0/4 21.750 etc
The moving averages straddle two quarters because the middle of four periods isbetween two of them To centre them to bring them in line with the series itself we have
to split the difference between pairs of them
The centred four-point MA for the Summer of Year 1 (21.450 21.750)/2 21.600The centred four-point MA for the Autumn of Year 1 (21.750 22.500)/2 22.125and so on
Year Quarter Sales 4-point MA
Trang 9At this point you may find it useful to try Review Questions 9.1 to 9.6
at the end of the chapter
Centring moving averages is important because the moving ages are the figures that we need to use as estimates of the trend at specific points in time We want to be able to compare them directlywith observations in order to sift out other components of the timeseries
aver-The procedure we use to separate the components of a time seriesdepends on how we assume they are combined in the observations.The simplest case is to assume that the components are added togetherwith each observation, y, being the sum of a set of components:
Y Trend component (T ) Seasonal component (S)
Cyclical component (C) Error component (E)
Unless the time series data stretch over many years the cyclical component is impossible to distinguish from the trend element asboth are long-term movements in a series We can therefore simplifythe model to:
Y Trend component (T ) Seasonal component (S)
Error component (E) This is called the additive model of a time series Later we will deal with the multiplicative model If you want to analyse a time series which you assume is additive, you have to subtract the components from each
Centred Year Quarter Sales 4-point MA 4-point MA
Trang 10other to decompose the time series If you assume it is multiplicative,
you have to divide to decompose it.
We begin the process of decomposing a time series assumed to beadditive by subtracting the centred moving averages, which are the
estimated trend values (T ), from the observations they sit alongside (Y ) What we are left with are deviations from the trend, a set of figures
that contain only the seasonal and error components, that is
Y T S E
Example 9.4
Subtract the centred moving averages in Example 9.3 from their associated observations
Centred Year Quarter Sales (Y ) 4-point MA (T ) Y T
The next stage is to arrange the Y T results by the quarters of the
year and calculate the mean of the deviations from the trend for eachquarter These will be our estimates for the seasonal components forthe quarters, the differences we expect between the trend and theobserved value in each quarter
Example 9.5
Find estimates for the seasonal components from the figures in Example 9.4 What dothey tell us about the pattern of beachwear sales?
Trang 11We can take the analysis a stage further by subtracting the seasonal
components, S from the Y T figures to isolate the error components,
E That is:
E Y T S The T components are what the model suggests the trend should be at
a particular time and the S components are the deviations from the trend that the model suggests occur in the different quarters, the T and S values combined are the predicted values for the series The error components are the differences between the actual values (Y ) and the predicted values (T S):
E Actual sales Predicted sales Y (T S)
These four figures mean seasonal deviations add up to0.3625 Because they arevariations around the trend they really should add up to 0, otherwise when they areused together they suggest a deviation from the trend To overcome this problem, wesimply divide their total by 4, as there are four seasonal components, and add thisamount (0.090625) to each component After this modification the components shouldadd up to zero:
Adjusted winter component 8.750 0.090625 8.659375
Adjusted spring component 12.075 0.090625 12.165625
Adjusted summer component 12.1375 0.090625 12.228125
Adjusted autumn component 15.825 0.090625 15.734375
0.000000These are the seasonal components (S) for each quarter They suggest that beach-wear sales are £8659 below the trend in winter quarters, £12,166 above the trend inspring quarters, £12,228 above the trend in summer quarters and £15,734 below thetrend in autumn quarters
Winter Spring Summer Autumn
Trang 12The error components enable us to review the performance over theperiod A negative error component such as in the summer quarter ofyear 1 suggests the store under-performed in that period and mightlead them to investigate why that was A positive error component such
as in the spring quarter of year 3 suggests the store performed betterthan expected and they might look for reasons to explain the success
This type of evaluation should enable the store to improve sales performance because they can counter the factors resulting in poorperformances and build on the factors that contribute to good performances
Occasionally the analysis of a time series results in a very large errorcomponent that reflects the influence of some unusual and unex-pected external influence such as a fuel shortage or a sudden rise inexchange rates You can usually spot the impact of such factors by looking for prominent peaks or troughs, sometimes called spikes, whenthe series is plotted
The error components terms have another role in time series sis; they are used to judge how well a time series model fits the data Ifthe model is appropriate the errors will be small and show no pattern
analy-of variation You can investigate this by plotting them graphically
Example 9.6
Find the error components for the data in Example 9.3 using the table produced in
Example 9.4 and the seasonal components from Example 9.5
Actual Predicted Error Actual
Year Quarter sales (Y ) T S sales (T S) Predicted
Trang 13There are statistical measures that you can use to summarize the
errors; they are called measures of accuracy because they help you to assess
how accurately a time series model fits a set of time series data The mostuseful one is the mean squared deviation (MSD) It is similar in concept
to the standard deviation that we met in section 6.2.3 of Chapter 6, butinstead of measuring deviation from the mean of a distribution it measures deviation between actual and predicted values of a time series.The standard deviation is based on the squared differences betweenobservations and their mean because deviations from the mean can bepositive or negative, and can thus cancel each other out In the sameway deviations between actual and predicted time series values can benegative and positive, so in calculating the MSD we square the devi-ations The MSD is the sum of the squared deviations divided by the
number of deviations (n):
MSD ∑(Error)2
n
Example 9.7
Plot the errors in Example 9.6 and comment on the result
The errors in Figure 9.4 show no systematic pattern and are broadly scattered
2 1 4 3 2 1 4 3 2 1
2 1 0
Trang 14At this point you may find it useful to try Review Questions 9.7 to 9.9
at the end of the chapter
There are other measures of accuracy that you may meet The meanabsolute deviation (MAD) is the mean of the absolute values of theerrors, which means ignoring any negative signs when you add them
up There is also the mean absolute percentage error (MAPE) which isthe mean of the errors as percentages of the actual values they are part
of As with the MSD, the lower the values of these measures, the betterthe model fits the data
The MSD result in Example 9.8 is a figure that we can compare tothe MSD figures we get when other models are applied to the timeseries The best model is the one that produces the smallest MSD.The model we have applied so far is the additive decompositionmodel that assumes the components of a time series are addedtogether This model is appropriate for series that have regular andconstant fluctuations around a trend The alternative form of thedecomposition model is the multiplicative model in which we assumethat the components of the series are multiplied together This isappropriate for series that have regular but increasing or decreasingfluctuations around a trend
Trang 15To apply the multiplicative model we need exactly the same centredmoving averages as we need for the additive model, but instead of subtracting them from the actual series values to help us get to the sea-sonal components we divide each actual value by its corresponding
centred moving average to get a seasonal factor We then have to find
the average seasonal factor for each quarter, adjusting as necessary.Once we have the set of seasonal factors we multiply them by the trendestimates to get the predicted series values, which we can subtract fromthe actual values to get the errors
Example 9.9
Apply the multiplicative model to the beachwear sales data Obtain the errors, plotthem and use them to calculate the mean squared deviation (MSD) for the model.The first stage is to calculate the seasonal factors:
The next stage is to find the mean seasonal factor for each quarter and adjust them
so that they add up to 4, since the average should be one, the only factor that makes nodifference to the trend when applied to it
Sum of the means 0.6345 1.4945 1.5385 0.3095 3.977
Actual Centred Year Quarter sales (Y ) 4-point MA (T ) Y/T