You are on page 1of 36

5/30/2018

Chapter 7

TIME SERIES ANALYSIS AND


FORECASTING

The Importance of Forecasting

 Governments forecast unemployment, interest rates, and


expected revenues from income taxes for policy purposes
 Marketing executives forecast demand, sales, and
consumer preferences for strategic planning
 College administrators forecast enrollments to plan for
facilities and for faculty recruitment
 Manufacturing firms forecast demand for their products
for necessary manpower and raw materials

1
5/30/2018

Introduction
3

 Forecasting methods can be classified as qualitative


or quantitative
 Qualitative methods generally involve the use of
expert judgment to develop forecasts
 Quantitative forecasting methods can be used
when:
 Past information about the variable being forecasted
is available
 The information can be quantified
 It is reasonable to assume that past is prologue

Introduction
4

 The objective of time series analysis is to uncover a


pattern in the time series and then extrapolate the
pattern into the future
 The forecast is based solely on past values of the
variable and/or on past forecast errors
 Modern data-collection technologies have enabled
individuals, businesses, and government agencies to
collect vast amounts of data that may be used for
causal forecasting

2
5/30/2018

Time Series Patterns


 Horizontal Pattern
 Trend Pattern

 Seasonal Pattern

 Trend and Seasonal Pattern

 Cyclical Pattern

 Identifying Time Series


Pattern

Time Series Patterns


6

 Time series: a sequence of observations on a variable


measured at successive points in time or over successive
periods of time
 The measurements may be taken every hour, day, week,
month, year, or any other regular interval. The pattern
of the data is important to understand the series’ past
behavior
 If the behavior of the times series data of the past is
expected to continue in the future, we can use it to
guide us in selecting an appropriate forecasting
method

3
5/30/2018

Time Series Patterns


7

Horizontal Pattern
 Exists when the data fluctuate randomly around a
constant mean over time
 Stationary time series: denotes a time series whose
statistical properties are independent of time
 The process generating the data has a constant mean
 The variability of the time series is constant over time
 A time series plot for a stationary time series will
always exhibit a horizontal pattern with random
fluctuations

Example
 Consider the data show the number of gallons of
gasoline (in 1000s) sold by a gasoline distributor in
Bennington, Vermont, over the past 12 weeks. The
average value or mean for this time series is 19.25
or 19,250 gallons per week. Figure 1 shows a time
series plot for these data. Note how the data
fluctuate around the sample mean of 19,250
gallons.
 Although random variability is present, we would
say that these data follow a horizontal pattern.

4
5/30/2018

Table 1: Gasoline Sales Time Series


9

Figure 1: Gasoline Sales Time Series Plot


10

5
5/30/2018

Example
 Suppose the gasoline distributor signs a contract
with the Vermont State Police to provide gasoline
for state police cars located in southern Vermont
beginning in week 13. With this new contract, the
distributor naturally expects to see a substantial
increase in weekly sales starting in week 13. Table
2 shows the number of gallons of gasoline sold for
the original time series and the ten weeks after
signing the new contract. Figure 2 shows the
corresponding time series plot. Note the increased
level of the time series beginning in week 13.

Table 2: Gasoline Sales Time Series after


12
Obtaining the Contract with the Vermont
State Police

6
5/30/2018

Figure 2: Gasoline Sales Time Series Plot


after Obtaining the Contract with the
13
Vermont State Police

Time Series Patterns


14

Trend Pattern
 A trend pattern is gradual shifts or movements to
relatively higher or lower values over a longer period
of time
 A trend is usually the result of long-term factors such as:
 Population increases or decreases
 Shifting demographic characteristics of the population
 Improving technology
 Changes in the competitive landscape
 Changes in consumer preferences

7
5/30/2018

Example
 Consider the time series of bicycle sales for a
particular manufacturer over the past ten years, as
shown in Table 3 and Figure 3

Table 3: Bicycle Sales Time Series


16

8
5/30/2018

Figure 3: Bicycle Sales Time Series Plot


17

Example
 Data in Table 4 and the corresponding time series plot in
Figure 4 show the sales revenue for a cholesterol drug since
the company won FDA approval for the drug ten years ago.
The time series increases in a nonlinear fashion; that is, the rate
of change of revenue does not increase by a constant amount
from one year to the next. In fact, the revenue appears to be
growing in an exponential fashion

9
5/30/2018

Table 4: Cholesterol Drug Revenue Time


Series
19
Figure 4: Cholesterol Drug Revenue Times
Series Plot ($ millions)

Time Series Patterns


20

Seasonal Pattern
 Seasonal patterns are recurring patterns over
