Applied Time Series Analysis

Applied Time Series Analysis Prof. Dr. Ralf Bruggemann Department of Economics Chair of Statistics and Econometrics last revised: April 3, 2019...

0 downloads 109 Views 368KB Size
Applied Time Series Analysis Prof. Dr. Ralf Br¨ uggemann

Department of Economics Chair of Statistics and Econometrics last revised: April 3, 2019

Introduction/Descriptive Methods

Contact

Instructor: Prof. Dr. Ralf Br¨ uggemann • Email: [email protected] • Room: F 321 • Tel.: 07531-88-2643 • Office Hours: by appointment

Tutorials: Maurizio Daniele

1-1

Introduction/Descriptive Methods

1-2

Organizational Details • Lectures • Mo., 11.45-13.15, D436 • Fr., 11.45-13.15, D436 • Tutorials/Computer Sessions • Mo. + Fr., 11.45-13.15, D436 / Computer Pool BS 217 • Computer sessions: analysis of data sets using Matlab • Programming and simulation using Matlab

• Language: English • Assessment: One Take Home (30%), Written examination (70%) • Prerequisites: ‘Econometrics I’ or ’Advanced Econometrics’

Introduction/Descriptive Methods

Course Outline

1. Introduction/Descriptive Methods 2. Stationary Time Series Models (AR, MA, ARMA) 3. Estimation, Specification and Validation of ARMA Models 4. Nonstationary Time Series Models (ARIMA, Unit Root Tests) 5. Forecasting 6. Time Series Models of Heteroskedasticity (ARCH + GARCH) 7. Topics in Applied Time Series Modelling

1-3

Introduction/Descriptive Methods

1-4

Readings • Hamilton (1994), Time Series Analysis, Princeton University

Press, Chapters 3, 4, 5, 15, 17, 21 • L¨ utkepohl and Kr¨atzig (2004), Applied Time Series

Econometrics, Cambridge University Press, Chapters 1, 2, 5, 6 • Enders (2014), Applied Econometric Time Series, 3rd edition,

Wiley, Chapters 1, 2, 3, 4 • Schlittgen and Streitberg (2001), Zeitreihenanalyse, Oldenbourg

Verlag, Chapters 1, 2, 4, 6 • Additional readings: Semesterapparat, articles mentioned in class

Introduction/Descriptive Methods

What is a Time Series?

• Time series y1 , . . . , yT data consists of stretch of (roughly)

equidistant chronologically ordered observations • Time series data are observed at different frequencies:

e.g. hourly, daily, weekly, monthly, quarterly, yearly data

1-5

Introduction/Descriptive Methods

1-6

A little more formally: • A univariate time series is a set of observations yt , recorded at a

specified time t ∈ T , sometimes written as {yt }t∈T • T usually denotes a finite, discrete set of equidistant points in

time: • finite: e.g. for T = {1, ..., T } one has {yt } ∈ T = {yt }T t=1 and

{y1 , y2 , ..., yT } • discrete: variable is observed only at specific points in time that

depend on the frequency: e.g. hourly, daily, weekly, monthly, quarterly, yearly data • equidistant points: time between two successive observations is

assumed to always be the same (But note e.g. problem in case of daily data without observation for weekends)

Introduction/Descriptive Methods

1-7

• For theoretical considerations one often assumes that

