Statistics for Decision Making
TIME SERIES
        FORECASTING
         Dr. Rohit Joshi, IIM Shillong
                     Outline
• Develop and implement basic forecasting models
• Identify the components present in a time series
• Use smoothing-based forecasting models, including
  moving average and exponential smoothing
• Apply trend-based forecasting models, including
  linear trend and nonlinear trend
• Complete time-series forecasting of seasonal data
• Compute and interpret basic index numbers
   The Importance of Forecasting
• Governments forecast unemployment, interest rates,
  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
• Retail stores forecast demand to control inventory
  levels, hire employees and provide training
             Time-Series Data
• Numerical data obtained at regular time
  intervals
• The time intervals can be annually, quarterly,
  daily, hourly, etc.
• Example:
    Year:    1999 2000 2001 2002 2003
    Sales:      75.3   74.2 78.5 79.7 80.2
                  Time-Series Plot
   A time-series plot is a two-dimensional plot of time
                          series data
• the vertical axis                                                           U.S. Inflation Rate
  measures the variable of                       16.00
  interest                  Inflation Rate (%)
                                                 14.00
                                                 12.00
                                                 10.00
• the horizontal axis                             8.00
                                                  6.00
  corresponds to the time                         4.00
                                                  2.00
  periods                                         0.00
                                                         1975
                                                                1977
                                                                       1979
                                                                                     1983
                                                                                                   1987
                                                                                                                 1991
                                                                                                                        1993
                                                                                                                               1995
                                                                                                                                             1999
                                                                              1981
                                                                                            1985
                                                                                                          1989
                                                                                                                                      1997
                                                                                                                                                    2001
                                                                                                      Y ear
       Time-Series Components
                  Time Series
  Trend      Seasonal       Cyclical    Irregular
Component   Component     Component    Component
            Trend Component
• Long-run increase or decrease over time (overall
  upward or downward movement)
• Data taken over a long period of time
                                            rd trend
   Sales                               Upwa
                                          Time
                 Trend Component
   • Trend can be upward or downward
   • Trend can be linear or non-linear
Sales                              Sales
                            Time                                Time
    Downward linear trend              Upward nonlinear trend
                 Seasonal Component
        • Short-term regular wave-like patterns
        • Observed within 1 year
        • Often monthly or quarterly
Sales
                                                                Summer
                                              Winter
                              Summer
            Winter                                     Spring            Fall
                     Spring            Fall
                                Time (Quarterly)
          Cyclical Component
• Long-term wave-like patterns
• Regularly occur but may vary in length
• Often measured peak to peak or valley to
  valley               1 Cycle
  Sales
                                   Year
      Irregular Component
• Unpredictable, random, “residual”
  fluctuations
• Due to random variations of
  – Nature
  – Accidents or unusual events
• “Noise” in the time series
 Multiplicative Time-Series Model with a
          Seasonal Component
• Used primarily for forecasting
• Allows consideration of seasonal variation
            Yi  Ti  Si  Ci  Ii
    where        Ti = Trend value at time i
             Si = Seasonal value at time i
             Ci = Cyclical value at time i
             Ii = Irregular (random) value at time i
Multiplicative Time-Series Model for Annual
                    Data
    Used primarily for forecasting
    Observed value in time series is the product of
     components
                 Yi  Ti  Ci  Ii
       where       Ti = Trend value at year i
               Ci = Cyclical value at year i
               Ii = Irregular (random) value at year i
            Smoothing the
           Annual Time Series
• Calculate moving averages to get an
  overall impression of the pattern of
  movement over time
Moving Average: averages of consecutive
          time series values for a
          chosen period of length L
          Moving Averages
• Used for smoothing
• A series of arithmetic means over time
• Result dependent upon choice of L (length of
  period for computing means)
• Examples:
  – For a 5 year moving average, L = 5
  – For a 7 year moving average, L = 7
  – Etc.
            Moving Averages …
• Example: Five-year moving average
   – First average:
                         Y1  Y2  Y3  Y4  Y5
               MA(5) 
                                   5
   – Second average:
                         Y2  Y3  Y4  Y5  Y6
               MA(5) 
                                   5
   – etc.
          Example: Annual Data
Year   Sales                             Annual Sales
 1      23
                        60
 2      40
                        50
 3      25
 4      27              40                                                …
 5      32      Sales   30
 6      48
                        20
 7      33
 8      37              10
 9      37               0
                             1   2   3   4   5    6     7   8   9   10   11
                                                                            …
10      50
11      40                                       Year
etc…    etc…
       Calculating Moving Averages
                                 5-Year
                      Average   Moving
Year   Sales           Year     Average
 1      23                                         1 2  3  4  5
                         3       29.4        3
 2      40                                                5
                         4       34.4
 3      25               5       33.0              23  40  25  27  32
                                          29.4 
 4      27               6       35.4                        5
 5      32               7       37.4
 6      48               8       41.0
 7      33               9       39.4
 8      37              …         …
 9      37     etc…
10      50
                  • Each moving average is for a consecutive
 11     40
                    block of 5 years
      Annual vs. Moving Average
