econometría 2: análisis de series de tiempo · 2016-08-11 · modelos de series de tiempo...

60
Econometr´ ıa 2: An´ alisis de series de Tiempo Karoll GOMEZ [email protected] http://karollgomez.wordpress.com Primer semestre 2016

Upload: trandien

Post on 28-Aug-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

Econometrıa 2: Analisis de series de Tiempo

Karoll [email protected]

http://karollgomez.wordpress.com

Primer semestre 2016

I. Introduction

Modelos de series de tiempo

Content:

1. General overview

2. Times-Series vs Cross-section data

3. Time series components

4. How to deal with trend and seasonal components?

5. Stationarity concept

Modelos de series de tiempoIntroduction: Definition

I. Overview:

I A time series is a set of observations Xt (or denoted by Yt),each one being recorded at a specific time t with 0 < t < T .

I Time series analysis refers to the branch of statistic whereobservation are collected sequentially in time, usually but nonecessarily at equally spaced time points.

Modelos de series de tiempoIntroduction: Data

Modelos de series de tiempoIntroduction: Data

Modelos de series de tiempoIntroduction: Goals

Modelos de series de tiempoIntroduction: The importance of forecasting

Modelos de series de tiempoIntroduction: Times-Series in Economics

Macro vs Financial Time series

I Macro limited by small number of observations available overlong horizon. A typical data set has at best 20 years ofmonthly or 40 years of quarterly data, which sum up to lessthan 300 observations. This allows us to study linear relationsbetween variables or model means.

I Macro Time series mostly focuses on means

I Financial data usually high-frequency over short period oftime. This allows us to model volatility and higher moments.Examples: stock prices.

I Financial data mostly focuses on variances and highermoments.

Modelos de series de tiempoIntroduction: Examples

Modelos de series de tiempoIntroduction: Examples

Modelos de series de tiempoIntroduction: Examples

Modelos de series de tiempoIntroduction: Examples

Modelos de series de tiempoIntroduction: Examples

Modelos de series de tiempoIntroduction: Times-Series vs Cross-section

II. Times-Series vs Cross-section data

I The main difference between time series and cross-sectiondata is in dependence structure.

I Cross-section econometrics mainly deals with i.i.d.observations, while in time series each new arrivingobservation is stochastically depending on the previouslyobserved.

I The dependence is our best friend and a great enemy.I On one side, the dependence screw up your inferences: the

Central Limit Theorem should be corrected to hold fordependent observations. That bring us to the task ofcorrecting our procedures for dependence.

I On the other side, the dependence allow us to do more byexploiting it. For example, we can make forecasts (which arealmost non-sense in cross-section).

Modelos de series de tiempoIntroduction: iid vs no-iid data

Modelos de series de tiempoIntroduccion: iid vs no-iid data

I Then if the underlying common probability model for the X’sis N(µ, σ2) the sample mean and the sample variance areindependently distributed.

Question:What can one expect regarding the status of independence ordependence between sample mean and sample variance when therandom variables X’s are allowed to be non-iid or non-normal?

Answer:The sample mean and the variance may or may not followindependent probability models !

Modelos de series de tiempoIntroduccion: Consequences no-iid data

The main consequences of long-range correlations in supposedlyi.i.d. data are:

I The effects are mild for point estimation,

I but drastic for standard errors, confidence intervals and testsfor not very small samples, and they increase exponentiallywith the size of the data set.

Typical example:The true variance of the arithmetic mean of 130 observations caneasily be 20 times the variance derived under the independenceassumption.

Modelos de series de tiempoIntroduction: Time series Plot

Times-Series components (types of dynamic variation)

Modelos de series de tiempoIntroduction: Types of variation

Are the series completely random?

Modelos de series de tiempoIntroduction: types of variation

Modelos de series de tiempo

Modelos de series de tiempoIntroduction: types of variation

Modelos de series de tiempoIntroduction: Types of variation

Trend Component

Modelos de series de tiempoIntroduction: Types of variation

Sesonal Component

Modelos de series de tiempoIntroduction: Types of variation

Cyclical Component

Modelos de series de tiempoIntroduction: Types of variation

Irregular Component

Modelos de series de tiempoIntroduction: Types of variation

Modelos de series de tiempoIntroduction: Types of variation

Modelos de series de tiempoIntroduction: Types of variation

Modelos de series de tiempoIntroduction: Types of variation

How to deal with trend and seasonal components?

A. Time series with a trend component:curve Fitting, Filtering and differencing methods.

B. Time series with a seasonal component:Seasonal filtering and Seasonal differencing methods

Modelos de series de tiempoIntroduction: Time series with trend

A. Time series with a trend component

There are two types of trends:

I Deterministic

I Stochastic

A trending mean is a common violation of stationarity.

Modelos de series de tiempoIntroduction: Stochastic vs determisnistic

There are two popular models for nonstationary series with atrending mean:

1. Trend stationary:The mean trend is deterministic.Once the trend is estimated and removed from the data, theresidual series is a stationary stochastic process.

2. Difference stationary:The mean trend is stochastic.Differencing the series one or several times yields a stationarystochastic process.

Modelos de series de tiempoIntroduction: Trend features

The distinction between a deterministic and stochastic trend hasimportant implications for the long-term behavior of a process:

