Econ 240 C - UCSB Department of Economics

Econ 240 C
Lecture 3
1
2
3
4
5
Time Series Concepts
• Analysis and Synthesis
6
Analysis
• Model a real time seies in terms of its
components
7
Total Returns to Standard and
Poors 500, Monthly, 1970-2003
5000
Total Returns for the Standard and Poors 500
4000
3000
2000
1000
0
70
75
80
85
90
95
00
SPRETURN
8
Source: FRED http://research.stlouisfed.org/fred/
Trace of ln S&P 500(t)
Logarithm of Total Returns to Standard & Poors 500
9
LNSP500
8
7
6
5
4
0
100
200
300
TIME
9
400
500
Model
• Ln S&P500(t) = a + b*t + e(t)
• time series = linear trend + error
10
Dependent Variable: LNSP500
Method: Least Squares
Sample(adjusted): 1970:01 2003:02
Included observations: 398 after adjusting endpoints
Variable Coefficient
C
TIME
Std. Error
4.049837
0.010867
t-Statistic
0.022383
9.76E-05
Prob.
180.9370
111.3580
0.0000
0.0000
R-squared
0.969054
Mean dependent var
6.207030
Adjusted R-squared
0.968976 S.D. dependent var
1.269965
S.E. of regression 0.223686 Akaike info criterion
-0.152131
Sum squared resid
19.81410 Schwarz criterion
-0.132098
Log likelihood
32.27404
F-statistic
12400.61
Durbin-Watson stat
0.041769
Prob(F-statistic)
0.000000
11
0.6
0.4
0.2
0.0
-0.2
-0.4
-0.6
70
75
80
85
90
ERROR
95
00
40
Series: Residuals
Sample 1970:01 2003:02
Observations 398
30
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
20
10
Jarque-Bera
Probability
0
-0.50
-0.25
0.00
0.25
0.50
2.59E-15
-0.036203
0.478857
-0.494261
0.223405
0.419110
2.377547
18.07682
0.000119
Time Series Components Model
• Time series = trend + cycle + seasonal +
error
• two components, trend and seasonal, are
time dependent and are called nonstationary
14
Synthesis
• The Box-Jenkins approach is to start with
the simplest building block to a time
series, white noise and build from there, or
synthesize.
• Non-stationary components such as trend
and seasonal are removed by differencing
15
First Difference
• Lnsp500(t) - lnsp500(t-1) = dlnsp500(t)
16
0.2
0.1
0.0
-0.1
-0.2
-0.3
70
75
80
85
90
DLNSP500
95
00
100
Series: DLNSP500
Sample 1970:02 2003:02
Observations 397
80
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
60
40
0.008625
0.011000
0.155371
-0.242533
0.045661
-0.614602
5.494033
20
Jarque-Bera
Probability
0
-0.2
-0.1
0.0
0.1
127.8860
0.000000
Log of Rotterdam Inport Price: Dark Northern Spring
6.0
5.6
5.2
4.8
4.4
4.0
75
80
85
90
LNDNSROTM
19
95
00
First Difference in Log of Rotterdam Import Price: Dark Northern Spring
0.3
0.2
0.1
0.0
-0.1
-0.2
-0.3
75
80
85
90
DLNDNSROTM
20
95
00
Histogram: First Difference of Log of Rotterdam Import Price, DNS
120
Series: DLNDNSROTM
Sample 1971:08 2001:12
Observations 365
100
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
80
60
40
20
Jarque-Bera
Probability
0
-0.2
-0.1
21
0.0
0.1
0.2
0.3
0.002290
0.000000
0.277165
-0.244453
0.052324
0.141729
7.454779
303.0323
0.000000
Time series
• A sequence of values indexed by time
22
Stationary time series
• A sequence of values indexed by time
where, for example, the first half of the
time series is indistinguishable from the
last half
23
Stochastic Stationary Time
Series
• A sequence of random values, indexed by
time, where the time series is not time
dependent
24
Summary of Concepts
•
•
•
•
Analysis and Synthesis
Stationary and Evolutionary
Deterministic and Stochastic
Time Series Components Model
25
White Noise Synthesis
• Eviews: New Workfile
– undated 1 1000
• Genr wn = nrnd
• 1000 observations N(0,1)
• Index them by time in the order they were
drawn from the random number generator
26
4
2
0
-2
-4
200
400
600
WN
800
1000
3
2
1
0
-1
-2
-3
-4
10
20
30
40
50
60
WN
70
80
90
100
120
Series: WN
Sample 1 1000
Observations 1000
100
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
80
60
40
20
Jarque-Bera
Probability
0
-3
-2
-1
0
1
2
3
0.002336
0.017618
2.967726
-3.713726
0.992117
-0.099788
2.973119
1.689727
0.429616
Synthesis
•
•
•
•
•
Random Walk
RW(t) -RW(t-1) = WN(t) = dRW(t)
or RW(t) = RW (t-1) + WN(t)
lag by one: RW(t-1) = RW(t-2) + WN(t-1)
substitute: RW(t) = RW(t-2) + WN(t) +
WN(t-1)
• continue with lagging and substituting
RW(t) = WN(t) + WN (t-1) + WN (t-2) + ...
30
Part I
• Modeling Economic Time Series
31
Total Returns to Standard and
Poors 500, Monthly, 1970-2003
5000
Total Returns for the Standard and Poors 500
4000
3000
2000
1000
0
70
75
80
85
90
95
00
SPRETURN
32
Source: FRED http://research.stlouisfed.org/fred/
Analysis (Decomposition)
• Lesson one: plot the time series
33
Model One: Random Walks
• we can characterize the logarithm of total
returns to the Standard and Poors 500 as
trend plus a random walk.
• Ln S&P 500(t) = trend + random walk
= a + b*t + RW(t)
34
Trace of ln S&P 500(t)
Logarithm of Total Returns to Standard & Poors 500
9
LNSP500
8
7
6
5
4
0
100
200
300
TIME
35
400
500
Analysis(Decomposition)
• Lesson one: Plot the time series
• Lesson two: Use logarithmic
transformation to linearize
36
Ln S&P 500(t) = trend + RW(t)
• Trend is an evolutionary process, i.e.
depends on time explicitly, a + b*t, rather
than being a stationary process, i. e.
independent of time
• A random walk is also an evolutionary
process, as we will see, and hence is not
stationary
37
Model One: Random Walks
• This model of the Standard and Poors 500
is an approximation. As we will see, a
random walk could wander off, upward or
downward, without limit.
• Certainly we do not expect the Standard
and Poors to move to zero or into negative
territory. So its lower bound is zero, and its
model is an approximation.
38
Model One: Random Walks
• The random walk model as an
approximation to economic time series
– Stock Indices
– Commodity Prices
– Exchange Rates
39
Model Two: White Noise
• we saw that the
difference in a
random walk was
white noise.
RW (t )  WN (t )
40
Model Two: White Noise
• How good an approximation is the white
noise model?
• Take first difference of ln S&P 500(t) and
plot it and look at its histogram.
41
Trace of ln S&P 500(t) – ln S&P(t-1)
0.2
Trace of lnsp500 - lnsp500(-1)
0.1
0.0
-0.1
-0.2
-0.3
70
75
80
85
90
DLNSP500
42
95
00
Histogram of
ln S&P 500(t) – ln S&P(t-1)
100
Series: DLNSP500
Sample 1970:02 2003:02
Observations 397
80
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
60
40
0.008625
0.011000
0.155371
-0.242533
0.045661
-0.614602
5.494033
20
Jarque-Bera
Probability
0
-0.2
43
-0.1
0.0
0.1
127.8860
0.000000
The First Difference of ln S&P
500(t)
  ln S&P 500(t)=ln S&P 500(t) - ln S&P 500(t-1)
  ln S&P 500(t) = a + b*t + RW(t) {a + b*(t-1) + RW(t-1)}
  ln S&P 500(t) = b +  RW(t) = b + WN(t)
