Time Series
“The Art of Forecasting”
1
Learning Objectives
• Describe what forecasting is
• Explain time series & its components
• Stationary and non stationary time series
• Vector autoregressions and optimal lag selection
2
What Is Forecasting?
• Process of predicting a future event
• Underlying basis of
all business decisions
– Production
– Inventory
– Personnel
– Facilities
3
Forecasting Approaches
Qualitative Methods Quantitative Methods
• Used when situation is
vague & little data exist
– New products
– New technology
• Involve intuition,
experience
• e.g., forecasting sales
on Internet
Forecasting
Forecasting Approaches
Approaches
Qualitative Methods Quantitative Methods
• Used when situation is • Used when situation is
vague & little data exist ‘stable’ & historical data
– New products exist
– New technology – Existing products
• Involve intuition, – Current technology
experience • Involve mathematical
• e.g., forecasting sales techniques
on Internet • e.g., forecasting sales
of televisions
What is a Time Series?
• Set of evenly spaced numerical data
– Obtained by observing response variable at regular time
periods
• Forecast based only on past values
– Assumes that factors influencing past, present, & future will
continue
• Example
– Year: 19951996199719981999
– Sales: 78.763.589.793.2 92.1
6
Time Series Data
• When working with time series data, it is vital that the data
is plotted so the researcher can view the data.
7
Time Series Components
Time Series Components
Trend
Time Series Components
Trend Cyclical
Time Series Components
Trend Cyclical
Seasonal
Time Series Components
Trend Cyclical
Seasonal Irregular
Trend Component
• Persistent, overall upward or downward
pattern
• Due to population, technology etc.
• Several years duration
Response
Mo., Qtr., Yr.
Trend Component
• Overall Upward or Downward Movement
• Data Taken Over a Period of Years
d t rend
Sales Upwar
Time
Cyclical Component
• Repeating up & down movements
• Due to interactions of factors influencing
economy
• Usually 2-10 years duration
Cycle
Response
Mo., Qtr., Yr.
Cyclical Component
• Upward or Downward Swings
• May Vary in Length
• Usually Lasts 2 - 10 Years
Sales Cycle
Time
Seasonal Component
• Regular pattern of up & down fluctuations
• Due to weather, customs etc.
• Occurs within one year
Summer
Response
Mo., Qtr.
Seasonal Component
• Upward or Downward Swings
• Regular Patterns
• Observed Within One Year
Sales Winter
Time (Monthly or Quarterly)
Irregular Component
• Unpredictable, unsystematic, ‘residual’
fluctuations
• Due to random variation or unforeseen events
– Union strike
– War
• Short duration &
nonrepeating
19
Random or Irregular Component
• Irregular, Nonsystematic, Random, ‘Residual’
Fluctuations
• Due to Random Variations of
– Nature
– Accidents
• Short Duration and Non-repeating
20
Introduction To Stationary And
Non-Stationary Processes
• Researchers often use financial time series data (such as
asset prices, exchange rates, GDP, inflation and other
macroeconomic indicators).
• But refining data is key to being able to apply it to your
analysis.
• Following discussion will show you how to isolate the data
points that are relevant to your research.
21
Cooking Raw Data
• Data points are often non-stationary or have means,
variances and covariances that change over time.
• Non-stationary behaviors can be trends, cycles, random
walks or combinations of the three.
• Non-stationary data, as a rule, are unpredictable and
cannot be modeled or forecasted.
22
Cooking Raw Data
• The results obtained by using non-stationary time series
may be spurious in that they may indicate a relationship
between two variables where one does not exist.
• In order to receive consistent, reliable results, the non-
stationary data needs to be transformed into stationary
data.
23
Cooking Raw Data
• In contrast to the non-stationary process that has a variable
variance and a mean that does not remain near, or returns
to a long-run mean over time, the stationary process reverts
around a constant long-term mean and has a constant
variance independent of time.
24
Non-Stationary Behavior
25
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
• To use a variable into a time series model we must have to
convert it into stationary variable.
• First of all view graph of variable.
• To detect stationary or non stationary time series we’ll use
Correlogram (Q statistics).
26
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
27
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
28
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
29
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
30
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
31
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
32
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
33
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
• Correlogram or Q statistics
H0: Variable is stationary (Stationary)
HA: Variable is not stationary (Non Stationary)
34
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
35
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
H0: Variable is stationary (Stationary)
HA: Variable is not stationary (Non Stationary)
• As p value is less than 5% for all lags so we can reject the
Null Hypothesis.
• So variable is not stationary we must convert it into
stationary in order to use it in time series model.
• Method: First difference method
36
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
37
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
38
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
39
Eviews: How to convert a
variable into stationary?
• File Name: how to convert variable into stationary
H0: Variable is stationary (Stationary)
HA: Variable is not stationary (Non Stationary)
• As p value is more than 5% for all lags so we cannot reject
the Null Hypothesis.
• So variable is stationary. We can use it in our time series
models.
40
Types of Non-Stationary
Processes
• Now we should distinguish between the different types of
the non-stationary processes.
• Examples of non-stationary processes are random walk
with or without a drift (a slow steady change) and
deterministic trends (trends that are constant, positive or
negative.
41
Types of Non-Stationary
Processes
Random Walk with Drift or Intercept only (Yt = α + Yt-1 + εt )
Deterministic Trend or Trend and Intercept (Yt = α + βt + εt )
Pure Random Walk or No Trend, No Intercept (Yt = Yt-1 + εt )
42
Random Walk with Drift
(Yt = α + Yt-1 + εt ) Intercept only
• If the random walk model predicts that the value at time
"t" will equal the last period's value plus a constant, or drift
(α), and a white noise term (εt), then the process is
random walk with a drift.
• It also does not revert to a long-run mean and has
variance dependent on time.
43
Deterministic Trend
(Yt = α + βt + εt ) Trend and Intercept
• Often a random walk with a drift is confused for a
deterministic trend.
• Both include a drift and a white noise component, but the
value at time "t" in the case of a random walk is regressed
on the last period's value (Yt-1), while in the case of a
deterministic trend it is regressed on a time trend (βt).
44
Pure Random Walk
(Yt = Yt-1 + εt ) No Trend, No Intercept
• Random walk predicts that the value at time "t" will be
equal to the last period value plus a stochastic (non-
systematic) component that is a white noise, which means
εt is independent and identically distributed with mean "0"
and variance "σ²".
• It is a non mean reverting process that can move away
from the mean either in a positive or negative direction.
45
Pure Random Walk
(Yt = Yt-1 + εt ) No Trend, No Intercept
• Another characteristic of a random walk is that the
variance evolves over time and goes to infinity as time
goes to infinity; therefore, a random walk cannot be
predicted.
46
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Types of non stationary behavior:
• Intercept only (Yt = α + Yt-1 + εt )
• Trend and Intercept (Yt = α + βt + εt )
• No Trend, No Intercept (Yt = Yt-1 + εt )
• Eviews Test: Unit Root Test (Augmented Dickey-Fuller
test)
47
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
48
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
49
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
50
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Unit Root Test (Augmented Dickey-Fuller test)
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
51
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Intercept only (Yt = α + Yt-1 + εt )
52
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
53
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 6.89% so we cannot reject the null
hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
54
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
55
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Trend and Intercept (Yt = α + βt + εt )
56
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
57
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 10.38% so we cannot reject the null
hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
58
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
59
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• No Trend, No Intercept (Yt = Yt-1 + εt )
60
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
61
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 11.15% so we cannot reject the null
hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
62
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• How to remove Unit root or non stationary behavior of
variable?
• Method: First Difference Method
63
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
64
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Intercept only (Yt = α + Yt-1 + εt )
65
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
66
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 0.22% so we can reject the null hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
67
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
68
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• Trend and Intercept (Yt = α + βt + εt )
69
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
70
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 0.70% so we can reject the null hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
71
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
72
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• No Trend, No Intercept (Yt = Yt-1 + εt )
73
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
74
How to detect and remove non
stationary behavior (Unit Root test)
• File Name: Unit root test to detect non stationarity
• In order to conduct Augmented Dicky Fuller test the
coefficient of lagged value Y(-1) or Y lag must be
negative.
• As p-value is 0.02% so we can reject the null hypothesis.
H0: Variable is not stationary (got a unit root)
HA: Variable is stationary
• We can use D(Y) instead of Y in our model because Y
has a unit root problem (Not Stationary).
75
OPTIMAL LAG SELECTION
IN VECTOR
AUTOREGRESSION (VAR)
76
Optimal Lag Selection in VAR
• If variables are not co-integrated---unrestricted VAR
• If variables are co-integrated---restricted VAR (vectror
error correction mechanism)
• How many lags we should include?
• There are many ways to choose optimal lag one of the
most commonly used is Akaike Information Criterion
(AIC).
• The lower the AIC value, better the model.
77
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• If we have two variables y and x, then VAR.
• Y = β11 Yt – 1 + β12 Xt – 1 + α13
• X = β21 Yt – 1 + β22 Xt – 1 + α23
78
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
79
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
80
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
81
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
82
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• So the AIC is 6.69
83
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
84
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• Y = β11 Yt – 1 + β12 Xt – 1 + α13
• X = β21 Yt – 1 + β22 Xt – 1 + α23
85
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
86
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
87
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• AIC = 6.43
88
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
89
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
90
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• AIC = 6.19
91
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
92
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
93
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• AIC = 6.38
94
Optimal Lag Selection in VAR
• File Name: Optimal Lag Selection
• AIC with one lag model = 6.69
• AIC with two lags model = 6.43
• AIC with three lags model = 6.19
• AIC with four lags model = 6.38
• So model with 3 lags is better as compare to other models.
95
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
96
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
97
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
98
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
99
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
100
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
101
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
102
Optimal Lag Selection in VAR
(Alternative Method)
• File Name: optimal lag selection (with two
independent variables)
• If we are using AIC then we should use 7 lags in our
vector autoregressive or vector error correction models.
As AIC is minimum at 7th lag.
103
Cointegration
104
Cointegration
• Cointegration Definition
• Cointegration is an econometric technique for testing the
correlation between non-stationary time series variables.
• If two or more series are themselves non-stationary, but a
linear combination of them is stationary, then the series
are said to be cointegrated.
• For instance, a stock index and the price of its associated
futures contract move through time, each roughly
following a random walk.
105
Cointegration
• Cointegration Definition
• Testing the hypothesis that there is a statistically
significant connection between the future price and the
spot price could now be done by finding a cointegrating
vector.
• If such a vector has a low order of integration it can signify
an equilibrium relationship between the original series,
which are said to be cointegrated of an order below one.
106
Cointegration
• Suppose you see two drunks (i.e., two random walks)
wandering around.
• The drunks don't know each other (they're independent),
so there's no meaningful relationship between their paths.
• But suppose instead you have a drunk walking with his
dog.
• This time there is a connection.
107
Cointegration
• For example, if the dog wanders too far away from his
owner, he'll tend to move in his direction to avoid losing
him, so the two stay close together despite a tendency to
wander around on their own.
• We describe this relationship by saying that the drunk
and his dog form a cointegrating pair.
• Another example: A book and its movie adaptation:
while the book and the movie may differ in small details,
the overall plot will remain the same.
108
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• We want to check whether their exist a long run
association-ship (cointegration) between variables.
109
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
110
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
111
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• All variables should be at levels.
112
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• I believe that there is a trend in variables. So we’ll choose 3.
113
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• We’ll get two statistics:
i. Trace Statistics
ii. Max-Eigen Statistics
114
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
115
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• Trace Statistics:
116
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• Max-Eigen Statistics
117
Johansen Cointegration Test
• File Name: Johansen Cointegration Test
• Conclusion:
• If variables are cointegrated then we cannot use VAR
(vector auto regression), we must use VECM (vector error
correction mechanism)
118