70
Intro to ARMA models FISH 507 – Applied Time Series Analysis Mark Scheuerell 15 Jan 2019

Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

  • Upload
    others

  • View
    15

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Intro to ARMA modelsFISH 507 – Applied Time Series Analysis

Mark Scheuerell

15 Jan 2019

Page 2: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Topics for today

Review

Autoregressive (AR) models

Moving average (MA) models

Autoregressive moving average (ARMA) models

Using ACF & PACF for model ID

White noise

Random walks

·

·

2/70

Page 3: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

White noise (WN)

A time series is discrete white noise if its values are

The distributional form for is flexible

1. independent

2. identically distributed with a mean of zero

3/70

Page 4: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

White noise (WN)

4/70

Page 5: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Gaussian white noise

We often assume so-called Gaussian white noise, whereby

and the following apply as well

    autocovariance: 

    autocorrelation:  

5/70

Page 6: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Gaussian white noise

6/70

Page 7: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Random walk (RW)

A time series is a random walk if

1.

2. is white noise

7/70

Page 8: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Random walk (RW)

8/70

Page 9: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Biased random walk

A biased random walk (or random walk with drift) is written as

where is the bias (drift) per time step and is white noise

9/70

Page 10: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Biased random walk

10/70

Page 11: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Differencing a biased random walk

First-differencing a biased random walk yields a constant mean (level) plus white noise

11/70

Page 12: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Differencing a biased random walk

12/70

Page 13: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

LINEAR STATIONARY MODELS

13/70

Page 14: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Linear stationary models

We saw last week that linear filters are a useful way of modeling timeseries

Here we extend those ideas to a general class of models callautoregressive moving average (ARMA) models

14/70

Page 15: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autoregressive (AR) models

Autoregressive models are widely used in ecology to treat a currentstate of nature as a function its past state(s)

15/70

Page 16: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autoregressive (AR) models

An autoregressive model of order p, or AR(p), is defined as

where we assume

1. is white noise

2. for an order-p process

16/70

Page 17: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Examples of AR(p) models

AR(1)

AR(1) with (random walk)

AR(2)

17/70

Page 18: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Examples of AR(p) models

18/70

Page 19: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

Recall that stationary processes have the following properties

We seek a means for identifying whether our AR(p) models are alsostationary

1. no systematic change in the mean or variance

2. no systematic trend

3. no periodic variations or seasonality

19/70

Page 20: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

We can write out an AR(p) model using the backshift operator

20/70

Page 21: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

If we treat as a number (or numbers), we can out write thecharacteristic equation as

To be stationary, all roots of the characteristic equation must exceed 1in absolute value

21/70

Page 22: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

For example, consider this AR(1) model from earlier

22/70

Page 23: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

For example, consider this AR(1) model from earlier

This model is indeed stationary because

23/70

Page 24: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

What about this AR(2) model from earlier?

24/70

Page 25: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(p) models

What about this AR(2) model from earlier?

This model is not stationary because only one

25/70

Page 26: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

What about random walks?

Consider our random walk model

26/70

Page 27: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

What about random walks?

Consider our random walk model

Random walks are not stationary because

27/70

Page 28: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(1) models

We can define a space over which all AR(1) models are stationary

28/70

Page 29: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(1) models

For , we have

29/70

Page 30: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(1) models

For , we have

For , we have

30/70

Page 31: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Stationary AR(1) models

Thus, AR(1) models are stationary if and only if

31/70

Page 32: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Coefficients of AR(1) models

Same value, but different sign

32/70

Page 33: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Coefficients of AR(1) models

Both positive, but different magnitude

33/70

Page 34: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autocorrelation function (ACF)

Recall that the autocorrelation function ( ) measures the correlationbetween and a shifted version of itself

34/70

Page 35: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF for AR(1) models

ACF oscillates for model with

35/70

Page 36: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF for AR(1) models

For model with large , ACF has longer tail

36/70

Page 37: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Partial autocorrelation funcion (PACF)

Recall that the partial autocorrelation function ( ) measures thecorrelation between and a shifted version of itself , with thelinear dependence of removed

37/70