observations yt have been generated by a stochastic process (cf. Section 2) that has started in the infinite past and continues to infinite future, i.e. , ...} {y }∞ , y , ..., y , y t=−∞ = {..., y−1 , y0 , y |1 2{z T} T +1 ∞ and {yt }T t=1 is finite segment of infinite series {yt }t=−∞

• Notation: {yt }t∈T is sometimes written compactly as yt • Notation: In what follows, yt denotes sometimes the stochastic

process or the complete time series or a particular observation at date t. Meaning will become clear from context.

Introduction/Descriptive Methods

1-8

Time Series Example: IFO Business Expectations

115 110 105 100 95 90 85 80 75 1995

2000

2005

2010

2015

Figure 1: IFO business expectations, 1991M1-2017M1

Introduction/Descriptive Methods

1-9

Time Series Example: Growth rate of Euro Area GDP

10

5

0

-5

-10

-15 1970

1980

1990

2000

2010

2020

Figure 2: Quarterly growth rates of Euro area GDP, 1970Q2-2015Q4

Introduction/Descriptive Methods

1-10

Time Series Example: 20 Euro Area short term interest rate Euro area long term interest rate 15

10

5

0 1970

1980

1990

2000

2010

2020

Figure 3: Plots of Euro area interest rates, 1970Q1-2015Q4

Introduction/Descriptive Methods

1-11

Time Series Example: log of real US GDP

10

9.5

9

8.5

8 1960

1970

1980

1990

2000

2010

Figure 4: Quarterly US Real GDP, 1960Q1-2016Q4

Introduction/Descriptive Methods

1-12

Time Series Example: 5

105

Real UK GDP

4.5 4 3.5 3 2.5 2 1.5 1975

1980

1985

1990

1995

2000

2005

2010

2015

Figure 5: Quarterly UK Real GDP, 1975Q1-2016Q4

Introduction/Descriptive Methods

1-13

Time Series Example: 14000

DAX 30 Index

12000

10000

8000

6000

4000

2000 1998 2000 2002 2004 2006 2008 2010 2012 2014 2016

Figure 6: DAX 30 index, Jan 2, 1997 – Feb 20, 2017

Introduction/Descriptive Methods

1-14

Time Series Example: 15

DAX 30 returns

10

5

0

-5

-10 1998 2000 2002 2004 2006 2008 2010 2012 2014 2016

Figure 7: DAX30 daily percentage returns, Jan 3, 1997 – Feb 20, 2017

Introduction/Descriptive Methods

Characteristics of Economic Time Series Economic time series are characterized by at least one of the following: • Serial Correlation • (Changing) Trends • Seasonality • Cyclical component • Conditional Heteroskedasticity • Level shifts / outliers

Standard econometric procedures assuming i.i.d. data are often inappropriate for time series data

1-15

Introduction/Descriptive Methods

1-16

Why Time Series Analysis? 1. Forecasting • data from past may contain information on the future development

of a variable • forecasting future developments requires certain regularities or

structures in the data • time series analysis helps to detect such characteristics and to

understand the ‘data generating mechanism’

2. Structural Analysis • Economic theories make predictions on how economic variables

evolve over time (i.e. make statements about their dynamic properties) [e.g. in Business Cycle Analysis] • time series analysis provides tools for checking ‘postulated’

properties

Introduction/Descriptive Methods

Descriptive Methods • Empirical moments (of first and second order) serve as

explorative tools in statistical analysis • Note: computation only meaningful for covariance stationary

time series (cf. Section 2) • sample mean: y¯ =

T 1 X yt T t=1

T 1 X • sample variance: γ ˆ0 = (yt − y¯)2 T t=1 √ • estimated standard deviation: σ ˆ = γˆ0

1-17

Introduction/Descriptive Methods

1-18

• sample autocovariance function at lag h T 1 X (yt − y¯)(yt−h − y¯) γˆh = T

for h = 0, 1, ...

or

t=h+1

γˆh =

T X 1 (yt − y¯)(yt−h − y¯) T −h

for h = 0, 1, ...

t=h+1

• sample autocorrelation functions (SACFs) at lag h:

ρˆh =

γˆh , γˆ0

h = 0, 1, ... with |ˆ ρh | ≤ 1

• Plotting ρˆh against h gives autocorrelogram or correlogram

Introduction/Descriptive Methods

1-19

• Correlograms provide important information about dependencies

over time • Correlograms are useful in model specification (see Sect. 3)

Introduction/Descriptive Methods

1-20

Example: (Sample) Autocorrelogram

Sample Autocorrelation

1

0.5

0

-0.5 0

4

8

12

16

20

24

28

32

36

Lag

Figure 8: Correlogram of IFO business expectations, 1991M1-2017M1

Introduction/Descriptive Methods

1-21

Example: (Sample) Autocorrelogram log of real US GDP

10

Growth rate of real US GDP

20

9.5 10 9 0 8.5 8 1960 1970 1980 1990 2000 2010

-10 1960 1970 1980 1990 2000 2010 1

0.8 0.6

0.5

0.4 0.2

0

0 -0.2

-0.5 0

4

8

12 16 20 24 28 32 36

Lag

0

4

8

12 16 20 24 28 32 36

Lag

Figure 9: Correlograms of log-level and growth rate of US Real GDP

Introduction/Descriptive Methods

1-22

Example: (Sample) Autocorrelogram log of real UK GDP

13.5

Growth rate of real UK GDP

40 20

13 0 12.5 -20 12

-40 1980

1990

2000

1980

2010

1990

2000

2010

1 0.8 0.5 0.6 0.4

0

0.2 -0.5 0 -0.2

-1 0

4

8

12 16 20 24 28 32 36

Lag

0

4

8

12 16 20 24 28 32 36

Lag

Figure 10: Correlograms of log-level and growth rate of UK Real GDP (nsa)

Introduction/Descriptive Methods

1-23

The Hodrick-Prescott (HP) Filter • The HP-filter decomposes a time series yt into a trend

component mt and a cyclical component zt , i.e. yt = mt + zt • The filter was introduced by Hodrick and Prescott (1997) and is

a very popular tool in empirical macroeconomics and business cycle analysis • The HP-filter is an example of a non-parametric detrending

method • Assume only that trend mt is ‘smooth’ and choose m1 , . . . , mT

such that they minimize T X

|t=1

2

T X

}