• Note that differencing ln S&P 500(t) where both
components, trend and the random walk were
evolutionary, results in two components, a
constant and white noise, that are stationary.
44
Analysis(Decomposition)
• Lesson one: Plot the time series
• Lesson two: Use logarithmic
transformation to linearize
• Lesson three: Use difference
transformation to reduce an evolutionary
process to a stationary process
45
Model Two: White Noise
• Kurtosis or fat tails tend to characterize
financial time series
46
The Lag Operator, Z
•
•
•
•
Z x(t) = x(t-1)
Zn x(t) = x(t-n)
RW(t) – RW(t-1) = (1 – Z) RW(t) =  RW(t) = WN(t)
So the difference operator, , can be written in terms
of the lag operator,  = (1 – Z)
47
Model Three:
Autoregressive Time Series of
Order One
• An analogy to our model of trend plus
shock for the logarithm of the Standard
Poors is inertia plus shock for an
economic time series such as the ratio of
inventory to sales for total business
• Source: FRED
http://research.stlouisfed.org/fred/
48
Trace of Inventory to Sales,
Total Business
1.60
Ratio of Inventory to Sales, Monthly, 1992:01-2003:01
1.55
1.50
1.45
1.40
1.35
1.30
92
93
94
95
96
97
98
99
RATIOINVSALE
49
00
01
02
03
Analogy
• Trend plus random walk:
• Ln S&P 500(t) = a + b*t + RW(t)
• where RW(t) = RW(t-1) + WN(t)
• inertia plus shock
• Ratioinvsale(t) = b*Ratioinvsale(t-1) + WN(t)
50
Model Three: Autoregressive of
First Order
• Note: RW(t) = 1*RW(t-1) + WN(t)
• where the coefficient b = 1
• Contrast ARONE(t) = b*ARONE(t-1) + WN(t)
• What would happen if b were greater than one?
51
Using Simulation to Explore
Time Series Behavior
• Simulating White Noise:
• EVIEWS: new workfile, irregular, 1000
observations, GENR WN = NRND
52
Trace of Simulated White Noise:
100 Observations
3
Simulated White Noise
2
1
0
-1
-2
-3
10
20
30
40
50
60
WN
53
70
80
90
100
Histogram of Simulated White
Noise
120
Series: WN
Sample 1 1000
Observations 1000
100
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
80
60
40
20
Jarque-Bera
Probability
0
-3
-2
54
-1
0
1
2
3
4
0.008260
-0.003042
3.782479
-3.267831
1.005635
-0.047213
3.020531
0.389072
0.823216
Simulated ARONE Process
•
•
•
•
SMPL 1 1, GENR ARONE = WN
SMPL 2 1000
GENR ARONE =1.1* ARONE(-1) + WN
Smpl 1 1000
55
Simulated Unstable First Order
Autoregressive Process
First 100 Observations of ARONE = 1.1*Arone(-1) + WN
0
-5000
-10000
-15000
-20000
10
20
30
40
50
60
ARONE
56
70
80
90
100
First 10 Observations of ARONE
57
obs
WN
ARONE
1
2
3
4
5
6
7
8
9
10
-1.204627
-1.728779
1.478125
-0.325830
-0.593882
0.787438
0.157040
-0.211357
-0.722152
0.775963
-1.204627
-3.053869
-1.881131
-2.395073
-3.228463
-2.763872
-2.883219
-3.382898
-4.443340
-4.111711
Model Three: Autoregressive
•
•
•
•
•
•
What if b= -1.1?
ARONE*(t) = -1.1*ARONE*(t-1) + WN(t)
SMPL 1 1, GENR ARONE* = WN
SMPL 2 1000
GENR ARONE* = -1.1*ARONE*(-1) + WN
SMPL 1 1000
58
Simulated Autoregressive, b=-1.1
Simulated First Order Autoreg ressive Process, b = -1.1
400
200
0
-200
-400
5
10 15 20 25 30 35 40 45 50 55 60
ARONESTAR
59
Model Three: Conclusion
• For Stability ( stationarity) -1<b<1
60
Part II
• Forecasting: A preview of coming
attractions
61
Ratio of Inventory to Sales
• EVIEWS Model: Ratioinvsale(t) = c + AR(1)
• Ratioinvsale is a constant plus an
autoregressive process of the first order
• AR(t) = b*AR(t-1) + WN(t)
• Note: Ratioinvsale(t) - c = AR(t), so
• Ratioinvsale(t) - c = b*{ Ratioinvsale(t-1) - c}
+ WN (t)
62
Ratio of Inventory to Sales
• Use EVIEWS to estimate coefficients c
and b.
• Forecast of Ratioinvsale at time t is based
on knowledge at time t-1 and earlier
(information base)
• Forecast at time t-1 of Ratioinvsale at time
t is our expected value of Ratioinvsale at
time t
63
One Period Ahead Forecast
•
•
•
•
Et-1[Ratioinvsale(t)] is:
Et-1[Ratioinvsale(t) - c] =
Et-1[Ratioinvsale(t)] - c =
Forecast - c = b*Et-1[Ratioinvsale(t-1) - c]
+ Et-1[WN(t)]
• Forecast = c + b*Ratioinvsale(t-1) -b*c + 0
64
Dependent Variable: RATIOINVSALE
Method: Least Squares
Date: 04/08/03 Time: 13:56
Sample(adjusted): 1992:02 2003:01
Included observations: 132 after adjusting endpoints
Convergence achieved after 3 iterations
Variable Coefficient
Std. Error
t-Statistic
Prob.
C
AR(1)
0.030431
0.024017
46.57405
39.74276
0.0000
0.0000
1.417293
0.954517
R-squared
0.923954 Mean dependent var
1.449091
Adjusted R-squared
0.923369 S.D. dependent var
0.046879
S.E. of regression
0.012977 Akaike info criterion
-5.836210
Sum squared resid
0.021893 Schwarz criterion
-5.792531
Log likelihood
387.1898 F-statistic
1579.487
2.674982 Prob(F-statistic)
0.000000
65
Durbin-Watson stat
How Good is This Estimated
Model?
1.60
1.55
1.50
0.06
1.45
0.04
1.40
0.02
1.35
0.00
1.30
-0.02
-0.04
-0.06
93
94
95
96
Residual
66
97
98
99
Actual
00
01
02
Fitted
03
Plot of the Estimated Residuals
25
Series: Residuals
Sample 1992:02 2003:01
Observations 132
20
Mean
Median
Maximum
Minimum
Std. Dev.
Skewness
Kurtosis
15
10
-2.74E-13
0.000351
0.042397
-0.048512
0.012928
0.009594
4.435641
5
Jarque-Bera
Probability
0
-0.050
-0.025
67
0.000
0.025
11.33788
0.003452
Forecast for Ratio of Inventory
to Sales for February 2003
• E2003:01 [Ratioinvsale(2003:02)= c - b*c +
b*Ratioinvsale(2003:02)
• Forecast = 1.417 - 0.954*1.417 + 0.954*1.360
• Forecast = 0.06514 + 1.29744
• Forecast = 1.36528
68
How Well Do We Know This
Value of the Forecast?
• Standard error of the regression = 0.0130
• Approximate 95% confidence interval for the one
period ahead forecast = forecast +/- 2*SER
• Ratioinvsale(2003:02) = 1.36528 +/- 2*.0130
• interval for the forecast 1.34<forecast<1.39
69
Trace of Inventory to Sales,
Total Business
1.60
Ratio of Inventory to Sales, Monthly, 1992:01-2003:01
1.55
1.50
1.45
1.40
1.35
1.30
92
93
94
95
96
97
98
99
RATIOINVSALE
70
00
01
02
03
Lessons About ARIMA
Forecasting Models
• Use the past to forecast the future
• “sophisticated” extrapolation models
• competitive extrapolation models
– use the mean as a forecast for a stationary
time series, Et-1[y(t)] = mean of y(t)
– next period is the same as this period for a
stationary time series and for random walks,
Et-1[y(t)] = y(t-1)
– extrapolate trend for an evolutionary trended
time series, Et-1[y(t)] = a + b*t = y(t-1) + b
71