• No se han encontrado resultados

Introduction to Time Series Analysis

N/A
N/A
Protected

Academic year: 2023

Share "Introduction to Time Series Analysis"

Copied!
95
0
0

Texto completo

(1)

Introduction to Time Series Analysis

Regina Kaiser Office. 10.1.17

E-mail:[email protected]

(2)

Outline

Chapter 1. Univariate ARIMA models.

Chapter 2. Model fitting and checking.

Chapter 3. Prediction and model selection.

Chapter 4. Outliers and influential observations.

Chapter 5. Heterocedastic models.

Chapter 6. The TRAMO software.

(3)

Textbooks

Abraham, B. and Ledolter, J. (1983) . Statistical Methods for Forecasting. Wiley, New York.

Anderson, T. W. (1971). The Statistical Analysis of Time Series.

Springer Verlag. New York.

Box, G.E.P., Jenkins, G.M. and Reinsel, G. (1994). Time Series

Analysis: Forecasting and Control, 3rd. Ed. Prentice-Hall, Englewood Cliffs, NJ.

Brockwell, P.J. and Davis, R.A. (1996). Time Series: Theory and Methods. Springer-Verlag. New York.

(4)

Grading

• Final exam (60%).

• Empirical project (40%).

(5)

Web resources

Time series data library.

(http://www-personal.buseco.monash.edu.au/~hyndman/TSDL/)

Macroeconomic time series

http://www.fgn.unisg.ch/eurmacro/macrodata/index.html

Time series applets 1.

http://www.aranya.com/resources/java/

Time series applets 2

http://www.ubmail.ubalt.edu/~harsham/zero/scientificCal.htm

Time series applets 3.

https://stat.tamu.edu/~jhardin/applets/index.html

(6)

Motivation

• Time series: sequence of observations taken at regular intervals of time

• Data in bussines, engineering, enviroment, medicine, etc.

(7)

Motivation.

(8)

Motivation.

(9)

Motivation.

(10)

Motivation.

(11)

Motivation.

(12)

Motivation.

World,Oecd crude oil price(Q)

10 20 30 40 50 60

(13)

Motivation.

World, food price (Q)

0 0,5 1 1,5 2

(14)

Motivation.

World, minerals price (Q)

0,5 1 1,5 2

(15)

Motivation.

World, agricultural raw price (Q)

0 0,2 0,4 0,6 0,8 1 1,2 1,4 1,6

1 10 19 28 37 46 55 64 73 82 91 100 109

(16)

Motivation.

World, tropical drinks price (q)

0,5 1 1,5 2 2,5 3

(17)

Motivation.

0 0,5 1 1,5 2 2,5 3

Tropical drinks Agricultural raw mat

Minerals, ore and metals Food

(18)

Motivation.

(19)

Motivation.

(20)

Motivation.

• Knowledge of the dynamic structure will help to produce accurate forecasts of future observations and design optimal control

schemes.

(21)

Motivation Main objectives

• Understanding the dynamic structure of the observations in a single series.

• Ascertain the leading, lagging and feedback relationships among several variables.

(22)

Chapter 1

Univariate ARIMA Models

Recommended readings: chapters 1 to 7 of Peña (2005)

(23)

Chapter 1. Contents.

1.1. Introduction.

Definitions, examples,

1.2. Properties of univariate ARMA.

ARMA weights.

Stationarity and covariance structure.

Autocorrelation function.

Partial autocorrelación function.

1.3. Model especification.

1.4. Examples.

(24)

Introduction

• Stochastic Process. Real-valued random variable that follows a distribution .

• The T-dimensional variable will have a joint distribution that depends on

zt ft (zt )

) ,...,

,

(zt1 zt2 ztT )

,..., ,

(t1 t2 tT

(25)

Introduction

• Time Series will denote a particular realization of the stochastic

process .

• To simplify notation

] ,...,

,

[zt1 zt2 ztT

) ,...,

,

(z1 z2 zT

(26)

Introduction Assumptions

1. The process is stationary

2. The joint distribution of is a multivariate normal distribution

) ,...,

,

(z1 z2 zT

(27)

Introduction Implications of stationarity

• The joint distribution remains constant over time

• It is then true that

) ,...,

, (

) ,...,

,

