Chapter 5
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
    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
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
    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 5.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.
    Table 5.1: Gasoline Sales Time
    Series
9
     Figure 5.1: Gasoline Sales Time
     Series Plot
10
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 5.2 shows the number of gallons
    of gasoline sold for the original time series and
    the ten weeks after signing the new contract.
    Figure 5.2 shows the corresponding time series
    plot. Note the increased level of the time series
    beginning in week 13.
     Table 5.2: Gasoline Sales Time
     Series after Obtaining the
12   Contract with the Vermont
     State Police
     Figure 5.2: Gasoline Sales Time
     Series Plot after Obtaining the
13   Contract with the 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
Example
   Consider the time series of bicycle sales
    for a particular manufacturer over the
    past ten years, as shown in Table 5.3 and
    Figure 5.3
     Table 5.3: Bicycle Sales Time Series
16
     Figure 5.3: Bicycle Sales Time
     Series Plot
17
Example
   Data in Table 5.4 and the corresponding time
    series plot in Figure 5.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
     Table 5.4: Cholesterol Drug
     Revenue Time Series
19   Figure 5.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
Example
   Consider the number of umbrellas sold
    at a clothing store over the past five
    years. Table 5.5 shows the time series
    and Figure 5.5 shows the corresponding
    time series plot
Time Series Patterns
                            Figure 5.5:
Table 5.5: Umbrella Sales
                            Umbrella Sales Time
Time Series
                            Series Plot
Example
   The data in Table 5.6 and the
    corresponding time series plot in Figure
    5.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 5.6: Quarterly    Figure 5.6: Quarterly
     Smartphone Sales Time   Smartphone Sales Time
     Series                  Series Plot
     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
Forecast Accuracy
 Forecast Error
 Mean Forecast Error (MFE)
 Mean Absolute Error (MAE)
 Mean Squared Error (MSE)
 Mean Absolute Percentage Error (MAPE)
     Table 5.7: Computing Forecasts
     and Measures of Forecast
28   Accuracy Using the Most
     Recent Value as the Forecast
     for the Next Period
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 =
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
     Table 5.8: Computing Forecasts
     and    Measures    of    Forecast
33   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   Average of Past
                         Method       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
Moving Averages and Exponential
Smoothing
 Moving Averages
 Forecast Accuracy
 Exponential Smoothing
 Forecast Accuracy
     Moving    Averages    and
36
     Exponential 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:
      =
     Table 5.9: Summary of Three-
     Week Moving Average
37   Calculations
     Figure 5.7: Gasoline Sales
     Time Series Plot and Three-
38   Week Moving Average
     Forecasts
     Figure 5.8: Data Analysis
39
     Dialog Box
     Figure 5.9: Moving Average
     Dialog Box
40
     Figure 5.10: Excel Output for
     Moving Average Forecast for
41   Gasoline Data
     Moving Averages and
42
     Exponential Smoothing
     Forecast Accuracy
     The values of the three measures of
     forecast accuracy for the three-week
     moving average calculations in Table
     8.9:
                 MAE = = = 2.67
                MSE = = = 10.22
               MAPE = = = 14.36%
     Moving Averages and
43
     Exponential 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
44
     Exponential 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 – α)
           =
     Table 5.10: Summary of the
     Exponential Smoothing Forecasts
45   and Forecast Errors for the
     Gasoline Sales Time Series with
     Smoothing Constant a = 0.2
     Figure   5.11:   Actual  and
     Forecast    Gasoline    Time
46   Series    with     Smoothing
     Constant α = 0.2
     Figure 5.13: Exponential
47
     Smoothing Dialog Box
     Figure 5.14: Excel Output for
     Exponential        Smoothing
48   Forecast for Gasoline Data
     Moving Averages and
49
     Exponential Smoothing
     Forecast Accuracy
       Insight into choosing a good value for
        acan 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
     Using Regression Analysis
51
     for 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 5.15: Excel Simple
     Linear Regression Output for
52
     Trendline Model for Bicycle
     Sales Data
     Using Regression
53
     Analysis for 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
54
     Analysis for 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
                           =
     Using Regression
55
     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 5.5
            The time series plot corresponding to this data in Figure
             5.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
56
     Analysis for Forecasting
         Illustration (continued):
          The three dummy variables can be coded as
             follows: 1 if period t is a quarter 1
                       0 otherwise
             Qtr1t =
                       1 if period t is a quarter 2
                       0 otherwise
             Qtr2t =
                       1 if period t is a quarter 3
                       0 otherwise
             Qtr3t =
            General form of the equation relating the
             number of umbrellas sold to the quarter the
             salesyˆ ttake place
                       b0  b1Qtr1t  b2Qtr 2t  b3Qtr 3t
     Table 5.11: Umbrella Sales
     Time Series with Dummy
57   Variables
     Using Regression
58
     Analysis for 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 5.11 and regression analysis, we obtain the
     following regression equation:
          yˆt 95.0  29.0Qtr1t  57.0Qtr 2 t  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
     Using Regression
59
     Analysis for 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 8.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
                             =t
     Table 5.12: Smartphone Sales
     Time Series with Dummy
60
     Variables and Time Period
     Using Regression Analysis
61
     for Forecasting
        Using the data in Table 5.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.304Qtr 3t  0.146t
     Using Regression Analysis
62
     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 4: Sales = 6.07 + 0.146t
     Using Regression Analysis
63
     for 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
64
     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
     Table 5.13: Student
     Population and Quarterly
65
     Sales data for 10 Armand’s
     Pizza Parlors
     Figure 5.16: Scatter Chart of
     Student Population and
66   Quarterly Sales for Armand’s
     Pizza Parlors
     Figure 5.17: Graph of the
     Estimated          Regression
67   Equation for Armand’s Pizza
     Parlors: y = 60 + 5x
     Using Regression
68
     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
Determining the Best Forecasting
Model to Use
     Determining the Best
     Forecasting
70   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
     Determining                   the         Best
     Forecasting
71   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