Page 38: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF & PACF for AR(p) models

38/70

Page 39: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

PACF for AR(p) models

Do you see the link between the order p and lag k?

39/70

Page 40: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Using ACF & PACF for model ID

Model ACF PACF

AR(p) Tails off slowly Cuts off after lag p

40/70

Page 41: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Moving average (MA) models

Moving average models are most commonly used for forecasting afuture state

41/70

Page 42: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Moving average (MA) models

A moving average model of order q, or MA(q), is defined as

where is white noise

Each of the is a sum of the most recent error terms

42/70

Page 43: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Moving average (MA) models

A moving average model of order q, or MA(q), is defined as

where is white noise

Each of the is a sum of the most recent error terms

Thus, all MA processes are stationary because they are finite sums ofstationary WN processes

43/70

Page 44: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Examples of MA(q) models

44/70

Page 45: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Examples of MA(q) models

45/70

Page 46: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

AR(p) model as an MA( ) model

It is possible to write an AR(p) model as an MA( ) model

46/70

Page 47: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

AR(1) model as an MA( ) model

For example, consider an AR(1) model

47/70

Page 48: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

AR(1) model as an MA( ) model

If our AR(1) model is stationary, then

so

48/70

Page 49: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Invertible MA(q) models

An MA(q) process is invertible if it can be written as a stationaryautoregressive process of infinite order without an error term

49/70

Page 50: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Invertible MA(1) model

For example, consider an MA(1) model

50/70

Page 51: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Invertible MA(1) model

If we constrain , then

and

51/70

Page 52: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Invertible MA(q) models

Q: Why do we care if an MA(q) model is invertible?

A: It helps us identify the model's parameters

52/70

Page 53: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Invertible MA(q) models

For example, these MA(1) models are equivalent

53/70

Page 54: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF & PACF for MA(q) models

54/70

Page 55: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF for MA(q) models

Do you see the link between the order q and lag k?

55/70

Page 56: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Using ACF & PACF for model ID

Model ACF PACF

AR(p) Tails off slowly Cuts off after lag p

MA(q) Cuts off after lag q Tails off slowly

56/70

Page 57: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Using ACF & PACF for model ID

57/70

Page 58: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autoregressive moving average models

An autoregressive moving average, or ARMA(p,q), model is written as

58/70

Page 59: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autoregressive moving average models

We can write an ARMA(p,q) model using the backshift operator

ARMA models are stationary if all roots of

ARMA models are invertible if all roots of

59/70

Page 60: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Examples of ARMA(p,q) models

60/70

Page 61: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ACF for ARMA(p,q) models

61/70

Page 62: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

PACF for ARMA(p,q) models

62/70

Page 63: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Using ACF & PACF for model ID

Model ACF PACF

AR(p) Tails off slowly Cuts off after lag p

MA(q) Cuts off after lag q Tails off slowly

ARMA(p,q) Tails off slowly Tails off slowly

63/70

Page 64: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

NONSTATIONARY MODELS

64/70

Page 65: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Autoregressive integrated moving average(ARIMA) models

If the data do not appear stationary, differencing can help

This leads to the class of autoregressive integrated moving average(ARIMA) models

ARIMA models are indexed with orders (p,d,q) where d indicates theorder of differencing

65/70

Page 66: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ARIMA(p,d,q) models

For , is an ARIMA(p,d,q) process if is an ARMA(p,q)process

66/70

Page 67: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ARIMA(p,d,q) models

For , is an ARIMA(p,d,q) process if is an ARMA(p,q)process

For example, if is an ARIMA(1,1,0) process then is anARMA(1,0) = AR(1) process

67/70

Page 68: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ARIMA(p,d,q) models

68/70

Page 69: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

ARIMA(p,d,q) models

69/70

Page 70: Intro to ARMA models - GitHub Pages 2/lec_03_ARMA... · Autoregressive integrated moving average (ARIMA) models If the data do not appear stationary, differencing can help This leads

Topics for today

Review

Autoregressive (AR) models

Moving average (MA) models

Autoregressive moving average (ARMA) models

Using ACF & PACF for model ID

White noise

Random walks

·

·

70/70