|t=3

(yt − mt ) +λ {z 1)

{(mt − mt−1 ) − (mt−1 − mt−2 )}2 {z 2)

}

Introduction/Descriptive Methods

1-24

• The term 1) measures goodness of fit (LS criterion) • The term 2) is a ‘penalty term’ and measures ‘non-smoothness’

of the trend. Note that (mt − mt−1 ) − (mt−1 − mt−2 ) = ∆mt − ∆mt−1 is the second difference of the trend component, i.e. large changes in the trend are ‘penalized’ • λ > 0 is the smoothing parameter and governs trade-off between

‘goodness-of-fit’ and smoothness • large λ ⇒ high penalty for non-smoothness ⇒ smooth trend • λ → ∞ results in linear trend • λ=0⇒m ˆ t = yt

Introduction/Descriptive Methods

1-25

Choice of λ: • For quarterly data, Hodrick & Prescott suggested to use

λ = 1600 • Then the HP-filter acts as a ‘high-pass’ filter that picks-up

cyclical fluctuations with duration less than 10 years • For other frequencies, choose

λ = 1600 · s 4 with s as the change factor in observation frequency relative to quarterly data [see Ravn and Uhlig (2002)]

Introduction/Descriptive Methods

• Example: For annual data s =

λannual

1-26

1 and 4

 4 1 1600 1600 = 1600 · = 4 = = 6.25 4 4 256

• Example: For monthly data, s =

12 = 3 and 4

λmonthly = 1600 · 34 = 1600 · 81 = 129600

Introduction/Descriptive Methods

• Applying the HP-filter yields a set of T observations on the

estimated trend component m ˆ1, . . . , m ˆT • Difference zˆt = yt − m ˆ t is the cyclical component

1-27

Introduction/Descriptive Methods

1-28

Example: log of real GDP and HP filter trend

10 9.5 9 8.5 8 7.5 1950

1960

1970

1980

1990

cyclical component of HP filter (

0.05

2000

2010

= 1600)

0

-0.05

-0.1 1950

1960

1970

1980

1990

2000

2010

Figure 11: Log of real US GDP with HP trend and cyclical component

Introduction/Descriptive Methods

1-29

