Professional Documents
Culture Documents
and Forecasting
1 Introduction
• Any variable that is measured over time in
sequential order is called a time series.
• We analyze time series to detect patterns.
• The patterns help in forecasting future values of
the time series.
Predicted value
The time series exhibit a
downward trend pattern.
2
2 Components of a Time Series
• A time series can consist of four components.
• Long - term trend (T).
• Cyclical effect (C).
• Seasonal effect (S).
• Random variation (R).
3
Components of a Time Series
5
Components of a Time Series
7
Moving Averages
• A k-period moving average for time period t is the
arithmetic average of the time series values around
period t.
8
Moving Average: Example
• Example 1
• To forecast future gasoline sales, the last four years quarterly sales were
recorded.
• Calculate the three-quarter and five-quarter moving average. Show the
relevant graphs.
Moving Average
3-period moving average
100
Value
50
13
Centered Moving Average: Example
• Calculate the 4-period moving average and center it, for
the data given below:
Period Time series Moving Avg. Centerd Mov.Avg.
1 15
2 27
3
(2.5)
20 19.0
4 14 20.25
(3.5) 21.5
5 25 19.50
(4.5) 17.5
6 11
14
Exponential Smoothing
15
Exponentially Smoothed Time Series
SStt == wy
wytt ++ (1-w)S
(1-w)St-1
t-1
16
The Exponentially Smoothed Process
• Example 2
Calculate the gasoline sale smoothed time series
using exponential smoothing with w = .2, and w
= .7. Period Gas
Sales
Set S1 = y1 1 39 S1 = 39
S2 = wy2 + (1-w)S1 2 37 S2 = (.2)(37) + (1-.2)(39) = 38.6
S3 = wy3 + (1-w)S2 3 61 S3 = (.2)(61) + (1-.2)(38.6) = 43.1
4 58
5 18
6 56
. .
. .
17
The Exponentially Smoothed Process
• Example 2-continued
Exponential Smoothing, w=.2 Small ‘w’ provides
100 a lot of smoothing
Value
50
0
1
11
13
15
Exponential Smoothing , w=.7
100
Value
50
0
1 3 5 7 9 11 13 15
18
4 Trend and Seasonal Effects
Trend Analysis
• The trend component of a time series can be linear
or non-linear.
• It is easy to isolate the trend component using linear
regression.
• For linear trend use the model y = b0 + b1t + e.
• For non-linear trend with one (major) change in slope use
the quadratic model y = b0 + b1t + b2t2 + e
19
Seasonal Analysis
• Seasonal variation may occur within a year or within a shorter period
(month, week)
• To measure the seasonal effects we construct seasonal indexes.
• Seasonal indexes express the degree to which the seasons differ from
the average time series value across all seasons.
20
Computing Seasonal Indexes
• Remove the effects of the seasonal and random
variations by regression analysis
= b0 + ŷbt 1t
• For each time period compute the ratio
>
yt/yt This is based on the Multiplicative Model.
>
• For each season calculate the average of yt/yt
which provides the measure of seasonality.
• Adjust the average above so that the sum of averages
of all seasons is 1 (if necessary)
21
Computing Seasonal Indexes
• Example 3
• Calculate the quarterly seasonal indexes for hotel
occupancy rate in order to measure seasonal variation.
• Data:
22
Computing Seasonal Indexes
• Perform regression analysis for the model
y = b0 + b1t + e where t represents the time, and y
represents the occupancy rate.
Time (t) Rate
1 0.561
ŷ .639368 .005246t
2 0.702
3 0.800
4 0.568
Rate
5 0.575
6 0.738
7 0.868
8 0.605 0 5 10 15 20 25
. . The regression line
t represents trend.
. .
23
The Ratios yt / yt
>
t yt ŷ t Ratio
1 .561 .645 .561/.645=.870
2 .702 .650 .702/.650=1.08
3 ………………………………………………….
=.639368+.005245(1)
No trend is observed, but
yt seasonality and randomness
Rate/Predicted rate
ŷ t still exist.
1.5
0.5
0 11
15
17
19
1
13 24
The Average Ratios by Seasons
Rate/Predicted rate
0.870
• To remove most of the random variation
1.080
1.221 but leave the seasonal effects,average
0.860
0.864
the termsyt / yˆ t for each season.
1.100
1.284 Rate/Predicted rate
0.888
0.865 1.5
1.067
1.046 1
0.854
0.5
0.879
0.993 0
1.122
1 3 5 7 9 11 13 15 17 19
0.874 Average ratio for quarter 1:(.870 + .864 + .865 + .879 + .913)/5 = .878
0.913
1.138
Average ratio for quarter 2: (1.080+1.100+1.067+.993+1.138)/5 = 1.076
1.181 Average ratio for quarter 3: (1.221+1.284+1.046+1.122+1.181)/5 = 1.171
0.900 25
Average ratio for quarter 4: (.860 +.888 + .854 + .874 + .900)/ 5 = .875
Interpreting the Seasonal Indexes
• The seasonal indexes tell us what is the ratio
between the time series value at a certain season,
and the overall seasonal average.
• In our problem: 17.1% above the
117.1% annual average
7.6% above the 12.5% below the
annual average annual average
Annual average
occupancy (100%) 107.6%
87.8% 87.5%
12.2% below the
annual average
26
The Smoothed Time Series
• The trend component and the seasonality component are
recomposed using the multiplicative model.
0.7
0.6
28
Deseasonalized Time Series
In period #1 ( quarter 1): y 1 / SI1 .561 / .870 .639
In period #2 ( quarter 2):y 2 / SI2 .708 1.076 .652
In period #5 ( quarter 1): y 5 / SI1 .575 .870 .661
There was a gradual increase in occupancy rate
1
0.8
0.6
0.4
0.2
0
0 5 10 15 20 25
29
6 Forecasting Models
• The choice of a forecasting technique depends on the components
identified in the time series.
• The techniques discussed next are:
• Exponential smoothing
• Seasonal indexes
• Autoregressive models (a brief discussion)
30
Forecasting with Exponential
Smoothing
• The exponential smoothing model can be used to
produce forecasts when the time series…
• exhibits gradual(not a sharp) trend
• no cyclical effects
• no seasonal effects
31
Forecasting with Seasonal Indexes
Ft [b 0 b1t ] SIt
Linear trend value for period t, Seasonal index
obtained from the linear regression for period t.
32
Forecasting with Seasonal Indexes;
Example
• Example 5
• Use the seasonal indexes calculated in Example 3
along with the trend line, to forecast each quarter
occupancy rate in 2020.
• The solution procedure
– Use simple linear regression to find the trend line.
– Use the trend line to calculate the seasonal indexes.
– To calculate Ft multiply the trend value for period t by the
seasonal index of period t.
33
Forecasting with indicator variables
34
Autoregressive models
• Autocorrelation among the errors of the regression
model provides opportunity to produce accurate
forecasts.
• In a stationary time series (no trend and no
seasonality) correlation between consecutive
residuals leads to the following autoregressive model:
yt = b0 + b1yt-1 + et
35
Autoregressive model;
y t b 0 b1y t 1
Y (t) Y (t-1)
13.5 The increase in the y
10.4 13.5 for periods 1, 2, 3,…
6.1 10.4 are predictors of the
3.2 6.1 increase in the y for
4.3 3.2
. 4.3
periods 2, 3, 4,…,
. . respectively.
36