40
Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019

FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Intro to time series analysisFISH 507 – Applied Time Series Analysis

Mark Scheuerell

8 Jan 2019

Page 2: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Topics for today

Characteristics of time series (ts)

Classical decomposition

What is a ts?

Classifying ts

Trends

Seasonality (periodicity)

·

·

·

·

2/40

Page 3: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

What is a time series?

A set of observations taken sequentially in time

3/40

Page 4: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

What is a time series?

A ts can be represented as a set

For example,

4/40

Page 5: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

5/40

Page 6: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classification of time seriesBy some index set

Interval across real time;

begin/end: ·

6/40

Page 7: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classification of time seriesBy some index set

Discrete time;

Equally spaced:

Equally spaced w/ missing value:

Unequally spaced:

·

·

·

7/40

Page 8: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classification of time seriesBy the underlying process

Discrete (eg, total # of fish caught per trawl)

Continuous (eg, salinity, temperature)

8/40

Page 9: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classification of time seriesBy the number of values recorded

Univariate/scalar (eg, total # of fish caught)

Multivariate/vector (eg, # of each spp of fish caught)

9/40

Page 10: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classification of time seriesBy the type of values recorded

Integer (eg, # of fish in 5 min trawl = 2413)

Rational (eg, fraction of unclipped fish = 47/951)

Real (eg, fish mass = 10.2 g)

Complex (eg, cos(2π2.43) + i sin(2π2.43))

10/40

Page 11: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Statistical analyses of time series

Most statistical analyses are concerned with estimating properties of apopulation from a sample

For example, we use fish caught in a seine to infer the mean size of fishin a lake

11/40

Page 12: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Statistical analyses of time series

Time series analysis, however, presents a different situation:

Although we could vary the length of an observed time series, it isoften impossible to make multiple observations at a given point intime

·

12/40

Page 13: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Statistical analyses of time series

Time series analysis, however, presents a different situation:

For example, one can’t observe today’s closing price of Microsoft stockmore than once

Thus, conventional statistical procedures, based on large sampleestimates, are inappropriate

Although we could vary the length of an observed time series, it isoften impossible to make multiple observations at a given point intime

·

13/40

Page 14: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Descriptions of time series

Number of users connected to the internet

14/40

Page 15: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Descriptions of time series

Number of lynx trapped in Canada from 1821-1934

15/40

Page 16: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

What is a time series model?

A time series model for is a specification of the joint distributions ofa sequence of random variables , of which is thought to be arealization

16/40

Page 17: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Joint distributions of random variables

17/40

Page 18: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

We have one realization

18/40

Page 19: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Some simple time series models

White noise:

19/40

Page 20: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Some simple time series models

Random walk:

20/40

Page 21: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition

Model time series as a combination of

1. trend ( )

2. seasonal component ( )

3. remainder ( )

21/40

Page 22: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition1. The trend ( )

We need a way to extract the so-called signal

One common method is via "linear filters"

22/40

Page 23: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition1. The trend ( )

For example, a moving average

If , then

23/40

Page 24: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Example of linear filtering

Monthly airline passengers from 1949-1960

24/40

Page 25: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Example of linear filtering

Monthly airline passengers from 1949-1960

25/40

Page 26: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Example of linear filtering

Monthly airline passengers from 1949-1960

26/40

Page 27: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Example of linear filtering

Monthly airline passengers from 1949-1960

27/40

Page 28: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition2. Seasonal effect ( )

Once we have an estimate of the trend , we can estimate simply bysubtraction:

28/40

Page 29: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition

Seasonal effect ( ), assuming

29/40

Page 30: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition

But, includes the remainder as well

30/40

Page 31: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Mean seasonal effect ( )

31/40

Page 32: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Classical decomposition3. Remainder ( )

Now we can estimate via subtraction:

32/40

Page 33: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Remainder ( )

33/40

Page 34: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Let's try a different modelWith some other assumptions

1. Log-transform data

2. Linear trend

34/40

Page 35: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Log-transformed data

Monthly airline passengers from 1949-1960

35/40

Page 36: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

The trend ( )

36/40

Page 37: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Seasonal effect ( ) with error ( )

37/40

Page 38: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Mean seasonal effect ( )

38/40

Page 39: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

Remainder ( )

39/40

Page 40: FISH 507 – Applied Time Series Analysis 1... · 2020. 5. 21. · Intro to time series analysis FISH 507 – Applied Time Series Analysis Mark Scheuerell 8 Jan 2019. Topics for today

SummaryToday's topics

Characteristics of time series (ts)

Classical decomposition

What is a ts?

Classifying ts

Trends

Seasonality (periodicity)

·

·

·

·

40/40