• The 5-year                            Annual vs. 5-Year Moving Average
  moving average           60
  smoothes the             50
  data and shows           40
  the underlying
                   Sales
                           30
  trend                    20
                           10
                            0
                                1   2      3    4       5    6     7    8     9     10   11
                                                            Year
                                               Annual       5-Year Moving Average
    Exponential Smoothing
• A weighted moving average
  – Weights decline exponentially
  – Most recent observation weighted most
• Used for smoothing and short term
  forecasting (often one period into the
  future)
    Exponential Smoothing
• The weight (smoothing coefficient) is W
  – Subjectively chosen
  – Range from 0 to 1
  – Smaller W gives more smoothing, larger W
    gives less smoothing
• The weight is:
  – Close to 0 for smoothing out unwanted
    cyclical and irregular components
  – Close to 1 for forecasting
      Exponential Smoothing Model
            Fi 1  WDi  (1  W ) Fi
                                                   For i = 2, 3, 4, …
where:
   Fi+1 = exponentially smoothed forecast value for period i+1
   Fi = exponentially smoothed value already
         computed for period i
    Di = actual observed value in period i
    W = weight (smoothing coefficient), 0 < W < 1
         Exponential Smoothing Example
    • Suppose we use weight W = .2
 Time             Forecast
         Sales                    Exponentially Smoothed
Period           from prior
          (Yi)                    Value for this period (Ei)
  (i)            period (Fi-1)
 1        23         --                         23                     F1 = Y1 since
 2        40         23               (.2)(40)+(.8)(23)=26.4           no prior
                                                                       information
 3        25        26.4            (.2)(25)+(.8)(26.4)=26.12
                                                                       exists
 4        27       26.12          (.2)(27)+(.8)(26.12)=26.296
 5        32       26.296        (.2)(32)+(.8)(26.296)=27.437
 6        48       27.437        (.2)(48)+(.8)(27.437)=31.549   Ei 
 7        33       31.549        (.2)(48)+(.8)(31.549)=31.840   WYi  (1  W )Ei1
 8        37       31.840        (.2)(33)+(.8)(31.840)=32.872
 9        37       32.872        (.2)(37)+(.8)(32.872)=33.697
 10       50       33.697        (.2)(50)+(.8)(33.697)=36.958
 etc.     etc.      etc.                        etc.
             Sales vs. Smoothed Sales
                     Fluctuations have been smoothed
        60
        50
        40
Sales
        30
        20
        10
         0
             1   2      3   4    5      6     7    8   9   10
                                Time Period
                                Sales       Smoothed
      Trend-Based Forecasting
• Estimate a trend line using regression analysis
          Time                Use time (X) as the
  Year   Period   Sales        independent variable:
           (X)     (Y)
 1999      0       20
 2000      1       40           Ŷ  b0  b1X
 2001      2       30
 2002      3       50
 2003      4       70
 2004      5       65
          Trend-Based Forecasting
                        • The linear trend forecasting equation is:
        Time
Year   Period   Sales                    Ŷi  21.905  9.5714 Xi
         (X)     (Y)                             Sales trend
1999      0      20
                                80
2000      1      40             70
                                60
2001      2      30             50
                        sales
2002      3      50             40
                                30
2003      4      70             20
                                10
2004      5      65              0
                                     0      1    2       3     4   5   6
                                                       Year
             Trend-Based Forecasting
                                                                (continued)
                        • Forecast for time period 6:
        Time
       Period
                                         Ŷ  21.905  9.5714 (6)
Year            Sales
         (X)     (y)                        79.33
1999     0       20
2000     1       40
                                80
2001     2       30             70
2002     3       50             60
                                50
                        sales
2003     4       70             40
                                30
2004     5       65             20
                                10
2005     6       ??             0
                                     0     1     2    3     4     5      6
                                                     Year
    Nonlinear Trend Forecasting
• A nonlinear regression model can be used when the
  time series exhibits a nonlinear trend
• Quadratic form is one type of a nonlinear model:
            Yi  0  1Xi  2 X  i2
                                      i
• Compare adj. r2 and standard error to that of linear
  model to see if this is an improvement
• Can try other functional forms to get best fit
                         A problem
• Whirly world, specializes in producing recreational
  equipments. To forecast future sales based on its
  analysis of its past pattern of sales the firm has
  collected the information as below. As a sales
  planning manager forecast the sale for upcoming
  quarters.
                Sales per quarter (X $ 10,000)
               Q1 Q2 Q3 Q4
     2010 16.0 21.0 9.0 18.0 15.0 20.0 10.0 18.0
     2011 17.0 24.0 13.0 22.0 17.0 25.0 11.0 21.0
     2012 18.0 26.0 14.0 25.0
     2013
     2014
                  Pitfalls in
             Time-Series Analysis
• Assuming the mechanism that governs the
  time series behavior in the past will still hold
  in the future
• Using mechanical extrapolation of the trend to
  forecast the future without considering
  personal judgments, business experiences,
  changing technologies, and habits, etc.