successive periods of time
 Seasonal patterns are short-term cyclic fluctuations
 Example: A manufacturer of swimming pools expects low
sales activity in the fall and winter months, with peak sales
in the spring and summer months to occur every year
 Time series plot not only exhibits a seasonal pattern
over a one-year period but also for less than one year
in duration
 Example: daily traffic volume shows within-the-day
“seasonal” behavior

10
5/30/2018

Example
 Consider the number of umbrellas sold at a clothing
store over the past five years. Table 5 shows the
time series and Figure 5 shows the corresponding
time series plot

Time Series Patterns


Table 5: Umbrella Sales Time Figure 5:
Series Umbrella Sales Time Series Plot

11
5/30/2018

Example
 The data in Table 6 and the corresponding time
series plot in Figure 6 show quarterly smartphone
sales for a particular manufacturer over the past
four years.

Time Series Patterns


24

Trend and Seasonal Pattern


 Some time series include both a trend and a

seasonal pattern
Table 6: Quarterly Smartphone Figure 6: Quarterly Smartphone
Sales Time Series Sales Time Series Plot

12
5/30/2018

Time Series Patterns


25

Cyclical Pattern
 A cyclical pattern exists if the time series plot shows an
alternating sequence of points below and above the
trendline that lasts for more than one year
 Example: Periods of moderate inflation followed by
periods of rapid inflation can lead to a time series that
alternates below and above a generally increasing
trendline
 Cyclical effects are often combined with long-term
trend effects and referred to as trend-cycle effects

Time Series Patterns


26

Identifying Time Series Patterns


 The underlying pattern in the time series is an

important factor in selecting a forecasting method


 A time series plot should be one of the first analytic

tools
 We need to use a forecasting method that is

capable of handling the pattern exhibited by the


time series effectively

13
5/30/2018

Forecast Accuracy
 Forecast Error
 Mean Forecast Error (MFE)

 Mean Absolute Error (MAE)

 Mean Squared Error (MSE)

 Mean Absolute Percentage Error (MAPE)

Table 7: Computing Forecasts and


28
Measures of Forecast Accuracy Using the
Most Recent Value as the Forecast for the
Next Period

14
5/30/2018

Forecast Accuracy
 Naïve forecasting method: Using the most recent data
to predict future data
 The key concept associated with measuring forecast
accuracy is forecast error
 Measures to determine how well a particular
forecasting method is able to reproduce the time series
data that are already available
 Forecast error
 Mean forecast error
 Mean absolute error (MAE)
 Mean squared error (MSE)
 Mean absolute percentage error (MAPE)

Forecast Accuracy
30

Forecast Error: Difference between the actual


and the forecasted values for period t.

= −

Mean Forecast Error: Mean or average of


the forecast errors.


MFE =

15
5/30/2018

Forecast Accuracy

Mean Absolute Error (MAE): Measure of forecast


accuracy that avoids the problem of positive and
negative forecast errors offsetting one another.

MAE =

Mean Squared Error (MSE): measure that avoids the


problem of positive and negative errors offsetting each
other is obtained by computing the average of the
squared forecast errors.


MFE =

31

Forecast Accuracy

Mean Absolute Percentage Error (MAPE): Average of the


absolute value of percentage forecast errors.


MAPE =

32

16
5/30/2018

Table 8: Computing Forecasts and Measures


33
of Forecast Accuracy Using the Average of
All the Historical Data as the Forecast for the
Next Period

Forecast Accuracy
34

 Compare the accuracy of the two forecasting methods


by comparing the values of MAE, MSE, and MAPE for
each method
Naïve Method Average of Past
Values
MAE 3.73 2.44
MSE 16.27 8.10
MAPE 19.24% 12.85%

 The average of past values provides more accurate


forecasts for the next period than using the most recent
observation

17
5/30/2018

Moving Averages and Exponential


Smoothing
 Moving Averages
 Forecast Accuracy

 Exponential Smoothing

 Forecast Accuracy

Moving Averages and Exponential


36
Smoothing
Moving Averages
 Moving averages method: Uses the average of the

most recent k data values in the time series as the


forecast for the next period
 Moving average forecast:

∑ most recent k data values ∑


= =
+ + +
=

18
5/30/2018

Table 9: Summary of Three-Week


Moving Average Calculations
37

Figure 7: Gasoline Sales Time Series


38
Plot and Three-Week Moving Average
Forecasts

19
5/30/2018

Figure 8: Data Analysis Dialog Box


39

Figure 9: Moving Average Dialog Box


40

20
5/30/2018

Figure 10: Excel Output for Moving


Average Forecast for Gasoline Data
41

