You are on page 1of 10

Data Patterns and Forecasting Techniques

Data Types
• Cross-Sectional Data
– collected at a single point in time
• The objective is to examine such data and then to extrapolate or extend the
revealed relationships to the larger population.
• They are denoted as yi or xi , i = 1, …, n where n is the sample size.
• Time Series Data
– a sequence of data collected over equal periods of time – usually weekly,
monthly, quarterly, or yearly
• The objective is to discover past patterns of change and then project such
patterns to arrive at a forecast for the future.
• They are denoted by yt , t = 1, …, n where the subscript t is used instead of
i to emphasize the time order of the observations.

Time Series Components


– The classical decomposition assumes that time series data can be decomposed into
four components.
Orginal Time Series

3 50 0

3 2 50

3000

2 750

2 50 0

2 2 50

2000

1750
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47

• The seasonal variation is the pattern in a time series within a year. The unit of
time may be either quarterly, monthly, weekly, or even daily. These patterns
tend to repeat themselves from year to year. Many sales and production
fluctuate with the seasons.
Seasonal Component Deseasonalized Time Series

1.0 50 3 50 0 .0 0

1.0 2 5

3 0 0 0 .0 0

1.0 0 0

2 50 0 .0 0

0 .9 75

0 .9 50 2 0 0 0 .0 0
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47

1 / 10 ISOM3031
• The trend represents the long run behavior of the data and therefore is the
smooth long-term direction of the time series. It may move steadily upward,
decline, or stay the same over a period of time. The basic economic forces that
produce long-term trend movements in time series are population changes,
inflation, business competition, and technological changes.
Trend Component Detrended Time Series

3 50 0 1.1

3000 1.0

2 50 0 0 .9

2000 0 .8
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47 1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47

Sesaonal & Trend Components

3 50 0

3000

2 50 0

2000
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47

• The cyclical variation is a movement in a time series that recurs over periods
longer than a year. This variation has no particular patterns of the sort we see in
seasonal variations. For practical purposes it is usually ignored. The causes of
cyclical variations may be general economic conditions, government policy
changes, or shifts in consumer tastes and purchasing habits.
Cyclical Component

1.0 8

1.0 6

1.0 4

1.0 2

1.0 0

0 .9 8

0 .9 6

0 .9 4

0 .9 2

0 .9 0
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47

• The irregular variation is the movement left in a time series when trend,
seasonal variation, and cyclical variation have been identified. It cannot be
predicted by using historical data. Irregular variations are caused by such
factors as changes in the weather, wars, strikes, government legislation, and
elections.

2 / 10 ISOM3031
Irregular Component

1.10

1.0 5

1.0 0

0 .9 5

0 .9 0
1 3 5 7 9 11 13 15 17 19 21 2 25 27 2 31 3 35 37 3 41 4 45 47

– Stationary series is a time series without trend, cyclical, and seasonal components.
The data must be roughly horizontal along the time axis. Strictly speaking, the data
fluctuate around a constant mean, independent of time, and the variance of the
fluctuation remains essentially constant over time. Loosely speaking, a time series
may be stationary in respect to one characteristic (e.g. the mean) but not stationary
in respect to another (e.g. the variance).

Autocorrelation Analysis
– Autocorrelation is the correlation of the variable with itself when lagged one or
more periods apart.
– Autocorrelation coefficients for different time lags are used to identify time series
data patterns. The autocorrelation coefficient for the lag of k periods is:
n

(y t − y ) ( yt −k − y ) n

y
t = k +1 1
rk = n
where y = t
n

t =1
( yt − y ) 2 t =1

– Autocorrelation coefficients can be used to answer the following questions about a


time series:
• Are the data random?
• Do the data have a trend (nonstationary in mean)?
• Are the data stationary?
• Are the data seasonal?
– The correlogram or autocorrelation function (ACF) is a graphical tool for
displaying the autocorrelations for various lags of a time series. A plot of the ACF is
a standard tool in exploring a time series before forecasting. It provides a useful
check for time series patterns.

3 / 10 ISOM3031
• If a time series is random,
– the successive values of a time series are not related to each other.
– the autocorrelation between yt and yt–k , k = 1, 2, … are all close to zero.
• If there is a trend,
– the successive time series values (yt and yt–1) are highly (significantly)
correlated.
– the rk’s are large (significantly different from zero) for the first several
time lags and then gradually drop toward zero as the number of periods
increases.
• If, on the other hand, a time series is stationary,
– The rk’s for a stationary series (that varies about a fixed level, i.e. no
growth or decline, over time) decline to zero fairly rapidly (as k increases).
• If a seasonal pattern exists,
– a large (significant) rk will occur at the appropriate time lag.
– the seasonal lag of four for quarterly data and 12 for monthly data.

White Noise Model


– A white noise model Yt = c + et is a simple random model where observation Yt is
made up of two parts, an overall level, c, and a random error component, et , which
is uncorrelated from period to period.
– The white noise model is fundamental to many techniques in time series analysis.
Any good forecasting model should have forecast errors which follow a white noise
model.
Time Series Plot for White Noise Correlogram for White Noise

12 0 0
0.2

0.1

800

0.0
1 2 3 4 5 6 7 8 9 10

-0.1
400

-0.2

