Time Series
Time Series
Forecasting
Week 11 - 12
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Introduction
• 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 forecast is available
• The information can be quantified
• It is reasonable to assume that past is prologue
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 2
Introduction
• 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 3
Time Series Patterns
Horizontal Pattern
Trend Pattern
Seasonal Pattern
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 5
Time Series Patterns
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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 6
Table 8.1: Gasoline Sales Time Series
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 7
Figure 8.1: Gasoline Sales Time Series Plot
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 8
Table 8.2: Gasoline Sales Time Series after Obtaining
the Contract with the Vermont State Police
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 9
Figure 8.2: Gasoline Sales Time Series Plot after
Obtaining the Contract with the Vermont State
Police
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 10
Time Series Patterns
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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 11
Table 8.3: Bicycle Sales Time Series
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 12
Figure 8.3: Bicycle Sales Time Series Plot
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 13
Table 8.4: Cholesterol Drug Revenue Time Series
Figure 8.4: Cholesterol Drug Revenue Times
Series Plot ($ millions)
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 14
Time Series Patterns
Seasonal Pattern
• Seasonal patterns are recurring patterns over successive periods of
time
• 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 15
Time Series Patterns
Figure 8.5:
Table 8.5: Umbrella Sales Time Series Umbrella Sales Time Series Plot
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Time Series Patterns
Trend and Seasonal Pattern
• Some time series include both a trend and a seasonal pattern
Table 8.6: Quarterly Smartphone Sales Figure 8.6: Quarterly Smartphone Sales
Time Series Time Series Plot
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 17
Time Series Patterns
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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 18
Time Series Patterns
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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 19
Forecast Accuracy
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Table 8.7: Computing Forecasts and Measures of
Forecast Accuracy Using the Most Recent Value
as the Forecast for the Next Period
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 21
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)
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Forecast Accuracy
Forecast Error: Difference between the actual
and the forecasted values for period t.
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 23
Forecast Accuracy
Mean Absolute Error (MAE): Measure of forecast accuracy that
avoids the problem of positive and negative forecast errors offsetting
one another.
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
24
Forecast Accuracy
Mean Absolute Percentage Error (MAPE): Average of the
absolute value of percentage forecast errors.
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
25
Table 8.8: Computing Forecasts and Measures of
Forecast Accuracy Using the Average of All the
Historical Data as the Forecast for the Next Period
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 26
Forecast Accuracy
• 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 27
Moving Averages and
Exponential Smoothing
Moving Averages
Forecast Accuracy
Exponential Smoothing
Forecast Accuracy
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Moving Averages and Exponential Smoothing
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 29
Table 8.9: Summary of Three-Week Moving
Average Calculations
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 30
Figure 8.7: Gasoline Sales Time Series Plot and
Three-Week Moving Average Forecasts
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 31
Figure 8.8: Data Analysis Dialog Box
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 32
Figure 8.9: Moving Average Dialog Box
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 33
Figure 8.10: Excel Output for Moving Average
Forecast for Gasoline Data
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 34
Moving Averages and Exponential Smoothing
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 35
Moving Averages and Exponential Smoothing
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 36
Moving Averages and Exponential Smoothing
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 37
Table 8.10: Summary of the Exponential Smoothing
Forecasts and Forecast Errors for the Gasoline Sales
Time Series with Smoothing Constant a = 0.2
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 38
Figure 8.11: Actual and Forecast Gasoline Time
Series with Smoothing Constant α = 0.2
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 39
Figure 8.13: Exponential Smoothing Dialog Box
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 40
Figure 8.14: Excel Output for Exponential
Smoothing Forecast for Gasoline Data
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 41
Moving Averages and Exponential Smoothing
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 42
Using Regression Analysis for
Forecasting
Linear Trend Projection
Seasonality
Seasonality without Trend
Seasonality with Trend
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 44
Figure 8.15: Excel Simple Linear Regression
Output for Trendline Model for Bicycle Sales Data
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 45
Using Regression Analysis for Forecasting
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 46
Using Regression Analysis for Forecasting
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 47
Using Regression Analysis for 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 8.5
• The time series plot corresponding to this data in Figure 8.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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 48
Using Regression Analysis for 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:
𝑦 ̂_(𝑡 )= 𝑏_0+ 𝑏_1 〖"Qtr1 " 〗_𝑡 + 𝑏_2 〖"Qtr" 2〗_𝑡 + 𝑏_3 〖"Qtr" 3〗_𝑡
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 49
Table 8.11: Umbrella Sales Time Series with
Dummy Variables
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 50
Using Regression Analysis for Forecasting
•
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 51
Table 8.12: Smartphone Sales Time Series with
Dummy Variables and Time Period
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 52
Using Regression Analysis for 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 3: Sales = 6.07 + 0.146t
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 53
Using Regression Analysis for 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 54
Table 8.13: Student Population and Quarterly
Sales data for 10 Armand’s Pizza Parlors
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 55
Figure 8.16: Scatter Chart of Student Population
and Quarterly Sales for Armand’s Pizza Parlors
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 56
Figure 8.17: Graph of the Estimated Regression
Equation for Armand’s Pizza Parlors: y = 60 + 5x
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 57
Using Regression Analysis for 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 58
Determining the Best
Forecasting Model to Use
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use.
Determining the Best Forecasting
Model to Use
• 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 60
Determining the Best Forecasting
Model to Use
• 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
© 2016 Cengage Learning. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part, except for use as permitted in a license distributed with a certain product or service or otherwise on a password-protected website for classroom use. 61