Moving Averages and Exponential


42
Smoothing
Forecast Accuracy
The values of the three measures of forecast accuracy
for the three-week moving average calculations in
Table 9:
∑ 24
MAE = = 9 = 2.67

∑ 92
MSE = = 9 = 10.22

∑ 129.21
MAPE = = = 14.36%
9

21
5/30/2018

Moving Averages and Exponential


43
Smoothing
Exponential Smoothing
 Exponential smoothing uses a weighted average

of past time series values as a forecast


 Exponential Smoothing Forecast:

= α + (1 – α)
 Smoothing constant (α )is the weight given to the
actual value in period t; weight given to the
forecast in period t is 1 –α.

Moving Averages and Exponential


44
Smoothing
Illustration: Consider a time series involving only three
periods of data: y1, y2, and y3.
 Let equal the actual value of the time series in
period 1; that is, = y1
 Hence, the forecast for period 2 is:
=α + (1 – α)
=α + (1 – α)
=

22
5/30/2018

Table 10: Summary of the Exponential


Smoothing Forecasts and Forecast Errors for
45
the Gasoline Sales Time Series with
Smoothing Constant a = 0.2

Figure 11: Actual and Forecast Gasoline


46
Time Series with Smoothing Constant α
= 0.2

23
5/30/2018

Figure 13: Exponential Smoothing


47
Dialog Box

Figure 14: Excel Output for Exponential


48
Smoothing Forecast for Gasoline Data

24
5/30/2018

Moving Averages and Exponential


49
Smoothing
Forecast Accuracy
 Insight into choosing a good value for a can be

obtained by rewriting the basic exponential


smoothing model as:
= + α
 If the time series contains substantial random

variability, a small value of the smoothing constant


is preferred and vice-versa
 Choose the value of a that minimizes the MSE

Using Regression Analysis for


Forecasting
 Linear Trend Projection
 Seasonality
 Seasonality without Trend
 Seasonality with Trend
 Using Regression Analysis as a Causal
Forecasting Method
 Combining Causal Variables with Trend and

Seasonality Effects
 Considerations in Using Regression in
Forecasting

25
5/30/2018

Using Regression Analysis for


51
Forecasting
Linear Trend Projection
 Regression analysis can be used to forecast a time series with
a linear trend
 Simple linear regression analysis yields the linear relationship
between the independent variable and the dependent
variable that minimizes the MSE
 Use this approach to find a best-fitting line to a set of data
that exhibits a linear trend
 The variable to be forecasted (y, the actual value of the time
series period t) is dependent variable
 Trend variable (time period t) is the independent variable
 Equation for the trendline: = + t

Figure 15: Excel Simple Linear


52
Regression Output for Trendline Model
for Bicycle Sales Data

26
5/30/2018

Using Regression Analysis for


53
Forecasting
 Trend equation for the bicycle sales time series:
= 20.4 + 1.1t
 Substituting t = 11 into the above equation yields
next year’s trend projection,
= 20.4 + 1.1 (11) = 32.5
 Thus, the linear trend model yields a sales forecast
of 32,500 bicycles for the next year

Using Regression Analysis for


54
Forecasting
 We can also use more complex regression models
to fit nonlinear trends
= + t+ +

 Autoregressive models: Regression models such as


this in which the independent variables are previous
values of the time series
= + + +

27
5/30/2018

Using Regression Analysis for


55
Forecasting
Seasonality Without Trend
 We can model a time series with a seasonal pattern by
treating the season as a dummy variable
 Illustration:
 Consider the data on the number of umbrellas sold in Table 5
 The time series plot corresponding to this data in Figure 5 do
not suggest any long-term trend in sales
 Closer inspection of the time series plot suggests that a
quarterly seasonal pattern is present
 k - 1 dummy variables are required to model a categorical
variable that has k levels
 Thus, to model the seasonal effects in the umbrella time series
we need 4 – 1 = 3 dummy variables

Using Regression Analysis for


56
Forecasting
 Illustration (continued):
 The three dummy variables can be coded as follows:
1 if period t is a quarter 1
Qtr1t = 0 otherwise
1 if period t is a quarter 2
Qtr2t = 0 otherwise
1 if period t is a quarter 3
Qtr3t = 0 otherwise

 General form of the equation relating the number of


umbrellas sold to the quarter the sales take place

yˆt  b0  b1Qtr1t  b2Qtr 2t  b3Qtr 3t

28
5/30/2018

Table 11: Umbrella Sales Time Series


with Dummy Variables
57

Using Regression Analysis for


58
Forecasting
We can use a multiple linear regression model to find the
values of b0, b1, b2, and b3 that minimize the sum of squared
errors. Using the data in Table 11 and regression analysis, we
obtain the following regression equation:

yˆt  95.0  29.0Qtr1t  57.0Qtr 2t  26.0Qtr 3t


Forecast sales of every quarter for next year
Quarter 1: Sales = 95.0 + 29.0 (1) + 57.0 (0) + 26.0 (0) = 124
Quarter 2: Sales = 95.0 + 29.0 (0) + 57.0 (1) + 26.0 (0) = 152
Quarter 3: Sales = 95.0 + 29.0 (0) + 57.0 (0) + 26.0 (1) = 121
Quarter 4: Sales = 95.0 + 29.0 (0) + 57.0 (0) + 26.0 (0) = 95.0

29
5/30/2018

Using Regression Analysis for


59
Forecasting
Seasonality with Trend
 The time series contains both seasonal effects and a
linear trend
 Consider the data for the smartphone time series in
Table 6
 The time series plot corresponding to this data indicates
that there is both linear trend and seasonal pattern
 The general form of the regression equation takes the
form
= + Qtr1 + Qtr2 + Qtr3 + t

Table 12: Smartphone Sales Time Series


with Dummy Variables and Time Period
60

30
5/30/2018

Using Regression Analysis for


61
Forecasting
 Using the data in Table 12 with the regression
model that includes both the seasonal and trend
components, we obtain the following equation that
minimizes our sum of squared errors:

yˆt  6.07 1.36Qtr1t  2.03Qtr 2t  0.304Qtr3t  0.146t

Using Regression Analysis for


62
Forecasting
 The dummy variables in the equation for
Smartphone Sales time series provide four
equations given time period t corresponds to
quarters 1, 2, 3, and 4
 Quarter 1: Sales = 4.71 + 0.146t
 Quarter 2: Sales = 4.04 + 0.146t
 Quarter 3: Sales = 5.77 + 0.146t
 Quarter 4: Sales = 6.07 + 0.146t

31
5/30/2018

Using Regression Analysis for


63
Forecasting
 Forecast quarterly sales for next year. Next year is
year 5 for the smartphone sales time series, that is,
time periods 17, 18, 19, and 20.
 Quarter 1, Year 5: Sales = 4.71 + 0.146(17) = 7.19
 Quarter 2, Year 5: Sales = 4.04 + 0.146 (18) = 6.67
 Quarter 3, Year 5: Sales = 5.77 + 0.146 (19) = 8.54
 Quarter 4, Year 5: Sales = 6.07 + 0.146 (20) = 8.99

Using Regression Analysis for


64
Forecasting
Using Regression Analysis as a Causal Forecasting
Method
 The relationship of the variable to be forecast with
other variables may also be used to develop a
forecasting model
 Advertising expenditures when sales is to be forecast
 The mortgage rate when new housing construction is to be
forecast
 Causal models: Models that include only variables
that are believed to cause changes in the variable to
be forecast

32
5/30/2018

Table 13: Student Population and


65
Quarterly Sales data for 10 Armand’s
Pizza Parlors

Figure 16: Scatter Chart of Student


66
Population and Quarterly Sales for
Armand’s Pizza Parlors

33
5/30/2018

Figure 17: Graph of the Estimated


67
Regression Equation for Armand’s Pizza
Parlors: y = 60 + 5x

Using Regression Analysis for


68
Forecasting
Combining Causal Variables with Trend and Seasonality
Effects
 Regression models are very flexible and can incorporate
both causal variables and time series effects
Considerations in Using Regression in Forecasting
 Whether a regression approach provides a good forecast
depends largely on:
 How well we are able to identify and obtain data for
independent variables that are closely related to the time series
 Part of the regression analysis procedure should focus on the
selection of the set of independent variables that provides the
best forecasting model

34
5/30/2018

Determining the Best Forecasting


Model to Use

Determining the Best Forecasting


Model to Use
70

 A visual inspection can indicate whether seasonality


appears to be a factor and whether a linear or
nonlinear trend seems to exist
 For causal modeling, scatter charts can indicate
whether strong linear or nonlinear relationships exist
between the independent and dependent variables
 If certain relationships appear totally random, this
may lead you to exclude these variables from the
model

35
5/30/2018

Determining the Best Forecasting


Model to Use
71

 While working with large data sets it is recommended


to divide your data into training and validation sets
 Based on the errors produced by the different models
for the validation set, we can pick the model that
minimizes some forecast error measure, such as MAE,
MSE or MAPE
 There are software packages that will automatically
select the best model to use
 Ultimately the user should decide which model to use
based on the software output and his managerial
knowledge

36

You might also like