0
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 -0.3

4 / 10 ISOM3031
Autocorrelation Function for Monthly Sales
(with 5% significance limits for the autocorrelations)

1.0

0.8

0.6

0.4
Autocorrelation

0.2

0.0

-0.2

-0.4

-0.6

-0.8

-1.0

1 2 3 4 5 6 7 8 9
Lag

5 / 10 ISOM3031
Autocorrelation Function for Sales
(with 5% significance limits for the autocorrelations)

1.0

0.8

0.6

0.4
Autocorrelation

0.2

0.0

-0.2

-0.4

-0.6

-0.8

-1.0

2 4 6 8 10 12 14 16 18 20 22 24
Lag

6 / 10 ISOM3031
The Sampling Distribution of Autocorrelations
– Theoretically, all autocorrelation coefficients for a series of random numbers must
be zero. If the time series consists of random numbers (i.e. ρk = 0, k = 1,… where ρk
is the k-lag population autocorrelation) and the sample size n is sufficiently large, rk

~ N (0, 1 )
n
– Statistical inference for autocorrelation coefficients:
H0: ρk = 0 versus Ha: ρk  0

Decision rule: Reject H0 if rk lies outside the interval from – Z  1 to + Z  1 at


2 2
n n
the significant level α.
k −1
1 + 2  ri
2

(Other formula: s(rk ) = i =1


where s(rk ) = standard error of k-lag autocorrelation
n
ri = i-lag autocorrelation
k = the time lag
n = number of observations in the time series)
– Rather than study the rk’s one at a time, an alternative approach is to consider a
whole set of rk’s and develop a test to see whether the set is significantly different
from a zero set. Tests of this sort are known as portmanteau tests.
• Box and Pierce (1970) test:
m
(Box-Pierce) Q = n  rk 2
k =1

• Ljung and Box (1978) test:


m rk 2
(Ljung-Box) Q = n (n + 2)  where m = number of time lags to be tested
k =1 n − k

Q ~ χ2 (chi-square distribution) with (m minus number of parameters estimated


in the forecast model) degrees of freedom

7 / 10 ISOM3031
Removing Trend (Non-Stationarity) in a Time Series
– Trends, or other non-stationary patterns in a time series, result in positive
autocorrelations that dominate the correlogarm. Therefore, it is important to remove
the non-stationarity, so other correlation structure can be seen before proceeding
with time series model building. One way of removing non-stationarity is through
the method of differencing.
– The differenced series is defined as the change between each observation in the
original series:
Yt′ = Yt – Yt–1
The differenced series will have only n – 1 values since it is not possible to
calculate a difference Y1′ for the first observation.
– Taking first differences is a very useful tool for removing non-stationarity. However,
occasionally the differenced data will not appear stationary and it may be necessary
to difference the data a second time:
Yt′′ = Yt′ – Yt′–1 = (Yt – Yt–1) – (Yt–1 – Yt–2) = Yt – 2Yt–1 + Yt–2
Yt′′ is referred to as the series of second-order differences. This series will have
n – 2 values. In practice, it is almost never necessary to go beyond second-order
differences, because real data generally involve non-stationarity of only the first or
second level.

8 / 10 ISOM3031
Measuring Forecasting Error
• Mean Absolute Deviation
1 n
MAD =  yt − yˆ t
n t =1
– This measure is most useful when the analyst wants to measure forecast error
in the same units as the original series.
• Mean Square Error

( yt − yˆ t )
1 n
MSE =
2

n t =1
– This approach penalizes large forecasting errors.
• Mean Absolute Percentage Error

1 n yt − yˆ t
MAPE =  × 100%
n t =1 yt

– This measure is useful when the size or magnitude of the forecast variable is
important in evaluating the accuracy of the forecast.
• Mean Percentage Error
1 n ( yt − yˆ t )
MPE =  × 100%
n t =1 yt
– The bias of a forecasting method is important and is defined as the amount that
the forecasts are consistently higher or lower than the actual values.
• Theil’s U-Statistic

( yt − yˆ t )
1 n 2

(1958) U = n t =1
1 n 2 1 n 2
 yt +  yˆ t
n t =1 n t =1
– This statistic is bounded between 0 and 1, with values closer to 0 indicating
greater forecasting accuracy.
n −1
 (forecast relative change t +1 − actual relative change t +1 )
2

(1966) U = t =1
n −1
 (actual relative change t +1 )
2

t =1

9 / 10 ISOM3031
2
n −1  yˆ − yt yt +1 − yt 
  t +1 − 
=
t =1
 yt yt 
2
n − 1
yt +1 − yt 
 
t =1 
 yt 
2
n −1  yˆ − yt +1 
  t +1 
=
t =1
 yt 
2
n − 1
yt +1 − yt 
 
t =1 
 yt 
– This statistic allows a relative comparison of formal forecasting methods with
naïve method and also squares the errors involved so that large errors are given
much more weight than small errors.
– U=1 the naïve method is as good as the forecasting technique being
evaluated.
U<1 the forecasting technique being used is better than the naïve method.
The smaller the value, the greater forecasting accuracy is relative to
the naïve method.
U>1 there is no point in using a formal forecasting method, since using a
naïve method will produce better results.

10 / 10 ISOM3031

You might also like