lect1

advertisement
The Basics: Outline
• What is a time series? What is a
financial time series?
• What is the purpose of our analysis?
• Classification of Time Series.
• Correlation
– Autocorrelation
– Partial Autocorrelation
– Cross Correlation
• Basic transformation to stationarity
– Differencing
Spring 2005
K. Ensor, STAT 421
1
What is a time series?
• Review
• Time Series
– Random variable
– Distribution (cdf, pdf)
– Moments
•
•
•
•
•
•
Spring 2005
Mean
Variance
Covariance
Correlation
Skewness
Kurtosis
– Random process –
random variable is a
function of time
– Distribution?
– Moments
•
•
•
•
•
•
K. Ensor, STAT 421
Mean
Variance
Covariance
Correlation
Skewness
Kurtosis
2
-4
-2
0
2
Stationary Time Series with
100 Future Realizations
0
Spring 2005
10
20
K. Ensor, STAT 421
30
3
10
8
6
4
percent
12
14
16
U.S. Weekly Interest Rates
Red line is 1-year; Blue line is 3-year
01/05/1962
Spring 2005
07/18/1969
01/28/1977
08/10/1984
TimeSTAT
in w eek
s
K. Ensor,
421
02/21/1992
09/03/1999
4
Further examples of a time series
Spring 2005
5
earning
10
15
Quarterly Earning per shar Johnson and Johnson
0
• Anything observed
sequentially (by
time?)
• Returns, volatility,
interest rates,
exchange rates,
bond yields, …
• Hourly temperature,
hourly ozone levels
• ???
Jan 60
K. Ensor, STAT 421
Jan 64
Jan 68
Jan 72
Jan 76
Jan 80
Time in quarters
5
What is different?
Spring 2005
1
log earning
2
Log Quarterly Earning per share Johnson and Johnson
0
• The observations
are not
independent.
• There is correlation
from observation to
observation.
• Consider the log of
the J&J series.
• Is there correlation
in the observations
over time?
Jan 60
K. Ensor, STAT 421
Jan 64
Jan 68
Jan 72
Jan 76
Jan 80
Time in quarters
6
What are our objectives?
• Making decisions based on the observed
realization requires:
– Descriptive: Estimating summary measures
(e.g. mean)
– Inferential: Understanding / Modeling
– Prediction / Forecasting
– Control of the process
• If correlation is present between the
observations then our typical
approaches are not correct (as they
assume iid samples).
Spring 2005
K. Ensor, STAT 421
7
Classification of a Time Series
• Dimension of X
• Dimension of T
– Time, space, spacetime
• Nature of T
– Discrete
• Equally
• Unequally spaced
• State spce
– Discrete
– Continuous
• Memory types
– Stationary
– Continuous
• Observed
continuously
• Observed by some
random process
Spring 2005
– Univariate
– Multivariate
• No memory
• Short memory
• Long memory
– Nonstationary
K. Ensor, STAT 421
8
Stationarity
Strictly Stationary
All finite
dimensional
distributions are
the same.
Covariance
Stationary
First and second moment
structure does not change
with time.
Spring 2005
K. Ensor, STAT 421
9
Autocorrelation
Spring 2005
K. Ensor, STAT 421
10
Autocorrelation Function for a CSTS
• In theory…
• How to estimate this quantity?
Spring 2005
K. Ensor, STAT 421
11
Autocorrelation?
2
2
2
0
1
lagged 7
K. Ensor, STAT 421
2
2
0
0
1
lagged 8
2
1
2
Series 1
2
lagged 5
2
0
Series 1
Series 1
0
0
1
lagged 4
2
2
0
1
lagged 6
1
lagged 3
1
0
0
0
2
1
Series 1
2
1
Series 1
1
lagged 2
0
0
1
Series 1
1
Series 1
2
2
0
0
1
2
0
1
1
0
lagged 1
Spring 2005
1
Series 1
2
1
Series 1
0
1
Series 1
0
How would you
determine or
show correlation
over time?
2
Lagged Scatterplots : x
0
1
lagged 9
2
0
1
lagged 10
12
2
Sample ACF and PACF
• Sample ACF – sample estimate of the
autocorrelation function.
– Substitute sample estimates of the
covariance between X(t) and X(t+h). Note:
We do not have “n” pairs but “n-h” pairs.
– Subsitute sample estimate of variance.
• Sample PACF – correlation between
observations X(t) and X(t+h) after
removing the linear relationship of all
observations in that fall between X(t)
and X(t+h).
Spring 2005
K. Ensor, STAT 421
13
Summary Plots
0
1
2
Log Quarterly Earnings for J&J
J an 60
J an 64
J an 68
J an 72
J an 76
J an 80
Time in quarters
PACF
-1
0
1
2
Log Quarterly Earnings for J&J
Spring 2005
3
0.5
0.0
ACF
0.0
-0.5
-1.0
0
-1.0
-0.5
5
ACF
10
0.5
15
1.0
ACF
1.0
Histogram
0
5
10
15
Lag
K. Ensor, STAT 421
0
5
10
15
Lag
14
Cross Correlation
Spring 2005
K. Ensor, STAT 421
15
Multivariate Series
• How can we study the
relationship between 2 or
more time series?
• U.S. weekly interest rate
series measured in
percentages
• And the corresponding
change series
– c1(t)=(1-B)r1(t)
– c2(t)=(1-B)r2(t)
– Time: From 1/5/1962 to
9/10/1999.
– Variables:
• r1(t) = The 1-year
Treasury constant
maturity rate
• r2(t) = The 3-year
Treasury constant
maturity rate
Spring 2005
K. Ensor, STAT 421
16
10
4
6
8
percent
12
14
16
U.S. Weekly Interest Rates
Red line is 1-year; Blue line is 3-year
01/05/1962
07/18/1969
01/28/1977
08/10/1984
02/21/1992
09/03/1999
Time in weeks
Spring 2005
K. Ensor, STAT 421
17
1.0
16
14
diff(yr3)
0.0
0.5
12
Spring 2005
-1.0
4
The two series
are highly
correlated.
6
-0.5
yr3
10
8
Scatterplots
•between series
simultaneous in
time
•and the change
in each series.
Scatterplot of Change 1yr rate and 3yr rate
1.5
Scatterplot of U.S. Weekly Interest Rate
4
6
8
10
12
14
yr1
K. Ensor, STAT 421
16
-1.5
-1.0
-0.5
0.0
0.5
1.0
1.5
diff(yr1)
18
-1.5
-0.5
0.5
1.5
Change in 1-year rate
0
500
1000
1500
2000
1500
2000
Time
-1.0
0.0
0.5
1.0
1.5
Change in 3-year rate
0
Spring 2005
500
1000
K. Ensor, STAT 421
19
c3
-1.0
0.0
0.5
1.0
1.5
Scatterplot of Change in 1-year and 3-year rate
-1.5
-1.0
-0.5
0.0
0.5
1.0
1.5
c1
Multivariate Series : cbind(c1, c3)
Spring 2005
0. 0
0. 2
0. 4
0. 6
0. 8
ACF
0. 0 0. 2 0. 4 0. 6 0. 8 1. 0
c1 and c3
0
5
10
15
20
25
30
0
5
10
20
25
30
20
25
30
0. 2
0. 2
0. 4
0. 6
ACF
0. 4 0. 6
0. 8
0. 8
15
c3
1. 0
c3 and c1
0. 0
0. 0
What is the
cross-correlation
between the two
series?
c1
-30
-25
-20
-15
Lag
-10
-5
K. Ensor, STAT 421
0
0
5
10
15
Lag
20
Differencing to
achieve Stationarity
Spring 2005
K. Ensor, STAT 421
21
Detrending by taking first difference.
First Difference Log Quarterly Earning per share J&J
Z(t) is a random
variable.
0.2
0.0
-0.2
-0.4
-0.6
Suppose
X(t)=a+bt+Z(t)
first difference of log earning
What happens to
the trend?
0.4
Y(t)=X(t) – X(t-1)
Apr 60
Apr 64
Apr 68
Apr 72
Apr 76
Apr 80
Time in quarters
Spring 2005
K. Ensor, STAT 421
22
Sumary Plots of Detrended J&J log
earnings per share.
-0.6
0.0
0.4
Detrended Log Quarterly Earnings for J&J
Apr 60
Apr 64
Apr 68
Apr 72
Apr 76
Apr 80
Time in quarters
Histogram
ACF
-0.6
-0.4
-0.2
0.0
0.2
0.4
Detrended Log Quarterly Earnings for J&J
0.6
0.0
ACF
-0.5
-1.0
-1.0
0
-0.8
Spring 2005
0.0
-0.5
10
ACF
20
0.5
0.5
30
1.0
1.0
PACF
0
5
10
15
Lag
K. Ensor, STAT 421
0
5
10
15
Lag
23
Removing Seasonal Trend – one way
to proceed.
• Suppose Y(t)=g(t)+W(t) where
g(t)=g(t-s) where s is our “season”
for all t. W(t) is again a new random
variable
• Form a new series U(t) by taking the
“s” difference
U(t)=Y(t)-Y(t-s)
=g(t)-g(t-s) + W(t)-W(t-s)
=W(t)-W(t-s) again a random variable
Spring 2005
K. Ensor, STAT 421
24
Summary of Transformed J&J Series
-0.2
-0.1
0.0
0.1
0.2
Log J&J After Removing Linear and Seasonal Trend
Apr 61
J an 65
Oc t 68
J ul 72
Apr 76
J an 80
Time in quar ter s
PACF
-0.2
-0.1
0.0
0.1
0.2
0.3
Log J&J After Removing Linear and Seasonal Trend
Spring 2005
0.5
0.0
ACF
0.0
-0.5
-1.0
0
-1.0
-0.5
5
ACF
10
0.5
15
1.0
ACF
1.0
Histogram
0
5
10
15
Lag
K. Ensor, STAT 421
0
5
10
15
Lag
25
Summary of Transformations:
• X(t) = log (Q(t))
• Y(t)=X(t)-X(t-1)
= (1-B)X(t)
• U(t)= (1-B4)Y(t)
• U(t)=(1-B4) (1-B)X(t)
Spring 2005
K. Ensor, STAT 421
26
An example of
Forecasting
Spring 2005
K. Ensor, STAT 421
27
What is the next step?
• U(t) is a time series process called a
moving average of order 1 (or possibly
a MA(1) plus a seasonal MA(1))
– U(t)=q e(t-1) + e(t)
• Proceed to estimate q and then we can
estimate summary information about
the earnings per share as well as
predict the future earnings per share.
Spring 2005
K. Ensor, STAT 421
28
Forecast of J&J series
20
10
15
Earnings
25
Two Year Forecast and 95% Bounds for
Johnson and Johnson Quarterly Earnings Per Share
5
10
15
20
Quarter
Time
Spring 2005
K. Ensor, STAT 421
29
Wrap up
•
•
•
•
Basics of distribution theory.
Classification of time series.
Basics of stationarity.
Correlation functions
– Autocorrelation
– Partial autocorrelation
– Cross correlation
• Transformations to a stationary series
– differencing
Spring 2005
K. Ensor, STAT 421
30
Download