* Time series with a deterministic trend always revert to thetrend in the long run (the effects of shocks are eventuallyeliminated). Forecast intervals have constant width.

** Time series with a stochastic trend never recover from shocksto the system (the effects of shocks are permanent)

Modelos de series de tiempoIntroduction: Deterministic and Stochastic component of a trend

Example:

Considering the following process (Random walk plus drift):

Xt = Xt−1 + α + εt

The solution is given by:

Xt = X0 + αt +T∑t=1

εt

where X0 is an initial value, and the average behavior of Xt in thelong-run will be determined by the parameter α, which is the(unconditional) expected change in Xt .

Modelos de series de tiempoIntroduction: Deterministic vs Stochastic Trends

We see that the random walk with drift has a trend, which includesa stochastic and deterministic component (that can account for atime series tendency to increase on average over time).

1 Deterministic part: series always changes by the same fixedamount from one period to the next.

E [Xt ] = X0 + αt

2 Stochastic part: series changes from one period to the next istotally stochastic.

E [Xt ] = X0 +T∑t=1

εt

Modelos de series de tiempoIntroduction: Transitory vs Permanent effect of a trend

What happend when a εt shock occurs?

1 Deterministic part:

E [Xt ] = X0 + αt

which means Xt will exhibit only temporary departures from thetrend when a εt shock occurs.

2 Stochastic part:

E [Xt ] = X0 +T∑t=1

εt

which means Xt will exhibit permanent departures from the trendwhen a εt shock occurs.

Modelos de series de tiempoIntroduction: Deterministic vs Stochastic Trends

The appropriate way to remove the trend components is thefollowing (necessary to attained a stationary series):

I Deterministic trend: Detrending (Curve-fitting or Filtering)

II Stochastic trend: Differentiation

Modelos de series de tiempoIntroduction: Time series with trend

I. Deterministc trend

Modelos de series de tiempoIntroduction: Time series with trend

Modelos de series de tiempoIntroduction: Time series with trend

Modelos de series de tiempoIntroduction: Curve fitting method

Modelos de series de tiempoIntroduction: Smoothing methods

Modelos de series de tiempoIntroduction: Smoothing methods

Modelos de series de tiempoIntroduction: Smoothing methods

Modelos de series de tiempoIntroduction: Differencing method

II. Stochastic trend

Modelos de series de tiempoIntroduction: Modeling Seasonal variation

B. Time series with a seasonal component

Modelos de series de tiempoIntroduction: Modeling Seasonal variation

Modelos de series de tiempoIntroduction: Eliminating seasonal variation

Modelos de series de tiempoIntroduction: Modeling Seasonal variation

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

Stationarity in Time Series:

I A key idea in time series is that of stationarity.

I Roughly speaking, a time series is stationary if its behaviordoes not change over time.

I This means, for example, that the values always tend to varyabout the same level and that their variability is constant overtime.

I Obviously, not all time series are stationary. Indeed,non-stationary series tend to be the rule rather than theexception.

I However, some time series are related in simple ways tomodels which are stationary. Two important examples of thisare:

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

Are always those models a valid representation of trending timeseries?Answer: NO !

Why might the trend model not be a valid representation ?

I The trend and cyclical components of the time series mightnot be determined independently of one another.

I For instance, technology shocks might affect both the cyclicaland trend behavior of the series.

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

What about integrated models?

I The Integrated model ( or random walk model) has astochastic trend and may be a good starting point fordescribing the way many financial market prices and returnsseem to behave.

I However, realizations of random walks will not usually becharacterized by the tendency to grow over time that is soapparent in many macroeconomic time series.

I That is, the stochastic trend in the random walk is notsufficient to explain the kind of trend behavior we observe inthe typical macroeconomic time series.

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

I The general pattern of this data does not change over time soit can be regarded as stationary

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

I There is a steady long-term increase in the yields.

I Over the period of observation a trend-plus-stationary seriesmodel looks like it might be appropriate.

I An integrated stationary series is another possibility (if trendis stochastic instead of deterministic).

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

I There is clearly a strong seasonal effect on top of a generalupward trend.

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

In summary:

We know there are differences in the dynamic behavior of times series:the nature of the trend, the long-run behavior, and seasonal and/orcomponents.

In fact, there are different approaches to modeling trends in time series.

Which process will be a valid representation of a trending time series ?and How should we choose?

I It will not be obvious just by looking at the data. Time series plothelps but it is not enough !

I Does one or the other seem more plausible based on the economictheory (if there is any) that underlies the econometric model?

I How to apply formal tests to help select the appropriate form of themodel ?

Modelos de series de tiempoIntroduction: Stationary vs Non-stationary series

Objectives of this course:

I Description - summary statistics, graphs.

I Analysis and interpretation - find a model to describe the timedependence in the data, can we interpret the model?

I Forecasting or prediction - given a sample from the series,forecast the next value, or the next few values

Modelos de series de tiempoExercise in R

Exercise 1 in RWe are going to analyze three time series:

1. Age of Death of Successive Kings of England

2. The number of births per month in New York city, fromJanuary 1946 to December 1959

3. The monthly sales for a souvenir shop at a beach resort townin Queensland, Australia, for January 1987-December 1993.

Goals:

I Plot and to do a basic statistical analysis of the series

I Identify what components are presents in the series

I Decompose a time series into different components andinterpret the results