the measures msd , mad and mape :

30
n is the number of time points, where both the original observation y t and the predicted observation exist The measures MSD, MAD and MAPE: n t t t y y n MSD 1 2 ˆ 1 Mean Squared Deviation Comparable with MSE in regression models, but its value has another scale than the observations t y ˆ n t t t y y n MAD 1 ˆ 1 Mean Absolute Deviation Comparable with the square root of MSE, but less sensible to outliers. Has the same scale as the observations. 100 ˆ 1 1 n t t t t y y y n MAPE Mean Absolute Percentage Error Expresses the mean absolute deviation in percentages of the level. Suitable for multiplicative models.

Upload: zazu

Post on 20-Jan-2016

94 views

Category:

Documents


0 download

DESCRIPTION

The measures MSD , MAD and MAPE :. M ean S quared D eviation Comparable with MSE in regression models, but its value has another scale than the observations. M ean A bsolute D eviation - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The measures  MSD ,  MAD  and  MAPE :

n is the number of time points, where both the original observation yt and the predicted observation exist

The measures MSD, MAD and MAPE:

n

ttt yy

nMSD

1

2ˆ1 Mean Squared Deviation

Comparable with MSE in regression models, but its value has another scale than the observations

ty

n

ttt yy

nMAD

1

ˆ1 Mean Absolute Deviation

Comparable with the square root of MSE, but less sensible to outliers. Has the same scale as the observations.

100ˆ1

1

n

t t

tt

y

yy

nMAPE

Mean Absolute Percentage Error

Expresses the mean absolute deviation in percentages of the level. Suitable for multiplicative models.

Page 2: The measures  MSD ,  MAD  and  MAPE :

Modern methods

The classical approach:

Method Pros Cons

Time series regression • Easy to implement

• Fairly easy to interpret

• Covariates may be added (normalization)

• Inference is possible (though sometimes questionable)

• Static

• Normal-based inference not generally reliable

• Cyclic component hard to estimate

Decomposition • Easy to interpret

• Possible to have dynamic seasonal effects

• Cyclic components can be estimated

• Descriptive (no inference per def)

• Static in trend

Page 3: The measures  MSD ,  MAD  and  MAPE :

Explanation to the static behaviour:

The classical approach assumes all components except the irregular ones (i.e. t and IRt ) to be deterministic, i.e. fixed functions or constants

To overcome this problem, all components should be allowed to be stochastic, i.e. be random variates.

A time series yt should from a statistical point of view be treated as a stochastic process.

We will interchangeably use the terms time series and process depending on the situation.

Page 4: The measures  MSD ,  MAD  and  MAPE :

Stationary and non-stationary time series

20

10

0

100908070605040302010

Stationary

Index

3000

2000

1000

0

300200100

Non-stationary

Index

Characteristics for a stationary time series:

• Constant mean

• Constant variance

A time series with trend is non-stationary!

Page 5: The measures  MSD ,  MAD  and  MAPE :

Auto Regressive,

Integrated,

Moving Average

Box-Jenkins models

A stationary times series can be modelled on basis of the serial correlations in it.

A non-stationary time series can be transformed into a stationary time series, modelled and back-transformed to original scale (e.g. for purposes of forecasting)

ARIMA – models

These parts can be modelled on a stationary series

This part has to do with the transformation

Page 6: The measures  MSD ,  MAD  and  MAPE :

Different types of transformation

1. From a series with linear trend to a series with no trend:

First-order differences zt = yt – yt – 1

MTB > diff c1 c2

Page 7: The measures  MSD ,  MAD  and  MAPE :

Note that the differences series varies around zero.

20

15

10

5

0

linear trendno trend

Variable

Page 8: The measures  MSD ,  MAD  and  MAPE :

2. From a series with quadratic trend to a series with no trend:

Second-order differences

wt = zt – zt – 1 = (yt – yt – 1) – (yt – 1 – yt – 2) = yt – 2yt – 1 + yt – 2