(z1 z2 zT f z1 k z2 k zT k

f

z;

Ezt VztVz

(28)

Introduction

• Stationarity implies a constant mean and bounded deviations from it.

• Strong requirement, few actual economic series will satisfy it.

(29)

Introduction

(30)

Introduction

(31)

Introduction

(32)

Introduction

Transformations to achieve stationarity

– Constant variance: log/level plus outlier correction.

– Stationary in mean: differencing.

(33)

Introduction Differencing

• Let B be the backward operator

• We shall use the operators:

– Regular difference – Seasonal difference

j t t

j z z

B

B

 1

s

s   B

 1

(34)

Introduction

If is a deterministic trend

Where

• In general, will reduce a polynomial of degree

zt (ztabt )

; 0

;

2

t t

z

b z

).

2 (

t

t z

z   

d

(35)

Introduction

• Example: will cancel a constant, but it will also cancel other

deterministic periodic functions.

4

4  

zt zt zt

(36)

Introduction

• Homogeneous difference equation

• Characteristic equation:

• Solution is given by (four roots of the unit circle)

0 )

1

( 4 4

4     

zt B zt zt zt

i r

i r

r

r1 1, 2  1, 3  , 4   0

4 1

r

4 1

r

(37)

Introduction Therefore,

1. One in the zero frequency (trend) 2. One in the twice-a-year seasonality

3. Associated with once-a-year seasonality

) 1

)(

1 )(

1

( 2

4   BBB

2

/

(38)

Univariate ARMA models

“Building block” is the white noise process

Implications:

) ,

0

( 2 Niid

at

0 ,...)

, ,

/ (

)

(atE at at1 at2 at3E

0 )

, (

) ,

(at at jCov at at jE

(39)

Introduction General ARMA(p,q) processes:

• is the observable time series

• is sequence of white noise

• is the constant term

t

t c B a

z

B) ( )

(

 

} {at

} {zt

c

(40)

Introduction

• Autoregressive polynomial

• Moving-average polynomial

• The AR and MA polynomials are assumed

p pB B

B

B

( )  1 12 2 ... 

q qB B

B

B

( ) 1 12 2 ... 

(41)

Introduction

• Stationarity implies that all zeros of

are restricted to lie outside the unit circle and in this case:

Where is the mean of the series.

• Overall behavior of the series remains the same over time.

) (B

.... ) 1

( 1 p

c    

(42)

Introduction

• In real world, however, time series data often exhibits a drifting behavior. Nonsta- stionarity can be modeled allowing some of the zeroes in to be equal to one. Thus,(B)

t t

d z c B a

B

B)(1 ) ( )

(

  

(43)

Introduction

• Some special cases of ARIMA(p,d,q):

– AR(1) – MA(1)

– ARMA(1,1) – IMA(1,1)

– ARIMA(0,1,1)(0,1,1)

(44)

Introduction

• AR(1) to MA( ) by recursive substitution.

t t

t z a

z 1

t t

t t

t t

t z a a z a a

z( 21)   2 2 1

t t

t k

t k

k t k

t z a a a a

z 1 1  ... 2 2 1

(45)

Introduction

• If , then

Which is a MA( )

1

 

0

j t j

j

t a

z

(46)

Introduction

• Some considerations:

• ARMA models are not unique (variety of possible representations.

• Parsimony is always a desirable property.

• AR representations are easiest to estimate (OLS) and to be interpretated.

(47)

Properties

• For simplicity, we will assume zero mean and an starting point m. The ARIMA (p,d,q)

• Can be rewritten as:

• Where,

t

t B a

z

B) ( )

(

zD aD

)' ,....,

(z z

za  (a ,...,a )'

(48)

Properties

1 ...

...

...

...

...

...

...

...

...

...

...

...

1

1 1

p p

D

... ... ...

...

1

1

D

) 1 )(

1

(t m t m

(49)

Properties

• ARMA weights

Where,

a D D

z1

...

1

1 1

D

D

(50)

Properties

• The -weights can be obtained by equating coefficients of powers of B from the

relations:

• Where

) ( )

( )

(B B B

...

1 )

(B  1B2B2

(51)

Properties

• The ARIMA (p,d,q) model can then be rewritten in the MA form as:

 

m t

h h t h

t

t a a

z

1

(52)

Properties

• In the same way,

• Where,

a z

D

D1

1

1 1

D

D

(53)

Properties

• With

• The AR form of the model is then, ).

( )

( )

(B B B

t m

t

h h t h

t z a

z  

1

(54)

Properties

• These two expressions are of fundamental importance in understanding the nature of the model.

• The MA form with the weights, shows how the observation is affected by current and past shocks or innovations.

zt

(55)

Properties Examples : AR(1) model

• MA representation:

• AR representation:

2 ....

2 1

1  

t t t

t a a a

z

t t

t z a

z 1

(56)

Properties Examples : MA(1) model

• MA representation:

• AR representation:

1

t t

t a a

z

(57)

Properties Examples : IMA(1,1) model

• MA representation:

• AR representation:

t t

t t

t z z z a

z  (1 ) 1 (1 ) 2 2(1 ) 3  ...  ....)

)(

1

(  12

t t t

t a a a

z

(58)

Stationarity condition

• Consider,

• Since the innovations are assumed normally distributed, it follows that the observations are also normally distributed.

• It is seen that, if in the characteristic

 

m t

h h t h

t

t a a

z

1

(59)

Stationarity condition

• (Where the A’s denote polinomials in k and the r’s are the distinct zeroes of )

• Then as we have that

) (B

,

 1

rj j  1,..., po

,

m t

, 0 )

(zt

E

 

 

0

) 2

, cov(

h h h k

a k

t t z

z

(60)

Stationarity condition

• So that will be stationary in this asymptotic sense.

• This is the stationarity condition of an

ARMA model, and is equivalent to require that the zeroes of are lying outside the unit circle.

zt

) (B

(61)

Lag k autocovariance

• Let us denote,

• For an alternative expressions in terms of the ARMA parameters,

) (

) ,

cov(

) ,

cov(

)

(kzt ztkzt ztkk

k ( t 1 t 1 ... p t p)

t z z z

z

) ...

( t 1 t 1 q t q

k

t a a a

z  

(62)

Lag k autocovariance

• By taking expectations on both sides and using the MA form, we obtain, for

k p

h h k h g

k    

1

) (

)

(



 2 qk

,

 0 k

(63)

Autocorrelation function

• The autocorrelation function is defined as

• By substitution of , we obtain that ,...

2 ,

1 ,

0 ) ,

0 (

) ) (

(  k k   

k

)

(k

) 0 0 ) (

( )

(

1

   

g k h

k k

p h

k

h

(64)

Autocorrelation function

• When , in a MA(q) model, then,

• That is, the autocorrelation function cuts off after lag q.

0 )

(B





 

q k

q

k q q k

, 0

, ) ...

1 ) (

(

1 2

2

1

(65)

Partial autocorrelation function

• Intuition

• AR(1):

• AR(2):

t t

t

t z z z

z 321

t t

t

t z z z

z 321

(66)

Partial autocorrelation function

• The autocorrelation function only takes into account that and are related in both cases.

• But if we want to measure the direct

relationship (without the intermediate ), we found that it is zero for the AR(1) and

different from zero for the AR(2) model zt zt2

1

zt

(67)

Partial autocorrelation function

• The partial autocorrelation function is, therefore, a measure of the linear relation among observations k-periods apart,

independently of the intermediate values.

(68)

Partial autocorrelation function

• Consider first an stationary AR(p) model.

The autoregressive coefficients are related to the autocorrelations by the Yule-Walker equations,

• Where, is the matrix,

p p

Gp Gp ( pxp)

(69)

Partial autocorrelation function

1 )

1 ( ...

) 2 (

) 1 (

) 1 ( 1

) 2 (

) 2 (

1 )

1 (

) 1 (

) 2 (

...

) 1 ( 1

p p

p

p p p

Gp

(70)

Partial autocorrelation function

• Regarding this as system of p equations and p unknowns (the coefficients), the

solution is, for p>1, the ratio of two determinants

p p

pH / G

(71)

Partial autocorrelation function

) ( )

1 ( ...

) 2 (

) 1 (

) 1 (

1 )

2 (

) 2 ( 1

) 1 (

) 1 ( )

2 (

...

) 1 ( 1

p p

p

p p

p

Hp

where

(72)

Partial autocorrelation function

•A pxp matrix, and for p=1. This leads to define, for any stationary model

•Which is known as the Partial Autocorrelation )

1

(

p





 1 /

1 )

(

k G

H

k k

k k

k

(73)

Partial autocorrelation function It has the property that, for a stationary AR(p) model,

In other words, vanishes for k>p when the model is AR(p).





 

p k

p

k k

k 0

k

(74)

properties

Slow decay towards zero Slow decay

towards zero ARMA(p,q)

slow decay towards zero q different

from zero MA(q)

p different from zero slow decay

towards zero AR(P)

PAF SAF

(75)

Examples

• AR(1) model

• Model:

• Variance:

t t

t z a

z 1

2 2

2 2

a z

z

 

2 2 2

1

  a

z

(76)

Examples

• Autocovariance function:









 

1 )

1 (

1 1

0 )

( 2

2 2

k k

k k

k a

z





(77)

Examples

• Autocorrelation function:

• Partial autocorrelation:









1 1 0 1

) (

k k k k

k

) 1 ( )

1

(

(78)

Examples

• AR(2) model

• Model:

• Variance:

t t

t

t z z a

z1 12 2

 

2

2 1 2

a

(79)

Examples

• Autocorrelation function:









 

 

1 2 1 1 )

(

2 2 1 2

2 1

k k k

2 2

2 1

1  

k k k

k

(80)

Examples

• MA(1) model

• Model:

• Variance:

1

t t

t a a

z

2 2

2 2

a a

z

 

) 1

( 2

2

2

 

(81)

Examples

• Autocovariance function:









1 0

1 0 )

( 2

2

k k k

k a

z



(82)

Examples

• Autocorrelation function:









 

1 0

1 1

0 1

)

( 2

k k k

k

(83)

Specification

• The class of ARMA(p,q) models is extensive.

• Guidelines are needed in selecting a

member of the class to represent the time series data at hand

(84)

Specification

• Box and Jenkins (1976) proposed an iterative model building strategy.

– Tentative specification or identification of a model.

– Efficient estimation of model parameters.

– Diagnostic checking of fitted model for further improvement.

(85)

Specification

• Tentative specification. The aim is to employ statistics that:

– 1. Can be readily calculated from the data.

– 2. Allow the user to tentatively select a model .

(86)

Specification

• Three methods:

– The Sample Autocorrelation Function (SAF)

– The Sample Partial Autocorrelation Function (SPAF)

– Use of diagnostic tools (AIC,BIC) to find

(87)

Specification

• Sample Autocorrelation Function. The SACF of are defined as

With

and the sample mean of the n available observations

zt

,...

2 , 1 /

ˆkCk C0 k

) )(

(

1

z z

z z

C t j

j n

t t

j   

z

(88)

Specification

• Properties:

• 1.For stationary models,

• 2. When there exists a unit root in the AR polynomial

k n

k

ˆ

(89)

Specification

• If the SACF of the original series is

persistently close to 1 as k increases, one forms the first difference , , and studies its SACF to determine whether further

differencing is called for.

zt

(90)

Specification

• Once stationary is achieved, a cutting off

pattern after, say a lag “q”, in the SACF will then lead to tentative specification of a

MA(q) model.

(91)

Specification

• The Sample Partial Autocorrelation Function:

• Are obtained by replacing the in

• by their sample estimates ,...

2 , ˆk k  1

k





 1 /

1 )

(

k G

H

k k

k k

k

ˆk

(92)

Specification Properties:

• 1.For stationary models,

• 2. The are asymptotically normally distributed

• 3. For a stationary AR(p) model

k n

k

ˆ

ˆk

1

(93)

Specification

• Properties 1, 2 and 3 make SPACF a

convenient tool for specifying the order or a stationary AR model (cutting off pattern

after lag p)

• Not valid for non-stationary models.

(94)

Specification Weakness of the SACF and SPACF.

1. Subjective judgment is often required to decide on the order of differencing.

2. For stationary ARMA models, both SACF and SPACF tend to exhibit a gradual

“tapering off” behavior, making the specification very difficult.

(95)

Specification Diagnostic Tools

• The program (TRAMO), in an automatic way, specifies a set of possible models,

estimate them and select the best one based on AIC and BIC criteria.

• IMPOSSIBLE 10-15 years before

Referencias

Documento similar