time series

29
Lesson 21 Time series Analysis 21.1 Introduction 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 sales of high-tech computers. The quality of the forecasts management can make is strongly related to the information that can be extracted and used from past data. Time series analysis is one quantitative method we can use to determine patterns in data collected over time. Table 21.1 presents an example of time series data.

Upload: mohammad-shaniaz-islam

Post on 24-Nov-2014

253 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Time Series

Lesson 21

Time series Analysis

21.1 Introduction

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

sales of high-tech computers. The quality of the forecasts management can make is

strongly related to the information that can be extracted and used from past data. Time

series analysis is one quantitative method we can use to determine patterns in data

collected over time. Table 21.1 presents an example of time series data.

Time series data: A time is a set of observation taken at specific times, usually at

equal intervals. Mathematically, a time series is defined by the values

of a variable at times .

Example 21.1

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

and variation pattern of the data over the period and making future forecast from the

observed pattern are of simultaneous interest and studying these characteristics of the

Page 2: Time Series

data is termed as time series analysis. The example considers a data for a substantially

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 ) and the

corresponding index value is read as , the quarter April 1900 can be coded as quarter 2

(or ) and the corresponding index value is read as , … and so on up to the index

corresponding to the quarter October 1995. The data is given in Table A21.1. A line

diagram of the data in Table 21.1 is presented in Figure 21.1, where the fluctuation of the

S&P 500 index over the study period 1900-1995 is pronounced.

Figure 21.1: The line diagram of quarterly S&P 500 index from 1900-1995

21.1.1 The uses and utilities of Time series analysis

The analysis of time series can be helpful in economist, business people, the scientist,

social researchers and many other groups of people. The following utilities are rendered

very important:

It helps understand the past behaviour of any physical phenomenon .

It helps in planning the future and policy making

It helps evaluating current achievement or accomplishment

It helps researchers to compare change behaviour in different data.

21.2 Variations in time series

Page 3: 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.

Figure 21.2: Different types of variation of time series.

21.2.1 Time series models:

Page 4: Time Series

Let us denote the four components secular trend, cyclical fluctuation, seasonal variation

and the irregular variation by and . 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., . This is called the multiplicative model.

The other traditional time series models include

Additive model

Mixed model

Mixed model .

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

Page 5: Time Series

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

,

where is the projected value of the variable for a selected value of ,

Page 6: Time Series

is the intercept. It is estimated value of when . Another way of interpreting is

that is the estimated value of where the line crosses the axis, is the slope of the

line, or an average change in for each one unit change in , and is any value of 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 and using sample data on time series and time as

and

Example 21.3

The 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 2001Sales ($ million) 7 10 9 11 13Table 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.

YearSales

($ million)

19971998199920002001

71091113

12345

720274465

1491625

50 15 163 55Table 21.2: Computations needed for determining the

trend equation for sales data of Jenson foods

Now the linear trend equation is

Page 7: Time Series

,

where and are calculated using the necessary calculations done in Table 21.3. We

now have

and

The trend equation, therefore, is given by

where, sales are in millions of dollars. The origin, or year 0, is 1996 and 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 . 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

Use the data on S&P indices for fitting the least square estimation of the trend.

Solution:

Page 8: Time Series

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

1.10259712304 and -0.0001738063029993.

The fitted linear equation revealed by these values is

.

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 can be projected by putting the desired value of 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?

Solution:

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:

Page 9: Time Series

Thus for the year 2004, substituting in the equation we get

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 -point MA is obtained by constructing the variable

which is represented by the average of successive observations. Let be a

time series data. A -point MA, is obtained by using the following relations:

,

,

The 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.

Solution:

We construct the Table 21.3 to compute the moving average.

Year TimeSales

($million)Seven year

moving totalSeven year

moving Average1976 1 11977 2 2

Page 10: Time Series

1978 3 31979 4 4 22 3.1428571431980 5 5 23 3.2857142861981 6 4 24 3.4285714291982 7 3 25 3.5714285711983 8 2 26 3.7142857141984 9 3 27 3.8571428571985 10 4 28 41986 11 5 29 4.1428571431987 12 6 30 4.2857142861988 13 5 31 4.4285714291989 14 4 32 4.5714285711990 15 3 33 4.7142857141991 16 4 34 4.8571428571992 17 5 35 51993 18 6 36 5.1428571431994 19 7 37 5.2857142861995 20 6 38 5.4285714291996 21 5 39 5.5714285711997 22 4 40 5.7142857141998 23 5 41 5.8571428571999 24 62000 25 72001 26 8Table 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

Page 11: Time 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:

Example 21.8

Page 12: Time Series

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)

1997199819992000200120022003

2.130.3539.8257211290981

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 and ,

i.e. and ,

hence the non-linear equation of trend becomes

.

Whereas the fitted linear (secular) trend is found to be

.

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.2787162 0.35 -0.45593 -8.89643 4.2310673 39.8 1.599883 122.7861 13.999934 257 2.409933 254.4686 46.323565 211 2.324282 386.1511 153.27736 290 2.462398 517.8336 507.17047 981 2.991669 649.5161 1678.146

Table 21.5: Fitted linear and nonlinear trend

Page 13: Time Series

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.

Page 14: Time Series

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.

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 Fall199619971998199920002001

6.76.56.97.07.18.0

4.64.65.05.55.76.2

10.09.810.410.811.111.4

12.713.614.115.014.514.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.

Page 15: Time Series

Year QuarterSales

($ million)Four-Quarter

totalFour-Quarter

MACentered

MASpecificSeasonal

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

Fall

7.1

5.7

11.1

14.5

38.9

38.4

39.3

39.8

9.725

9.6

9.825

9.95

9.688

9.663

9.713

9.888

0.733

0.590

1.143

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

Page 16: Time Series

Quarter 1996 1997 1998 1999 2000 2001 Total Mean Seasonal index

Winter 0.772 0.775 0.753 0.733 0.801 3.834 0.7668 0.765079Spring 0.54 0.553 0.581 0.59 0.615 2.879 0.5758 0.574507Summer 1.18 1.13 1.141 1.126 1.143 5.72 1.144 1.141432Fall 1.503 1.55 1.535 1.558 1.466 7.612 1.5224 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,

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.

Solution:

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.

Page 17: Time Series

Year Origi-nal

time series

Seas-onal index

De-season-alized series

1996 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

1997 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

1998 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

1999 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

2000 Winter 7.1 0.77 9.28

Spring 5.7 0.57 9.92

Summer 11.1 1.14 9.72

Fall 14.5 1.52 9.55

2001 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.35313 1.003717 1.006284April 95.11744 1.001236 1.003796July 94.7398 0.997261 0.999811

October 93.82049 0.987584 0.990109Table 21.10: The Seasonal index S&P indices.

Page 18: Time Series

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 and in the equation 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.

Page 19: Time Series

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

Page 20: Time Series

Table 21.11: The deseasonalized data for Sales of Toys Int.

The use of least square method yields the following values of and

and

The value of 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:

.

Thus for the winter quarter of year 2002, substituting in the equation we get

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

.

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 Seasonal index Final forecast(Fitted trend

Seasonal index)

Winter 2005 10.35785 0.76508 7.924581Spring 2005 10.44774 0.57451 6.002331

Summer 2005 10.53763 1.14143 12.02797Fall 2005 10.62753 1.51898 16.143

Table 21.12: Forecasted sales for the four quarters of 2002 using deseasonalized data of Toys Int.

Page 21: Time Series

Figure 21.12: Forecasted sales for the four quarters of 2002

Figure 21.13: Forecasted sales for the four quartersof 2002 along with the original data