MTB > diff 2 c3 c4

Page 9: The measures  MSD ,  MAD  and  MAPE :

20

15

10

5

0

quadratic trendno trend 2

Variable

Page 10: The measures  MSD ,  MAD  and  MAPE :

3. From a series with non-constant variance (heteroscedastic) to a series with constant variance (homoscedastic):

Box-Cox transformations (per def 1964)

Practically is chosen so that yt + is always > 0

Simpler form: If we know that yt is always > 0 (as is the usual case for measurements)

0 and 0for ln

0 and 0for 1

tt

tt

t

yy

yy

yg

asticity heterosced extreme if1

asticity heteroscedheavy if1

asticity heterosced pronounced ifln

- " -

asticity heteroscedmodest if4

t

t

t

t

t

t

y

y

y

y

y

yg

Page 11: The measures  MSD ,  MAD  and  MAPE :

The log transform (ln yt ) usually also makes the data ”more” normally distributed

Example: Application of root (yt ) and log (ln yt ) transforms

25

20

15

10

5

0

originalrootlog

Variable

Page 12: The measures  MSD ,  MAD  and  MAPE :

AR-models (for stationary time series)

Consider the model

yt = δ + ·yt –1 + at

with {at } i.i.d with zero mean and constant variance = σ2

and where δ (delta) and (phi) are (unknown) parameters

Set δ = 0 by sake of simplicity E(yt ) = 0

Let R(k) = Cov(yt,yt-k ) = Cov(yt,yt+k ) = E(yt ·yt-k ) = E(yt ·yt+k )

R(0) = Var(yt) assumed to be constant

Page 13: The measures  MSD ,  MAD  and  MAPE :

Now:

R(0) = E(yt ·yt ) = E(yt ·( ·yt-1 + at ) = · E(yt ·yt-1 ) + E(yt ·at ) =

= ·R(1) + E(( ·yt-1 + at ) ·at ) = ·R(1) + · E(yt-1 ·at ) + E(at ·at )=

= ·R(1) + 0 + σ2 (for at is independent of yt-1 )

R(1) = E(yt ·yt+1 ) = E(yt ·( ·yt + at+1 ) = · E(yt ·yt ) + E(yt ·at+1 ) =

= ·R(0) + 0 (for at+1 is independent of yt )

R(2) = E(yt ·yt+2 ) = E(yt ·( ·yt+1 + at+2 ) = · E(yt ·yt+1 ) +

+ E(yt ·at+2 ) = ·R(1) + 0 (for at+1 is independent of yt )

Page 14: The measures  MSD ,  MAD  and  MAPE :

R(0) = ·R(1) + σ2

R(1) = ·R(0) Yule-Walker equations

R(2) = ·R(1)

R(k ) = ·R(k – 1) =…= k·R(0)

R(0) = 2 ·R(0) + σ2

2

2

1)0(

R

Page 15: The measures  MSD ,  MAD  and  MAPE :

Note that for R(0) to become positive and finite (which we require from a variance) the following must hold:

112

This in effect the condition for an AR(1)-process to be weakly stationary

Note now that

)0()(

)0()0(

)(

)()(

),(),(

RkR

RR

kR

yVaryVar

yyCovyyCorr

ktt

kttkktt

kk

k R

R

)0(

)0(

Page 16: The measures  MSD ,  MAD  and  MAPE :

ρk is called the Autocorrelation function (ACF) of yt

”Auto” because it gives correlations within the same time series.

For pairs of different time series one can define the Cross correlation function which gives correlations at different lags between series.

By studying the ACF it might be possible to identify the approximate magnitude of

Page 17: The measures  MSD ,  MAD  and  MAPE :

Examples: ACF for AR(1), phi=0.1

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

k

ACF for AR(1), phi=0.3

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

k

Page 18: The measures  MSD ,  MAD  and  MAPE :

ACF for AR(1), phi=0.5

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF for AR(1), phi=0.8

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF for AR(1), phi=0.99

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Page 19: The measures  MSD ,  MAD  and  MAPE :

ACF for AR(1), phi=-0.1

-1

-0.8

-0.6

-0.4

-0.2

0

0.2

0.4

0.6

0.8

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF for AR(1), phi=-0.5

-1-0.8-0.6-0.4-0.20

0.20.40.60.81

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF for AR(1), phi=-0.8

-1-0.8-0.6-0.4-0.20

0.20.40.60.81

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Page 20: The measures  MSD ,  MAD  and  MAPE :

The look of an ACF can be similar for different kinds of time series, e.g. the ACF for an AR(1) with = 0.3 could be approximately the same as the ACF for an Auto-regressive time series of higher order than 1 (we will discuss higher order AR-models later)

To do a less ambiguous identification we need another statistic:

The Partial Autocorrelation function (PACF):

υk = Corr (yt ,yt-k | yt-k+1, yt-k+2 ,…, yt-1 )

i.e. the conditional correlation between yt and yt-k given all observations in-between.

Note that –1 υk 1

Page 21: The measures  MSD ,  MAD  and  MAPE :

A concept sometimes hard to interpret, but it can be shown that

for AR(1)-models with positive the look of the PACF is

and for AR(1)-models with negative the look of the PACF is

0.00

1.00

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

k

-1

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

k

Page 22: The measures  MSD ,  MAD  and  MAPE :

Assume now that we have a sample y1, y2,…, yn from a time series assumed to follow an AR(1)-model.

Example:

Monthly exchange rates DKK/USD 1991-1998

0

2

4

6

8

10

Page 23: The measures  MSD ,  MAD  and  MAPE :

The ACF and the PACF can be estimated from data by their sample counterparts:

Sample Autocorrelation function (SAC):

if n large, otherwise a scaling

might be needed

Sample Partial Autocorrelation function (SPAC)

Complicated structure, so not shown here

n

tt

kt

kn

tt

k

yy

yyyyr

1

2

1

)(

))((

Page 24: The measures  MSD ,  MAD  and  MAPE :

The variance function of these two estimators can also be estimated

Opportunity to test

H0: k = 0 vs. Ha: k 0

or

H0: k = 0 vs. Ha: k 0

for a particular value of k.

Estimated sample functions are usually plotted together with critical limits based on estimated variances.

Page 25: The measures  MSD ,  MAD  and  MAPE :

Example (cont) DKK/USD exchange:

SAC:

SPAC: Critical limits

Page 26: The measures  MSD ,  MAD  and  MAPE :

Ignoring all bars within the red limits, we would identify the series as being an AR(1) with positive .

The value of is approximately 0.9 (ordinate of first bar in SAC plot and in SPAC plot)

Page 27: The measures  MSD ,  MAD  and  MAPE :

Higher-order AR-models

AR(2): or

yt-2 must be present

AR(3):

or other combinations with 3 yt-3

AR(p):

i.e. different combinations with p yt-p

tttt ayyy 2211

ttt ayy 22

ttttt ayyyy 332211

tptptt ayyy ...11

Page 28: The measures  MSD ,  MAD  and  MAPE :

Stationarity conditions:

For p > 2, difficult to express on closed form.

For p = 2:

The values of 1 and 2 must lie within the blue triangle in the figure below:

tttt ayyy 2211

Page 29: The measures  MSD ,  MAD  and  MAPE :

Typical patterns of ACF and PACF functions for higher order stationary AR-models (AR( p )):

ACF: Similar pattern as for AR(1), i.e. (exponentially) decreasing

bars, (most often) positive for 1 positive and alternating for 1 negative.

PACF: The first p values of k are non-zero with decreasing

magnitude. The rest are all zero (cut-off point at p )

(Most often) all positive if 1 positive and alternating if 1 negative

Page 30: The measures  MSD ,  MAD  and  MAPE :

Examples:

AR(2), 1 positive:

AR(5), 1 negative:

PACF

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

PACF

-1

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

ACF

-1

0

1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15