Professional Documents
Culture Documents
Time Series Analysis and Forecasting
Time Series Analysis and Forecasting
Forecasting
Introduction to Time Series Analysis
• A time-series is a set of observations on a quantitative variable
collected over time.
• Examples
– Dow Jones Industrial Averages
– Historical data on sales, inventory, customer counts, interest
rates, costs, etc
• Businesses are often very interested in forecasting time series
variables.
• Often, independent variables are not available to build a
regression model of a time series variable.
• In time series analysis, we analyze the past behavior of a
variable in order to predict its future behavior.
Methods used in Forecasting
• Regression Analysis
• Time Series Analysis (TSA)
– A statistical technique that uses time-
series data for explaining the past or
forecasting future events.
– The prediction is a function of time
(days, months, years, etc.)
– No causal variable; examine past behavior
of a variable and and attempt to predict
future behavior
Components of TSA
• Time Frame (How far can we predict?)
– short-term (1 - 2 periods)
– medium-term (5 - 10 periods)
– long-term (12+ periods)
– No line of demarcation
• Trend
– Gradual, long-term movement (up or down) of
demand.
– Easiest to detect
Components of TSA (Cont.)
• Cycle
– An up-and-down repetitive movement in demand.
– repeats itself over a long period of time
• Seasonal Variation
– An up-and-down repetitive movement within a trend
occurring periodically.
– Often weather related but could be daily or weekly
occurrence
• Random Variations
– Erratic movements that are not predictable because they
do not follow a pattern
Time Series Plot Actual Sales
$3,000
$2,500
$2,000
Sales (in $1,000s)
$1,500
$1,000
$500
$0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Time Period
Components of TSA (Cont.)
• Difficult to forecast demand because...
– There are no causal variables
– The components (trend, seasonality,
cycles, and random variation) cannot
always be easily or accurately
identified
Some Time Series Terms
• Stationary Data - a time series variable exhibiting
no significant upward or downward trend over
time.
• Nonstationary Data - a time series variable
exhibiting a significant upward or downward
trend over time.
• Seasonal Data - a time series variable exhibiting
a repeating patterns at regular intervals over
time.
Approaching Time Series Analysis
• There are many, many different time series
techniques.
• It is usually impossible to know which technique
will be best for a particular data set.
• It is customary to try out several different
techniques and select the one that seems to
work best.
• To be an effective time series modeler, you need
to keep several time series techniques in your
“tool box.”
Measuring Accuracy
• We need a way to compare different time series techniques for a given data set.
• Four common techniques are the:
100 n Yi Ŷi
MAPE =
n i 1 Yi
MSE =
n
Yi Y i
2
i 1 n
RMSE MSE
• We will focus on MSE.
Extrapolation Models
• Extrapolation models try to account for the past behavior
of a time series variable in an effort to predict the future
behavior of the variable.
f Y , Y , Y ,
Yt 1 t t 1 t 2
Yt Yt-1 Yt- k +1
Yt 1
k
Y24 Y23 36 + 35
Y25 355
.
2 2
Y
Y 35.5 + 36
Y26 25 24
35.75
2 2
Weighted Moving Average
• The moving average technique assigns equal weight
to all previous observations
1 1 1
Yt 1 Yt Yt-1 Yt- k -1
k k k
The weighted moving average technique allows for
different weights to be assigned to previous
observations.
w Y w Y w Y
Yt 1 1 t 2 t-1 k t- k -1
where 0 wi 1 and w
i 1
We must determine values for k and the wi
Implementing the Model
Using optimal values for the
weights that minimizes the MSE
Forecasting With The Weighted
Moving Average Model
Forecasts for time periods 25 and 26 at time period 24:
w Y w Y 0.291 36 0.709 35 35.3
Y25 1 24 2 23
Y
Y (Y Y
)
t 1 t t t
where 0 1
40
38
Units Sold
36
34
32
Number of VCRs Sold
30 Exp. Smoothing alpha=0.1
Exp. Smoothing alpha=0.9
28
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Time Period
Implementing the Model
Forecasting With The
Exponential Smoothing Model
Forecasts for time periods 25 and 26 at time period 24:
Y
Y (Y Y
) 35.74 0.268( 36 35.74) 35.81
25 24 24 24
Y
Y (Y Y
)Y
(Y
Y )Y
3581
.
26 25 25 25 25 25 25 25
Note that,
35.81, for t = 25, 26, 27,
Yt
Seasonality
• Seasonality is a regular, repeating
pattern in time series data.
• May be additive or multiplicative in
nature...
Stationary Seasonal Effects
Additive Seasonal Effects
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Tim e Pe r iod
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
Tim e Pe r iod
Stationary Data With
Additive Seasonal Effects
Ŷt n E t St n p
where
E t (Yt - St-p ) (1- )Et 1
St (Yt - E t ) (1- )St p
0 1
0 1
p represents the number of seasonal periods
Ŷ24 n E 24 S24 n 4
Ŷ24 n E 24 S24 n 4
E t Yt St p (1- )(Et 1 Tt 1 )
Tt E t E t 1 (1 - )Tt 1
St Yt E t (1- )St p
0 1
0 1
0 1
Implementing the Model
The Linear Trend Model
b b X
Yt 0 1 1t
where X1t t
For example:
X11 1, X12 2, X13 3,
Implementing the Model
Forecasting With The Linear Trend Model
Forecasts for time periods 21 through 24 at time period 20:
b b X 3751
Y . 92.6255 21 2320.3
21 0 1 121
b b X 3751
Y . 92.6255 22 2412.9
22 0 1 122
b b X 3751
Y . 92.6255 23 2505.6
23 0 1 123
b b X 3751
Y . 92.6255 24 2598.2
24 0 1 124
The TREND() Function
TREND(Y-range, X-range, X-value for prediction)
where:
Y-range is the spreadsheet range containing the dependent Y
variable,
X-range is the spreadsheet range containing the independent X
variable(s),
X-value for prediction is a cell (or cells) containing the values for
the independent X variable(s) for which we want an estimated value
of Y.
Note: The TREND( ) function is dynamically updated whenever any inputs to
the function change. However, it does not provide the statistical information
provided by the regression tool. It is best two use these two different
approaches to doing regression in conjunction with one another.
The Quadratic Trend Model
b b X b X
Yt 0 1 1t 2 2t
Yi
i Y
i
Sp , for all i occuring in season p
np
The final forecast for period i is then
adjusted = Y
Y S , for any i occuring in season p
i i p
Implementing the Model
The Plot
Forecasting With Seasonal Adjustments
Applied To Our Quadratic Trend Model
Forecasts for time periods 21 through 24 at time period 20:
Ŷ21 (b0 b1X121 b2 X 2 2 1 ) S1 2598.9 105.7% 2747.8
Ŷ22 (b0 b1X12 2 b2 X 2 2 2 ) S 2 2771.1 80.1% 2219.6
Ŷ23 (b0 b1X12 3 b2 X 2 2 3 ) S3 2950.5 103.1% 3041.4