computational finance ii: time series k.ensor. what is a time series? anything observed sequentially...

21
Computational Finance II: Time Series K.Ensor

Upload: milton-oliver

Post on 18-Jan-2018

221 views

Category:

Documents


0 download

DESCRIPTION

What is different? 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?

TRANSCRIPT

Page 1: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Computational Finance II: Time Series

K.Ensor

Page 2: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

What is a time series? Anything observed

sequentially (by time?)

Returns, volatility, interest rates, exchange rates, bond yields, …

Hourly temperature, variations of the thickness of a wire as a function of length

Time in quarters

earn

ing

05

1015

Jan 60 Jan 64 Jan 68 Jan 72 Jan 76 Jan 80

Quarterly Earning per shar Johnson and Johnson

Page 3: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

What is different? 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?

Time in quarters

log

earn

ing

01

2

Jan 60 Jan 64 Jan 68 Jan 72 Jan 76 Jan 80

Log Quarterly Earning per share Johnson and Johnson

Page 4: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

What are our objectives? Understanding / Modeling Estimating summary measures (e.g.

mean) Prediction / Forecasting

If correlation is present between the observations then our typical approaches are not correct (assume iid samples).

Page 5: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Autocorrelation?

How would you determine or show correlation over time?

lagged 1S

erie

s 1

0 1 2

01

2lagged 2

Ser

ies

1

0 1 2

01

2

lagged 3

Ser

ies

1

0 1 2

01

2

lagged 4

Ser

ies

1

0 1 2

01

2

lagged 5

Ser

ies

1

0 1 2

01

2

lagged 6

Ser

ies

1

0 1 2

01

2

lagged 7

Ser

ies

1

0 1 2

01

2

lagged 8

Ser

ies

1

0 1 2

01

2

lagged 9

Ser

ies

1

0 1 2

01

2

lagged 10

Ser

ies

1

0 1 2

01

2

Lagged Scatterplots : xLagged Scatterplots : x

Page 6: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Autocorrelation Function In theory…

How to estimate this quantity?

Page 7: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

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).

Page 8: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Summary Plots

Time in quarters

01

2

Jan 60 Jan 64 Jan 68 Jan 72 Jan 76 Jan 80

Log Quarterly Earnings for J&J

-1 0 1 2 3

05

1015

Histogram

Log Quarterly Earnings for J&J Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

ACF

Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

PACF

Page 9: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Detrending by taking first difference.

Time in quarters

first

diff

eren

ce o

f log

ear

ning

-0.6

-0.4

-0.2

0.0

0.2

0.4

Apr 60 Apr 64 Apr 68 Apr 72 Apr 76 Apr 80

First Difference Log Quarterly Earning per share J&JY(t)=X(t) – X(t-1)

What happens to the trend?

Suppose X(t)=a+bt+Z(t)

Z(t) is a random variable.

Page 10: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Detrended J&J series: Autocorrelation?

lagged 1

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.6

-0.4

-0.2

0.0

0.2

0.4

lagged 2

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.6

-0.4

-0.2

0.0

0.2

0.4

lagged 3

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.4

-0.2

0.0

0.2

0.4

lagged 4

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.4

-0.2

0.0

0.2

0.4

lagged 5

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.4

-0.2

0.0

0.2

0.4

lagged 6

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.4

-0.2

0.0

0.2

0.4

lagged 7

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2 0.4

-0.4

-0.2

0.0

0.2

0.4

lagged 8

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2

-0.4

-0.2

0.0

0.2

0.4

lagged 9

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2

-0.4

-0.2

0.0

0.2

0.4

lagged 10

Ser

ies

1

-0.6 -0.4 -0.2 0.0 0.2

-0.4

-0.2

0.0

0.2

0.4

Lagged Scatterplots : xLagged Scatterplots : x

Page 11: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Sumary Plots of Detrended J&J log earnings per share.

Time in quarters

-0.6

0.0

0.4

Apr 60 Apr 64 Apr 68 Apr 72 Apr 76 Apr 80

Detrended Log Quarterly Earnings for J&J

-0.8 -0.6 -0.4 -0.2 0.0 0.2 0.4 0.6

010

2030

Histogram

Detrended Log Quarterly Earnings for J&J Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

ACF

Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

PACF

Page 12: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

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

Page 13: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Summary of Transformed J&J Series

Time in quarters

-0.2

-0.1

0.0

0.1

0.2

Apr 61 Jan 65 Oct 68 Jul 72 Apr 76 Jan 80

Log J&J After Removing Linear and Seasonal Trend

-0.2 -0.1 0.0 0.1 0.2 0.3

05

1015

Histogram

Log J&J After Removing Linear and Seasonal Trend Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

ACF

Lag

AC

F

0 5 10 15

-1.0

-0.5

0.0

0.5

1.0

PACF

Page 14: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

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)

Page 15: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

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)=(t-1) + (t)

Proceed to estimate and then we can estimate summary information about the earnings per share as well as predict.

Page 16: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Time

5 10 15 20

1015

2025

Two Year Forecast and 95% Bounds for Johnson and Johnson Quarterly Earnings Per Share

Quarter

Ear

ning

s

Forecast of J&J series

Page 17: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Why does the autocorrelation matter when making inferences? Consider estimation of the mean of a

stationary series E[X(t)]= for all t

If X(1),…,X(n) are iid what is the sampling distribution of the estimator for , namely the sample mean?

Page 18: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Why does the autocorrelation matter? What if X(t) has the following

structure (autoregressive model of order 1 AR(1) ) X(t)- = (X(t-1)- ) + (t)

Then Corr(X(t),X(t+h))= |h| for all h And Var(X)= (1+ Var(X)/n

Page 19: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Comparing the samples size? Let m denote the

number of iid obs. Let n denote the

number of correlated obs.

Setting the variances equal and solving for m as a function of n yields m=n(1-

Let n=100, then m=5 iid obs.

If n=100 and then the equivalent number of iid observations is 1900.

For positive and negative (correlation of lag 1) the equivalent sample sizes are 33 and 300.

Page 20: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Why? Why does the autocorrelation make

such a big difference in our ability to estimate the mean?

The same arguments for other mean functions of the process or other functions of the process we want to estimate.

Page 21: Computational Finance II: Time Series K.Ensor. What is a time series? Anything observed sequentially (by time?) Returns, volatility, interest rates, exchange

Summary Times series is correlated data,

sequentially observed. The autocorrelation is a measure of the

this correlation over the time lag. This dependence structure along with

proper assumptions allows us to forecast the future of the process.

Correct inference requires incorporating knowledge of the dependence structure.