Example: Detrended Time Series Cyclical components

0.1

HP filter cubic detrending 0.05

0

-0.05

-0.1 1950

1960

1970

1980

1990

2000

2010

Figure 12: Cyclical components of US GDP extracted by HP-filter and parameteric (cubic) detrending

Introduction/Descriptive Methods

1-30

Transformations and Filters • log-transformation may help to stabilize variances:

xt = log(yt ), where log denotes the natural logarithm • first differences of log-transformation are roughly the growth

rates of the original series:  log yt − log yt−1 = log

yt



yt−1   yt − yt−1 yt − yt−1 = log 1 + ≈ yt−1 yt−1

Introduction/Descriptive Methods

1-31

• For quarterly series, annual rates of change (yearly growth rates)

are obtained by using log yt − log yt−4 ≈

yt − yt−4 yt−4

Introduction/Descriptive Methods

• Lag operator L (backshift operator):

Lyt : = yt−1 L2 yt : = yt−2 .. . Lj yt : = yt−j

for any integer j

• Note: L0 yt = yt and Lc = c if c is a constant • Lag operator is used to define difference filters, e.g.:

∆yt := yt − yt−1 = (1 − L)yt ∆4 yt := yt − yt−4 = (1 − L4 )yt

1-32

Introduction/Descriptive Methods

1-33

• Seasonal differencing operator: Let s denote the periodicity of

season, e.g. s = 4 for quarterly and s = 12 for monthly data, then: ∆s yt := yt − yt−s = (1 − Ls ) yt | {z } ∆s

Introduction/Descriptive Methods

1-34

Interpretation of Transformations • Note: If xt is a quarterly time series, and yt = log(xt ), then ∆yt

is the approximate quarter-over-quarter or quarterly growth rate • The quarterly growth rate in % is: 100 · ∆yt • The annualized growth rate in % is: 400 · ∆yt • The annual growth rate in % is: 100 · ∆4 yt • Similarly for monthly data xt and yt = log(xt ): • The month-over-month or monthly growth rate in % is: 100 · ∆yt • The annualized growth rate in % is: 1200 · ∆yt • The annual growth rate in % is: 100 · ∆12 yt

Introduction/Descriptive Methods

1-35

Example: 5

105

x t: UK real GDP, nsa

y t = log(x t)

13.5

4 13 3 12.5 2 1

12 1980

1990

0.1

2000

yt

2010

1980

1990 4

0.1

0.05

0.05

0

0

-0.05

-0.05

-0.1

2000

2010

2000

2010

yt

-0.1 1980

1990

2000

2010

1980

1990

Figure 13: Real UK GDP (nsa) and its transformations

Introduction/Descriptive Methods

1-36

• Linear filter with weights wj :

xt =

l X

wj yt−j ,

t = k + 1, ..., T − l

j=−k

with l, k positive integers • Note: Often weights sum to one:

Pl

j=−k

wj = 1

Introduction/Descriptive Methods

1-37

Example: Moving average filter • Let k = l := q and

wj =

 

1 2q + 1  0

|j| ≤ q else

Then xt is a weighted average of neighboring observations: q X 1 xt = yt−j 2q + 1

for q + 1 ≤ t ≤ T − q

j=−q

• Note: This is an example of a two-sided filter with boundary

problems as yt is not observable for t < 1 and t > T . Sometimes: yt = y1 for t < 1 and yt = yT for t > T is used

Introduction/Descriptive Methods

1-38

• Filters are used for seasonal adjustment [see e.g. Schlittgen and

Streitberg (2001, Sec. 1.7)] • Seasonal adjustment procedures typically use complicated, often

non-linear filters • Examples of seasonal adjustment filters include the Census X-11,

X-12-ARIMA, X-13-ARIMA, and the ‘Berliner Verfahren’ • Seasonal adjustment may distort the original dynamics of a time

series • Alternatives: • Seasonal differencing (see above, Seasonal ARIMA) • Deterministic modeling of seasonality (Seasonal dummies)