Lesson 21
Lesson 21
Time series Analysis
Time series Analysis
21.
21.1 1 IntIntrodroductuctioionn
Forecasting or predicting is an essential tool in any decision making process. Its uses vary Forecasting or predicting is an essential tool in any decision making process. Its uses vary from determining inventory requirements for a local shoe store to estimating the annual from determining inventory requirements for a local shoe store to estimating the annual sales of high-tech computers. The quality of the
sales of high-tech computers. The quality of the forecasts management can make isforecasts management can make is strongly related to the information that can be
strongly related to the information that can be extracted and used from past daextracted and used from past data.ta. TimeTime series analysis
series analysisis one quantitative method we can is one quantitative method we can use to determine patterns in datause to determine patterns in data collected over time. Table 21
collected over time. Table 21.1 presents an example of time series data..1 presents an example of time series data.
Time series data:
Time series data: A time is a set of observation taken A time is a set of observation taken at specific times, usually atat specific times, usually at equal intervals. Mathematically, a time series is defined by the values
equal intervals. Mathematically, a time series is defined by the values ,... ,... , , 22 1 1 Y Y Y
Y of a variableof a variable Y Y at timesat times ,, ,...,...
2 2 1 1 t t t t .. Example 21.1 Example 21.1
Consider the data in Table 21.1 where the quarterly S&P 500 indices from 1900 to 1995 Consider the data in Table 21.1 where the quarterly S&P 500 indices from 1900 to 1995 are presented in order of time. This is a proper example of a time series data. The change are presented in order of time. This is a proper example of a time series data. The change and variation pattern of the
and variation pattern of the data over the period and data over the period and making future forecast from themaking future forecast from the observed pattern are of simultaneous interest and
data is termed as time series analysis. The example
data is termed as time series analysis. The example considers a data for a substantiallyconsiders a data for a substantially long period and this is often a requirement for valid future prediction. For simplicity of long period and this is often a requirement for valid future prediction. For simplicity of the analysis, the quarter January 1900 can be coded as quarter 1 (or
the analysis, the quarter January 1900 can be coded as quarter 1 (or t t
=
=
11) and the) and the corresponding index value is read ascorresponding index value is read as Y Y 11 , the quarter April 1900 can be coded as quarter , the quarter April 1900 can be coded as quarter
2 (or
2 (or t t ==22) and the corresponding index value is read as) and the corresponding index value is read as Y Y 22 , … and so on up to the, … and so on up to the
index
index Y Y 338800 corresponding to the quarter October 1995. The data is given in Table A21.1.corresponding to the quarter October 1995. The data is given in Table A21.1.
A line diagram of the d
A line diagram of the data in Table 21.1 is presented ata in Table 21.1 is presented in Figure 21.1, where the in Figure 21.1, where the fluctuationfluctuation of the S&P 500 index over the study period 1900-1995 is pronounced.
of the S&P 500 index over the study period 1900-1995 is pronounced.
Figure 21.1:
Figure 21.1:The line diagram of quarterly S&P 500 The line diagram of quarterly S&P 500 index from 1900-1995index from 1900-1995
21.1.1
21.1.1 The uses and utilities of Time series analysisThe uses and utilities of Time series analysis
The analysis of time series can be
The analysis of time series can be helpful in economist, business people, the scientist,helpful in economist, business people, the scientist, social researchers and many other groups of people. The following utilities are rendered social researchers and many other groups of people. The following utilities are rendered very important:
very important:
It helps understIt helps understand the past behaviour and the past behaviour of of any physical phenomenon .any physical phenomenon .
It helps in planning the future and It helps in planning the future and policy makingpolicy making
It helps evaluating current achievement or It helps evaluating current achievement or accomplishmentaccomplishment
21.2 Variations in time series
We use the term time series to refer to any group of statistical information accumulated at regular intervals. There are four kinds of change or variation involved in time series
analysis, or in other words we can say there are four components of time series data: Secular trend: The smooth gradual direction of increase or decrease behavior
over long time.
Cyclical fluctuation: The fluctuation or rise and fall of a time series over long period of time.
Seasonal variation: The fluctuation or ups and down over small interval of time, usually over every year.
Irregular variation: The random behavior of un-patterned fluctuations.
Figure 21.2, shows different variations in time series. We can see in Figure 21.2 that the general movement persisting over the range time represented by a straight line (c). This variation is the secular trend in the time series. A pronounced fluctuation moving up and down every few years is also observed, this is the cyclical variation and it is represented by (b) in Figure 21.1. Moreover if we look closely year by year, we can see the original time series has a variation within every year, and this is known as the seasonal
fluctuation. Finally the saw-tooth irregularities in the curve of original data is the irregular random variations.
21.2.1 Time series models:
Let us denote the four components secular trend, cyclical fluctuation, seasonal variation and the irregular variation by T ,C ,S and I . In traditional or classical time series
analysis it is ordinarily assumed that any particular value of the time series is the product of these four components, i.e., Y =T ×S ×C ×I . This is called the multiplicative model. The other traditional time series models include
Additive model Y =T +S +C +I
Mixed model Y =T ×S ×C +I
Mixed model Y =T ×C +S +I .
Example 21.2
From the quarterly S&P 500 index from 1900-1995, show the different components of time series.
Solution:
The S&P 500 index from 1900-1995 are presented in Figure 21.3 and the different components of time series.
Again for Figure 21.3, the general movement persisting over the range time or the secular trend is represented by a straight line (c). The cyclical variation is represented by (b) in Figure 21.3, and the seasonal variation observed year by year is shown for one year in a boa. Finally one instance of the irregular random variations is highlighted in another box.
Figure 21.3:Different types of variation for quarterly S&P 500 index from 1900-1995 21.3 The secular trend
Of the four components of a time series, secular trend represents the long term direction of the series. One way to describe it is to fit a line visually to a set of points on a graph. Any given graph, however, is subject to slightly different interpretations by different individuals.
21.3.1 Reasons for studying Trends
The following three are the main reasons for studying trends:
The historical pattern of the data can be described by studying trends. The future patterns of the data can be projected using the past pattern
The trend, in many situations can be eliminated to check the trend free time series for other components.
21.3.2 Types of trends
Trends can be linear or curvilinear. The method of linear trends, or the straight line method is usually used for describing time series, but it might not be appropriate because some of the time series data could have other types of trend. For example, pollution in environment or yearly sales of an industrial product do not follow straight line pattern of trend. The rough pictures of the trend for the examples are given in Figure 21.4.
Figure 21.4: Trends of pollution in environment and yearly sales of an industrial product
21.3.3 Fitting the linear trend and Least squared Estimates
The long term trend of many business series, such as sales, exports and production often approximates a straight line. If so, the equation to describe the growth is given by the following linear trend equation as
bt a
Y t ' = + ,
where Y t 'is the projected value of the variable Y for a selected value of t ,
a
is the Y intercept. It is estimated value of Y whent=
0. Another way of interpreting is thata
is the estimated value of Y where the line crosses the Y axis, b is the slope of the line, or an average change in Y t ' for each one unit change int
, andt
is any valueof time that is selected.
The concept associated with fitting the linear trend or the linear trend equation is quite the same as the simple linear regression with the independent variable being considered is the time. Now using the well known results of simple linear regression, we can find the Least squared estimators
a
and b using sample data on time series Y and time t as( )( )
(
)
− − =∑
∑
∑
∑
∑
2 2 1 1 t n t y t n ty b and n t b n y a =∑
−∑
Example 21.3The sales of Jenson foods, a small grocery chain, since 1997 are given in Table 21.1. Determine the least squares trend-line equation.
Year 1997 1998 1999 2000 2001 Sales ($ million) 7 10 9 11 13
Table 21.1:Sales ($ million) of Jenson foods, since 1997 Solution:
To simplify the calculations, the years are replaced by coded values. That is, we let 1997 be 1, 1998 be 2 and so forth. Computations needed for determining the trend equation is given in Table 21.2. Year Sales ($ million) Y t tY 2 t 1997 1998 1999 2000 2001 7 10 9 11 13 1 2 3 4 5 7 20 27 44 65 1 4 9 16 25 50 15 163 55
trend equation for sales data of Jenson foods
Now the linear trend equation is
bt a Y t ' = + ,
where b and
a
are calculated using the necessary calculations done in Table 21.3. We now have( )( )
(
)
( )( )
( )
3 . 1 15 1 55 50 15 1 163 1 1 2 2 2 = − − = − − =∑
∑
∑
∑
∑
n n t n t y t n ty b and 1 . 6 ) 5 15 ( 3 . 1 5 50 = − = − =∑
∑
n t b n y aThe trend equation, therefore, is given by
t bt
a
Y t ' = + =6.1+1.3
where, sales are in millions of dollars. The origin, or year 0, is 1996 and
t
increases by one unit for each year. The value of 1.3 indicates sales increased at a rate of $1.3 million per year. The value 6.1 is the estimated sales when t=
0. That is, the estimated sales amount for 1996 (base year) is $6.1 million. The fitted trend line is shown in the following Figure 21.5.Figure 21.5: The original sales and the trend line.
Example 21.4
Solution:
From the data on time series available in Example 21.1, a least square estimation method can be used. The intercept and regression co-efficient are to be obtained. We used SPSS software for computing the estimated regression parameters. The values obtained are
=
a 1.10259712304 andb =-0.0001738063029993.
The fitted linear equation revealed by these values is
t Y t ' =1.10259712 304 -0.00017380 63029993 .
The fitted trend is shown in Figure 21.5.
Figure 21.6: The fitted linear trend along with the original series of quarterly S&P 500 index 1995
21.3.4 Future projection using least squared estimates
If the time series data is fitted to a linear trend using least squared estimation method, the future value of the variable Y can be projected by putting the desired value of t in the fitted linear equation.
Example 21.5
Refer to the sales data in example 21.2. the year 1997 is coded 1 and 1998 is coded 2. what is the sales forecast for 2004?
The year 1999 is coded 3, 2000 is coded 4, 2001 is coded 5, 2002 is coded 6.2003 is coded 7 and 2004 is logically coded 8. The linear trend equation for the problem is:
t Y t ' =6.1+1.3
Thus for the year 2004, substituting t =8 in the equation we get
, 5 . 16 8 3 . 1 1 . 6 3 . 1 1 . 6 ' = × + = + = t Y t
thus, based on past sales, the estimated sale for 2004 is $16.5 million.
14.3.5 Method of moving average
The method of moving average (MA) is useful in smoothing a time series so that the trend of the series becomes more visible. The moving average method is also the base for measuring seasonal variations. The arithmetic mean of successive data points are moved to construct the moving average. A k -point MA is obtained by constructing the variable
which is represented by the average of k successive observations. Let Y 1 ,Y 2,..., Y n
be a time series data. A k -point MA, m1
Y is obtained by using the following relations:
k Y Y Y Y m1 = 1+ 2 +...+ k 1 , k Y Y Y Y m1 2 3 k 1 2 ...
+
++
+
=
, … k Y Y Y Y nm−1k=
n−k+
n−k +1+
...+
nThe MA averages out the cyclical and irregular variation, however, caution should be taken in using MA since if the data do not follow fairly linear trend or do not have a definite rhythm, the computation of the MA would not be appropriate.
Example 21.6
For the sales data from 1976 to 2001, compute a seven year moving average and plot the moving average along with the original time series.
We construct the Table 21.3 to compute the moving average. Year Time Sales ($million) Seven year moving total Seven year moving Average 1976 1 1 1977 2 2 1978 3 3 1979 4 4 22 3.142857143 1980 5 5 23 3.285714286 1981 6 4 24 3.428571429 1982 7 3 25 3.571428571 1983 8 2 26 3.714285714 1984 9 3 27 3.857142857 1985 10 4 28 4 1986 11 5 29 4.142857143 1987 12 6 30 4.285714286 1988 13 5 31 4.428571429 1989 14 4 32 4.571428571 1990 15 3 33 4.714285714 1991 16 4 34 4.857142857 1992 17 5 35 5 1993 18 6 36 5.142857143 1994 19 7 37 5.285714286 1995 20 6 38 5.428571429 1996 21 5 39 5.571428571 1997 22 4 40 5.714285714 1998 23 5 41 5.857142857 1999 24 6 2000 25 7 2001 26 8
Table 21.3: Seven years moving average of the sales data
Figure 21.7:The Seven years moving average along with the original series of sales data from 1976 to 2001
Example 21.7
From the data on time series available in Example 21.1, find a 25-pt MA and plot the MA data along with the original series
Solution:
From the data on time series available in Example 21.1, a 25-pt MA is obtained and presented in Table A21.5. The line diagram of the 25-pt MA is also presented along with the original series in Figure 21.8.
Figure 21.8: The 25 pt moving average along with the original series of of quarterly S&P 500 index 1995
21.3.6 Nonlinear Trend
A linear trend equation is used to represent the time series when it is believed that the data are increasing (or decreasing) by equal amounts, on the average, from one period to another. If the data increase (or decrease) by equal percents or proportions over a period of time, a curvilinear trend will appear.
The trend equation for a time series that does approximate a curvilinear trend, may be computed by using the logarithms of the data and the least squares method. The general equation for the logarithmic trend equation is:
) ( log log
Example 21.8
Fit the general equation for the logarithmic trend equation using the sales data from 1997 to 2003 given in Example 21.5. Year Sales ($ million) 1997 1998 1999 2000 2001 2002 2003 2.13 0.35 39.8 257 211 290 981
Table 21.4:Sales ($ million) since 1997 Solution:
An Excel run provides the following outputs Intercept= -0.4129, Slope= 0.519676
Now we can write log a=-0.4129 and log b=0.519676 ,
i.e. a =0.3865 and b =0.3088 ,
hence the non-linear equation of trend becomes
) ( 3088 . 0 log 3865 . 0 log log Y ′= + t .
Whereas the fitted linear (secular) trend is found to be
t Y '=−272.2614 +131.6825 .
The fitted linear and non-linear trends are calculated in Table 21.7 and they are plotted along with the original data in Figure 21.9.
Coded Time
Sales Log of sales Fitted linear trend Fitted non-linear trend 1 2.13 0.32838 -140.579 1.278716 2 0.35 -0.45593 -8.89643 4.231067 3 39.8 1.59988 3 122.7861 13.99993 4 257 2.40993 3 254.4686 46.32356 5 211 2.32428 2 386.1511 153.2773
6 290 2.46239 8 517.8336 507.1704 7 981 2.99166 9 649.5161 1678.146
Table 21.5:Fitted linear and nonlinear trend
Figure 21.9: Fitted linear and nonlinear trend 21.4 Determining Seasonal Index
Several methods have been developed to measure the typical seasonal fluctuation in a time series. The method most commonly used to compute the typical seasonal pattern is called the ratio-to-moving average method. It eliminates the trend, cyclical and irregular components from the original data.
21.4.1 The steps followed in the ratio-to-moving average method
Step 1: The first step is to determine the four-quarter moving total for the first year. This total is shown in the second column of the table and placed between the middle of second and third quarter. The four-quarter total is moved along by adding the second, third, forth and first quarter of the next year. This shown again in the second column and placed between the middle of the third and fourth column of the first year. This procedure is continued for the quarterly sales for each of the remaining years.
Step 2: Each quarterly moving total in the second column is divided by 4 to give the four quarter moving average and placed in third column. All the moving averages are still positioned between the quarters.
Step 3: The moving averages are then centered and placed in column 4. The centered moving averages are positioned on particular quarters.
Step 4: The specific seasonal for each quarter is then computed by dividing the elements in column 1 by the centered moving average in column 4. The specific seasonal reports the ratio of the original time series value to the moving average.
Step 5: The specific seasonals are organized in a table. This table will help us locate the specific seasonals for the corresponding quarters. This is averaged for specific quarter over the years for which specific seasonals are obtained. Th resulting quantity is known as a seasonal index.
Step 6: The four quarterly means should theoretically total 4.00 because the
average is set at 1.0. The total of the four quarterly means may not exactly equal 4.00 due to rounding. A correction factor is therefore applied to each of the four means to force them to total 4.00. means four of Total factor Correction = 4.00 Example 21.9
Table 21.7 shows the quarterly sales for Toys International for the years 1996 through 2001. The sales are reported in millions of dollars. Determine a quarterly seasonal index using the ratio-to-moving average method.
Year Winter Spring Summer Fall 1996 1997 1998 1999 2000 2001 6.7 6.5 6.9 7.0 7.1 8.0 4.6 4.6 5.0 5.5 5.7 6.2 10.0 9.8 10.4 10.8 11.1 11.4 12.7 13.6 14.1 15.0 14.5 14.9 Table 21.6:Quarterly Sales of Toys International ($ millions)
Solution:
The necessary computation for the ratio-to-moving average method is shown in Table 21.8. From Table 21.8, we make the following summary Table (Table 21.10) that gives the calculation of the seasonal indices.
Year Quarter Sales ($ million) Four-Quarter total Four-Quarter MA Centered MA Specific Seasonal 1996 Winter Spring Summer Fall 6.7 4.6 10.0 12.7 34.0 33.8 33.8 8.5 8.45 8.45 8.475 8.45 1.18 1.503 1997 Winter Spring Summer Fall 6.5 4.6 9.8 13.6 33.6 34.5 34.9 35.3 8.4 8.625 8.725 8.825 8.425 8.513 8.675 8.775 0.772 0.54 1.13 1.55 1998 Winter Spring Summer Fall 6.9 5.0 10.4 14.1 35.9 36.4 36.5 37.0 8.975 9.1 9.125 9.25 8.9 9.038 9.113 9.188 0.775 0.553 1.141 1.535 1999 Winter Spring Summer Fall 7.0 5.5 10.8 15.0 37.4 38.3 38.4 38.6 9.35 9.575 9.6 9.65 9.3 9.463 9.588 9.625 0.753 0.581 1.126 1.558 2000 Winter Spring Summer 7.1 5.7 11.1 38.9 38.4 39.3 9.725 9.6 9.825 9.688 9.663 9.713 0.733 0.590 1.143
Fall 14.5 39.8 9.95 9.888 1.466 2001 Winter Spring Summer Fall 8.0 6.2 11.4 14.9 40.1 40.5 10.025 10.125 9.888 10.075 0.801 0.615
Table 21.7:The computation for the ratio-to-moving average method
Quarter 1996 1997 1998 1999 2000 2001 Total Mean Seasonal index Winter 0.77 2 0.775 0.75 3 0.73 3 0.801 3.83 4 0.766 8 0.765079 Spring 0.54 0.553 0.58 1 0.59 0.615 2.87 9 0.575 8 0.574507 Summer 1.18 1.13 1.141 1.12 6 1.14 3 5.72 1.144 1.141432 Fall 1.50 3 1.55 1.535 1.55 8 1.46 6 7.61 2 1.522 4 1.518982
Table 21.8:The Seasonal index with the necessary computation for Sales of Toys Int. 21.4.2 Deseasonalizing data
A set of typical indices can be used for adjusting the seasonal fluctuation in a time series. Once the seasonal fluctuation is eliminated from a time series the resulting series is called a deseasonalized series or seasonally adjusted time series. The other component of time series can be advantageously studied from a deseasonalized time series. The original value of the time series at each quarter (or month, week etc.) is divided by the
corresponding seasonal index to obtain the deseasonalized time series. Mathematically,
S C T S I S C T × × × = × × = = index Seasonal value Original value ized Deseasonal Example 21.10
Consider the sales for Toys International for the years 1996 through 2001 reported in millions of dollars given in Example 21.8. Determine the deseasonalized sales.
The calculation of the deseasonalization is shown in Table 21.10 and the graph of the deseasonalized data along with the original data are shown in Figure 21.10.
Figure 21.10:The deseasonalized data for Sales of Toys Int. Year Origi-nal time series Seas-onal index De- season-alized series 199 6 Winter 6.7 0.77 8.76 Spring 4.6 0.57 8.01 Summer 10 1.14 8.76 Fall 12.7 1.52 8.36 199 7 Winter 6.5 0.77 8.50 Spring 4.6 0.57 8.01 Summer 9.8 1.14 8.59 Fall 13.6 1.52 8.95 199 8 Winter 6.9 0.77 9.02 Spring 5 0.57 8.70 Summer 10.4 1.14 9.11 Fall 14.1 1.52 9.28 Year Origi-nal time series Seas-onal index De- season-alized series 199 9 Winter 7 0.77 9.15 Spring 5.5 0.57 9.57 Summer 10.8 1.14 9.46 Fall 15 1.52 9.88 200 Winter 7.1 0.77 9.28 0 Spring 5.7 0.57 9.92 Summer 11.1 1.14 9.72 Fall 14.5 1.52 9.55 200 1 Winter 8 0.77 10.46 Spring 6.2 0.57 10.79 Summer 11.4 1.14 9.99 Fall 14.9 1.52 9.81
Table 21.9:The deseasonalized data for Sales of Toys Int. Example 21.11
Consider the S&P indices for years 1900 through 1995 given in Example 21.1. Determine the seasonal indices and plot the deseasonalized series.
Solution:
The seasonal indices are presented in Table 21.12, and the plot of the de-seasonalized series along with the original series is given in Figure 21.11.
Quarter Total Specific seasonal Mean Specific seasonal Seasonal index January 95.3531 3 1.00371 7 1.006284 April 95.1174 4 1.00123 6 1.003796 July 94.7398 0.99726 1 0.999811 October 93.8204 9 0.98758 4 0.990109
Table 21.10:The Seasonal index S&P indices.
Figure 21.11:The deseasonalized data for S&P indices 21.4.3 Using de-seasonalized data for future projection
The de-seasonalized time series can be used to forecast future values of the time series in a more efficient manner. The use of de-seasonalized data for determining trend would give much realistic trend values for future period and this forecasted trend can be
adjusted for seasonality using the seasonal effects. The procedure of forecasting future values of a time series using deseasonalized data can be summarized in the following steps:
Step 1:Using the deseasonalized data, a least square method is used to determine the trend. As usual it is done by fitting a trend equation. In case of consideration of linear trend the values of
a
and b in the equation Y t ' =a+bt are required to be determined. Step 2: Using the linear trend equation the value of the time series for any future point of time can be projected.Step 3:Finally, the values for the future time points forecasted in step 2 are multiplied by the corresponding seasonal indices to make the final forecasting.
Example 21.12
Consider the sales for Toys International for the years 1996 through 2001 reported in millions of dollars given in Example 21.8. Forecast the sales for the four quarters of 2002 using deseasonalized sales.
Solution:
The calculation of the deseasonalization as shown in Table 21.10 are presented in table 21.12.
Year Season t De-season-alized series 1996 Winter 1 8.01 Spring 2 8.76 Summer 3 8.36 Fall 4 8.50 1997 Winter 5 8.01 Spring 6 8.59 Summer 7 8.95 Fall 8 9.02 1998 Winter 9 8.70 Spring 10 9.11 Summer 11 9.28 Fall 12 8.01 Year Season t De-season-alized series 1999 Winter 13 9.15 Spring 14 9.57 Summer 15 9.46 Fall 16 9.88 2000 Winter 17 9.28 Spring 18 9.92 Summer 19 9.72 Fall 20 9.55 2001 Winter 21 10.46 Spring 22 10.79 Summer 23 9.99 Fall 24 9.81
Table 21.11:The deseasonalized data for Sales of Toys Int. The use of least square method yields the following values of
a
and b( )( )
(
)
0.089894 1 1 2 2=
−
−
=
∑
∑
∑
∑
∑
t n t y t n ty b and =∑
−∑
=8.110496 n t b n y aThe value of
t
for quarters winter, spring, summer and fall of year 2002 are coded as 25, 26, 27 and 28 respectively. The linear trend equation for the problem is:t Y t ' =8.110496 +0.089894 × .
Thus for the winter quarter of year 2002, substituting t =25 in the equation we get
10.35785 25 0.089894 8.110496 ' 25 = + × = Y
From Table 21.10, we have the seasonal index for winter quarter is 0.765079, thus the forecasted value adjusted for seasonality is given by
7.924581 765079 . 0 10.35785 25 = × = Y .
Table 21.13 and Figure 21.12 give the forecasted sales for the four quarters of 2002 using deseasonalized sales. For an assessment of how good the forecasted sales match the original data, the forecasted sales are plotted along with the original data in Figure 21.13.
Quarter Fitted trend
) 0.089894 8.110496 ( ' t Y t × + =
Seasonal index Final forecast (Fitted trend× Seasonal index) Winter 2005 10.35785 0.76508 7.924581 Spring 2005 10.44774 0.57451 6.002331 Summer 2005 10.53763 1.14143 12.02797 Fall 2005 10.62753 1.51898 16.143
Table 21.12:Forecasted sales for the four quarters of 2002 using deseasonalized data of Toys Int.
Figure 21.12: Forecasted sales for the four quarters of 2002
Figure 21.13:Forecasted sales for the four quarters of 2002 along with the original data