0% found this document useful (0 votes)
9 views16 pages

Lecture1 2

The document introduces time series data, which consists of observations collected over time at regular intervals, and outlines its components including trend, seasonal, and random variations. It emphasizes the importance of time series analysis for forecasting future values based on historical patterns. Various graphical tools and methodologies are discussed for examining and interpreting time series data effectively.

Uploaded by

yuhulane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views16 pages

Lecture1 2

The document introduces time series data, which consists of observations collected over time at regular intervals, and outlines its components including trend, seasonal, and random variations. It emphasizes the importance of time series analysis for forecasting future values based on historical patterns. Various graphical tools and methodologies are discussed for examining and interpreting time series data effectively.

Uploaded by

yuhulane
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

An example of time series data:

Introduction to time series data


EQC7006 / AA037007 Time series data:
A sequence of observations taken over time
Time Series Analysis (usually equally spaced), Y1, Y2, Y3, …., Yn or
Yt with t =1, 2, 3,…, n. {where n = sample size}.
Lecture 1 • Time interval: yearly, monthly, quarterly,
weekly, daily, hourly, etc…
Introduction to time series data, • Time is continuous, but data are usually
tools for examining time series & reported/collected at discrete points in time.
measuring forecasting accuracy.
2 3

Objectives of time series analysis: Decomposition of additive tim


• Trend component is a long term pattern or
360

1. Compact description of data.


direction (up or down) in a time series.
observed
340

Example: classical decomposition.


• A cycle is a wave-like pattern about a long-
360 320

The general mathematical representation of the term trend.


340

trend

decomposition approach is: • Seasonal component is a “saw tooth” pattern


that repeats itself in systematic intervals over
1 2 3 320

Yt = f(Tt, St, Et)


seasonal
-1

time.
where;
-3

• Random (irregular) component is the


0.5

Yt = the time series value (actual value),


random

component that accounts for everything not


-0.5 0.0

Tt = the trend-cycle component, covered by any of the other components


1960 1970 1980 1990
St = the seasonal component, (trend/cycle/seasonal). Random variation
Time
Et = the irregular (remainder/random). 4 cannot be predicted. 5 6
Decomposition of additive ti

90
Objectives of time series analysis: Overview of Forecasting

70

observed
50
2. Forecasting

30
• Forecasting situations vary widely in their

60
By evaluating underlying characteristics of – time horizons

50

trend
the series, we are able to say something

40
– factors determining actual outcomes

30
10
(predict) the future values of the series. – types of data patterns

5
0

seasonal
– many other aspects

-10 -5
10
• We will examine four variables for which

random
forecasts may be required

-10 0
1975 1980 1985 1990 1995

Time
7 8 9

Overview of Forecasting
• Observe
Overview of Forecasting Overview of Forecasting
1. Monthly Australian – Increasing trend 2. Treasury Bill contracts on the Chicago market
electricity production from – Increasing variation each year for 100 successive days 3. Sales of “product C” from a major oil company
March 1956 to August 1995 – Strong seasonal pattern that is • Product is a lubricant
slowing changing in shape • Observe the downward sold only in units of
• The strong historical trend
14000 12 large volume
patterns make this variable 92 10
10000 an easy one to forecast. • It may only be a short 8
90 downward movement in • To forecast such a
6
6000 • Because of the changing
88 the middle of a highly 4 variable

million kwh
units sold

2000 seasonal patterns, some of variable series of 2


the early data may not be 86 – necessary to
0

millions units
observations investigate the
useful in constructing a 84 1 11 21 31
nature of the product

Mar-56
Mar-60
Mar-64
Mar-68
Mar-72
Mar-76
Mar-80
Mar-84
Mar-88
Mar-92
model 1 11 21 31 41 51 61 71 81 91 • The question is whether Month
market
month • Forecasts are important for Day the downward trend is
志㦇㞆㩕䴻☯ⳃ楮慺⛳瑃㿡㊑⠇❈⛔⚛瑃⌝⟹∸≢
• who is buying it
– future planning of electricity likely to continue 揈䷎⋽⌝ⵊ⿛斾➆⎅棯⥛䪈䆷䋞䃋瑃櫭嵲
㍗㋃ⵊ≌㍿㐝匑㕾⠇❈䪈⾅噼㑃㸴㌬Ѷ 1 ▮㍗ⵊ䪈➵ • what their future
⠠㸴㌬⎷㎴志⠇斾䫼〛⿛㨪汭䅜Ѷ 1 汭䅜〛⋆嶵♆䤹 production facilities 〛⋟⣯㈡⭢ѵ愜⊨各⟹▮㬾㭹櫭䁔揊尻念
志㦇㞆㩕䴻☯≃樻慺⛳Ѷ ▫椝槜沁㩆揈 needs are likely to be
⛏䤣⋟徰㧔⢺䱰␕䞶㬞徰㧔哸ⵂ䋮憡滂ㄐ櫭䁔嗭▫ – ensuring existing facilities can 㯹瑃⌝⏷揊尻◼䱰汭䅜Ѷ
於嵲Ѷ 2 䤵⋆⾅噼㑃㸴㌬䪈⠇❈瑃∸⋓㨀㬳㦇㞆⠝哸 10 ䷎慺⛳㩆⡔⠝哸㜙勫瑃㘲各⋽⋽㩆滂㋃⠇ 11 12
〛㸴⮳㮘㌗䂳㬞䤬ⴧѶ
meet peak demands ❈㊬♋≥䪈䯰㬳䃳⛜Ѷ
Time Series and Cross Sectional
Overview of Forecasting
Tools for examining time series Data 㨍槢㊬♋㦇㞆䆚⟹橼㨍槢㟀䷻䪈∸
價♋嶳䅜⑴琿⏃ⶤ瑃㬝㋃棯⥛沆瑃
㿡㧼咞䵩⌯㱐瑀Ѷ 汭䅜㧿⭐⍨従志
4. Australian monthly clay brick production from March • Time Series Data ㊬♋〨ⶤ⎍㌓勫Ѷ
1956 to September 1994 – sequence of observations over time.
• Time series and cross sectional data – e.g. monthly sales figures, daily stock prices,
weekly interest rates, annual profits.
600
• Observe that the market • Graphical summaries – In forecasting we try to estimate how the sequence
500
is seasonal and quite will continue into the future (univariate analysis).
volatile • Numerical summaries 㸽㙆歎㦇㞆✷⡙⭐⠺∸㨍槢䓂揊尻䪈㙜㬞嶳
400
䅜Ѷ ⬇㍯㧐䃧⠝䤬⋆徶⍨ⴽ≢㨍槢㊬♋⠇斾
300 • Cross Sectional Data

millions units
⊃槢䪈▫價琿ⴽ⠇斾☺㮤瑀Ѷ
200 • Accurate forecast are – all observations are at the same time.
very difficult unless the • we may wish to forecast the response

Mar-56
Mar-60
Mar-64
Mar-68
Mar-72
Mar-76
Mar-80
Mar-84
Mar-88
Mar-92
cause of the fluctuations (dependent) variable using one or more of the
quarter explanatory (independent) variables.
can be identified
– we can use the same methodology (i.e, regression)
志㈡⭢相㬞⾅噼㑃⢺䫼㍰ⵊ䪈䃳⛜㑃瑃橒歊 to evaluate relationship between multiple time
哸ⵂ䱰⾼䃳⛜䪈⟎⬉瑃⡔♍◼䱰汭䅜歊㉖⬘ series variables (multivariate analysis).
檫Ѷ 13 14 15

Graphical Summaries Graphical Summaries Graphical Summaries


• Graphs sometimes also suggest possible
• Time plots • When first exploring data explanations for some of the variation in the
– visualize the data through graphs data:
– for example
• industrial disputes will affect time series of production.
• Seasonal Plots • Basic feature of data including patterns • changes in government will affect economic time series
and unusual observations are mostly seen patterns.
through graphs – where possible, these events should be adjusted
• Scatterplots for or included in the eventual model.

• The type of data will determine which type of graph


is most appropriate.
⬦㍿㡰嵲睜 ⭐♑㽶㞺儠㦇㞆㨍瑃搉掶⬦㍿⠝嶷❈㦇㞆嗭▫於嵲Ѷ 㦇㞆䪈Ⱑ㭀
䚀㎞ѵ㸴㌬⢺㌟㉖嶳䅜搉㉖搉掶⬦㍿㭹徸♟Ѷ ⬦㍿㬞㨍⊗⠝哸≲㦇㞆≥䪈㯤
16 17 ⋓⠇❈㟨⏓⠝哸䪈巕方睜⏃ⶤ瑃㈅≒办劵⍒㎎⣻䤣⋟䪈㨍槢㊬♋Ѷ 㥗㊹䪈⠇ 18
㬊⍒㎎⣻勍䅟㨍槢㊬♋㸴㌬Ѷ 㦇㞆䪈偹⮳〨◩⾼⤗䷎偹⮳䪈⬦㍿㬕⠶揱Ѷ
Time Plots and Time Series Patterns Time Plots and Time Series Patterns Time Plots and Time Series
Australian Beer production from Jan 1991 –Aug 1995 Patterns
• A time plot reveals any Observe
Monthly Australian beer production • An important step in selecting an
• the range of data
– trends over time. appropriate forecasting method or model
200
– regular seasonal behaviour. • the time at which the peaks is to consider the type of data patterns
– other systematic features of the data. occur
160 – horizontal
㨍槢⬦睜 㠅䴻橼㨍槢⠇❈䪈慺⛳ѵ嶵㎨䪈⾅噼㑃尻≲⌝⟹㦇

Megalitres
㞆≥櫭嵲励▝勝従㸴⮳䪈▮⌎價勝㑃䚀㎞Ѷ • relative size of the peaks – seasonal
120
compared with the rest of the
data – cyclical

Jan-91
Jan-92
Jan-93
Jan-94
Jan-95

May-91
Sep-91
May-92
Sep-92
May-93
Sep-93
May-94
Sep-94
May-95
• These components need to be identified – trend
and incorporated into the statistical Year • Randomness in the series
model. since the data pattern is not
perfect
㨍槢⬦㬞⛝⋆嶳、㦇㞆国⬜ѵㄐ⑴☯䞶
䪈㨍槢ѵㄐ⑴䫼〛⋆㦇㞆▮⎑擗☺䪈䫼
19 〛ⵊ〱瑃⌝⟹㊬♋≥䪈橼㭎㑃瑃⬉≲㦇 20 21
㞆㸴㌬㊓歊⾮厍Ѷ

Time Plots and Time Series Patterns Time Plots and Time Series Patterns Time Plots and Time Series Patterns
⢖㬳㑃㸴㌬睜 ㍰㦇㞆⡶䞶歊⬢⾼⢖㬳䪈≂❹⢺≃樻㨍⽺⭐Ѷ〛⋆勍䅟㊬♋瑃≂❹⢺≃樻
搉㉖㩆䤵⋆勍䅟䃳⛜琿⏃ⶤ≆⥳≒⢖㬳䫼▫䪈䃳⛜瑀搏㘬䪈Ѷ ⏃ⶤ瑃䂏捓ѵ㌗㭤ѵⵊ⮳
• Horizontal Pattern ⿘䤹佉⋟⣯䪈棯⥛Ѷ
• Cyclical Pattern • Many data series include combinations of patterns
– exists when the data values fluctuate around a – Exists when data exhibit rises and falls that are not of a • The Australian clay brick production series exhibits trend,
constant mean (stationary in the mean) fixed period seasonal and cyclical behaviour
– e.g. a product whose sales do not increase or – For economic series the rises and falls are usually due
to economic fluctuations such as those associated with Australian clay brick production
decrease over time
business cycles
䁆㊐㸴㌬睜 ㍰㦇㞆⑴⬜勓∸≢㑮⾼䪈⭯⑴䃳⛜㨍⽺⭐琿⭯⑴㊐丳瑀Ѷ ⏃ 600
ⶤ瑃棯⥛沆≅橼㨍槢ⳃ⛔㘲★〳䪈⋟⣯Ѷ – e.g. sales of products such as cars, building products, 500
• Seasonal Pattern major appliances 400
300
– exists when a series is influenced by seasonal 200
millions units

factors • Trend Pattern


– Exists when there is a long-term increase or decrease in
Mar-56
Mar-60
Mar-64
Mar-68
Mar-72
Mar-76
Mar-80
Mar-84
Mar-88
Mar-92

• quarter or month in the year, day of the week


data
– e.g. household electricity consumption in a quarter
– e.g. sales of products, GNP
country that has different seasons through out
the year. 慺⛳㸴㌬睜 ㍰㦇㞆⽺⭐楮㬳ⳃ⛔㘲★〳㨍⽺⭐Ѷ ⏃ⶤ瑃⋟⣯棯 循ⴽ㦇㞆㊬♋✷⡙㸴㌬䪈勂⠶Ѷ⏃ⶤ瑃䎾ⵊ♝⋒傖⭇䰙䤣⋟㊬♋屗䞶☯
⾅噼㑃㸴㌬睜 ㍰㊬♋⠆♤⾅噼㑃⬉儞琿⏃ⶤ瑃∸㊑≥䪈⾅㋃㘲㬝⌵瑃∸⢖≥䪈㯤 22 ⥛沆ѵ⬥䀣䤣⋟㑗⑴Ѷ 23 24
慺⛳ѵ⾅噼㑃⢺⢖㬳㑃尻≲Ѷ
∸ⵌ瑀㎎⣻㨍⽺⭐Ѷ ⏃ⶤ瑃∸≢■㊑⾅噼☺㨥䪈⬥⿘/⭘❬䪈⿘㋊䤬䤹斾Ѷ
Seasonal Plots Seasonal Plots
A seasonal plot of the Australian beer production (slide 20)
Scatterplots
• For time series that are seasonal, it is ⾅噼⬦睜 〛⋆相㬞⾅噼
190 㑃䪈㨍槢㊬♋瑃♪⎔⾅ • If we wish to evaluate relationship
useful to also produce a seasonal plot 噼⬦⊗㎥㬞䤬Ѷ志⬦✷
170 ⡙㱍㞆嶳、⟎ⷭ㦇㞆䪈 between two time series variables, it is
150 ⠲≢“⾅噼”勖♪䪈㦇㞆
Ѷ⾅噼⬦⠝⌝㬊䈔㪆⭘ appropriate to investigate it using

Megalitres
• The graph consists of data plotted against 130 㩕䴻䍨⭐㸴㌬瑃㊓捨㮒
110 徸♟≆⾅噼㑃㸴㌬䪈⌳ scatterplot.
individual “seasons” in which raw data ⎍於ⵊ⒇㈎Ѷ⏃ⶤ瑃䎾

Jul

Apr

Jan
Jun

Mar
Oct
ⵊ♝⋒⦑敁⋟斾⭐11㬝

Feb
Aug
Nov
• However, we need to be careful for the

May
Sep
Dec
were observed ⢺12㬝掭♤ㄐ⑴瑃≲➈
Month “spurious” relationship caused by trend
❼䠇ⴲ⾅⒑◼⴪瑃◢⾅
⋟斾㬕⎆Ѷ
and not by actual relationship between
• A seasonal plot • Note that production variables.
– peaks in November and December in preparation for the
– enables the underlying pattern to be seen southern hemisphere summer ⶤ㮰㘭⌤㈫㬯徶⍨≜≢㨍槢㊬♋⠇斾⊃槢䪈▫價瑃⎷䤬㥺䓂⬦揊尻念
more clearly – is least in winter 㯹㩆⠶揱䪈Ѷ ⍾㩆瑃㘭⌤櫭嵲䃹㔫䤵慺⛳吋歊⠇斾⊃槢䪈⿀樳▫價㌲
慦䪈“⍢”▫價Ѷ
– Allows any substantial departures from the • There is one year in which the October beer
seasonal pattern to be easily identified production was higher than the pattern evident in
25
the other years 26 27

Numerical Summaries Numerical Summaries Numerical Summaries


• Univariate Statistics • In addition to graphics, it is also useful to • For a pair of data sets (bivariate data) it is of
provide numerical summaries interest to describe how the data sets relate
to each other
– A summary number for a data set is called a
• Bivariate Statistics statistic – common summary statistics are covariance and
correlation

• For a single data set or time series • For a single time series it is very useful to
• Autocorrelation
– common descriptive statistics are the mean, compare the observation at one time period
standard deviation and variance
with observation at another time period
– Most common statistics are autocovariance and
autocorrelation
28 29 30
Univariate Statistics
Bivariate Statistics Bivariate Statistics
Let Yi i = 1, 2, . . . n be the data set ԣ‫ސ‬ٛ୊ऀ۱ৰਖ਼ङՊ୏ङԥѹ澞‫ݔ‬ଚДЗՊ୏Ф୿Ҽ঩ङ‫ޗ‬ԥѹ‫ީ୏چ‬
• Whenever we are dealing with paired बҼ঩‫ރ‬
1
Mean Y ¦Yi observations (bivariate), it is of interest to • The covariance takes on the units of the
n
Median = middle observation if n odd examine and measure the extent of the variable under consideration. A unitless
average of middle two observations if n even relationship between the two variables measure describing the relationship
between two variables is the correlation
1 coefficient
Mean absolute deviation MAD ¦ Yi  Y • Suppose the two variables are X and Y, a
n
statistic which measures how the Cov XY ¦ X i  X Yi  Y
rXY
1 2 variables “co-vary” called the covariance S X SY 2 2
Mean squared deviation MSD ¦ Yi  Y ¦ Xi  X i
¦ Y Y
n is defined as
1 2
S2 ¦ Yi  Y • The effect of scaling is to restrict the
Variance n 1 1
Cov XY ¦ X i  X Yi  Y range of rXY to the interval [-1, 1]
1 2
n 1
Standard deviation S S2 ㍰㘭⌤ⴧ䠊㘬〛嶳䅜⑴琿⟻⠇斾瑀㨍瑃㬞㏢嵲㳔㯹⢺屐斾≜≢⠇斾⊃槢▫價䪈下㋃Ѷ ⑿
n 1
¦ Yi  Y
31
徰揈≜≢⠇斾㩆 X ⢺ Y瑃屐斾⠇斾ⶤ⎍“▩⠺⠇❈”䪈勝従斾䷰≲➁㧐㈎Ѷ屐斾≜≢⠇斾32 33
⊃槢▫價䪈㧷➆⎅㋃斾㩆䫼▫價㦇瑃▮国⬜樾♪⭐ [-1, 1] ❬槢▼Ѷ

Bivariate Statistics Autocorrelation Autocorrelation


• The covariance and correlation coefficient are
• The autocovariance at lag k is denote by ck
statistics that measure the extent of the linear
• Example: relationship between two variables➁㧐㈎⢺䫼▫價㦇㩆屐斾 1 n 屐斾㨍槢㊬♋≆▮䋫⠼䙏㭀⊃槢劽
≜≢⠇斾⊃槢劽㑃▫價下㋃䪈勝従斾Ѷ ck 㑃▫價䪈㧐⠿Ѷ㽴⑴屗䴻㍰㊬♋⑴
¦ Yt  Y Yt k  Y
n t k 1 捰滂㨍瑃▮ k ≢㨍㬳⚁䪈⑴⊗⑶⠿
– The covariance CovPM = -21 – Used to identify explanatory relationships ⋆捰滂琿⟼⊃⋞䔿瑀Ѷ▮ⵊ〱⠅◩
⋆㦇㞆䪈ぜ㋃Ѷ
• indicating that there is a negative relationship between
the variables
• The autocorrelation at lag k is denote by rk
• Autocovariance and autocorrelation are comparable 㩆嗤➁㧐㈎䪈㰛◼❈䙏㭀 n
䋫⠼ k 㬳䪈嗤➁㧐㈎䤬 ck
measures that serve the same purpose for a single Ѷ⾥⠺㨍屐斾劽㑃▫價䪈 屗䴻瑃䋫⠼ k 㬳䪈嗤䫼▫
㍗㋃⢺㧐⠿Ѷ ¦ Y Y t Yt  k  Y 䤬 rk 屗䴻Ѷ ≅⠺䋫⠼㬳䪈
– The correlation coefficient rXY = -0.73 time series嗤➁㧐㈎⢺嗤䫼▫㩆䤬⋆➆≢㨍槢㊬♋䪈偹⍴㋃斾瑃䤬⋆㿦捰≅⠺ rk t k 1 嗤䫼▫▩⠺㮘㘬⊾嗤䫼▫
㨍槢㿇䪈嶳䅜⑴琿䋫⠼瑀Ѷ n
2 ☲㦇琿ACF瑀瑃搉㉖⠝嶷
• indicating that there is a fairly strong negative • Let Y1, Y2, . . . Yt-1, Yt be a time series ¦ Y Y t ❈≲䫼▫⬦Ѷ
relationship between the two variables t 1
– If we compare Yt, the observation at time t with Yt-1, the
observation at time t-1, then we can see how consecutive • Together, the autocorrelations at lags 1, 2, . . . ,
observations are related make up the autocorrelation function or ACF
– The observation Yt-1 is described as “lagged” by one period – A graph of the ACF is called a correlogram and helps one
– Similarly it is possible to compare observations lagged by visualize the ACF quickly and easily
34 two periods, three periods, and so on. 35 36
Autocorrelation
Measuring Forecasting Accuracy
ACF of Beer Production Measuring Forecasting Accuracy
• A plot of the ACF is a standard BEERPROD • Accuracy is treated as an overriding criterion for
1.0
tool in exploring a time series selecting a forecasting model
before forecasting
.5 • Standard statistical measure ◼䱰㑃㩆揸㜁汭䅜㸴⮳䪈浿嵲㰛◼瑃⾥㜟䪈㩆㸴⮳於䞶㦇㞆䪈
• Accuracy 下㋃琿㛷⠶⍐㋃瑀Ѷ
• It provides a useful check for 0.0
seasonality, cycles, and other Ÿ goodness of fit
time series patterns • Out of sample accuracy measures Ÿ how well the forecasting model is able to reproduce the
-.5
Confidence Limits
– the seasonal pattern is very clear data
in the ACF of the beer production

ACF
-1.0 Coefficient
series 1 3 5 7 9 11 13 15 • ACF of forecast error
2 4 6 8 10 12 14 16
• If Yt is the actual observation of a time series and
Lag Number
• The ACF also helps identify Ft is the forecast for the same period, then the
– if previous values of the series • Prediction Intervals error is defined as 汭䅜忡㈎ (et) ⾼⊁≲ et=Yt–Ft瑃▮≥ Yt 㩆⿀樳嶳䅜
contain much information about The ACF plays a very ⑴瑃Ft 㩆⠺㬳䪈汭䅜⑴Ѷ Ft 搉㉖⎷䤬㙆嗭 <Wí 䪈
et = Yt – Ft
the next value important role in time series 㦇㞆従侗瑃⬉㽵 et 岚㟧揟≲汯▀∸㽶䪈汭䅜忡㈎Ѷ
– whether there is little relationship forecasting
between one observation and the • Usually Ft is calculated using data Y1, Y2, . . . , Yt-1
next ACF 㩆汭䅜⚁㞺儠㨍槢㊬♋䪈㰛◼㈅相Ѷ⾥㬞⛝⋆㳔㯹⾅噼㑃ѵ⢖㬳⢺▮⌎㨍 – It is a one-step ahead of the last observation used in the
槢㊬♋㸴㌬Ѷ⾥揇㬞⛝⋆䱰⾼㊬♋䪈▀⚁⑴㩆⡔✷⡙㬞▫≃∸≢⑴䪈ⵊ斾␙㒋瑃 calculation
㘲各∸≢嶳䅜⑴≆≃∸≢嶳䅜⑴⊃槢㩆⡔⽺⭐㎥〱䪈▫價ѶACF ⭐㨍槢㊬♋汭 37 38 39
䅜≥慦䭄歊㉖於嵲䪈⎔䤬Ѷ – Hence et is described as a one step ahead forecast error

Standard Statistical Measures Standard Statistical Measures Standard Statistical Measures


• Each of these statistics deals with measure of Percentage error is defined as
1 n accuracy whose size depends on the scale of the
Mean error ME ¦ et data揈⋓勝従㦇㞆䪈㿡∸≢擬䆚⟹◼䱰㑃㋃斾瑃▮ⵊ〱⠅◩⋆㦇㞆䪈嶵
nt1 㸴Ѷ⾥⌤≅♝⋆懕≅⠺㨍槢槢檁⢺≅⠺㨍槢㊬♋揊尻㿦捰Ѷ § Yt  Ft ·
PEt ¨¨ ¸¸ u 100
© Yt ¹
• They do not facilitate comparison across different
1 n time intervals and for different time series The following two accuracy measures are frequently used
Mean Absolute Error MAE ¦ et – e.g. An error of 10 mega litre when forecasting monthly
nt1 beer is quite different from an error of 10 mega litre when
forecasting annual beer production
1 n
Mean percentage error MPE ¦ PEt
1 n 2 • To measure comparisons such as the above, one nt1
Mean Squared Error MSE ¦ et need to work with relative or percentage error 1 n
nt1 measures Mean Absolute percentage error MAPE ¦ PEt
nt1

40 41 42
Standard Statistical Measures Standard Statistical Measures
Period Observation Forecast Error Absolute Error Squared Error Percent Error Absolute Percent Error
t Yt Ft
• The following table gives the last eight beer 1 138 150.25 -12.25 12.25 150.06 -8.88 8.88
• Know the MAPE (say 5% ) means a great deal 2 136 139.50 -3.50 3.50 12.25 -2.57 2.57
more then knowing the MSE (say 183) production figures and forecasts obtained by taking
3 152 157.25 -5.25 5.25 27.56 -3.45 3.45
the average of each month over the past four years.
4 127 143.50 -16.50 16.50 272.25 -12.99 12.99
• The MAPE is only meaningful if the scale has a 5 151 138.00 13.00 13.00 169.00 8.61 8.61
Period Observation Forecast
meaningful zero (that is ratio data) 6 130 127.50 2.50 2.50 6.25 1.92 1.92
t Yt Ft 7 119 138.25 -19.25 19.25 370.56 -16.18 16.18
– Eg. One would not use MAPE for assessing the
accuracy of temperature forecasting since the common
1 138 150.25 8 153 141.50 11.50 11.50 132.25 7.52 7.52
temperature scales (Fahrenheit and Celsius) have fairly 2 136 139.50 Total -29.75 83.75 1140.19 -26.02 62.12
arbitrary zero points 3 152 157.25
n=8 ME MAE MSE MPE MAPE
4 127 143.50
• Difficulties with MAPE and MPE also arise when -3.72 10.47 142.52 -3.25 7.77
5 151 138.00
the time series contains zeros, since the 6 130 127.50
percentage error cannot be calculated
⠘㬞㍰♯㋃相㬞㬞㔫⊁䪈櫣琿➢㿦䞍㦇㞆瑀㨍瑃MAPE 㙩㬞㔫⊁Ѷ ⏃ⶤ瑃⋲⌤≅⍒⎷䤬 MAPE
7 119 138.25
㭹徶⍨䈷㋃汭䅜䪈◼䱰㑃瑃⬉≲㉖嶲䪈䈷㰛琿➀䀡㋃⢺㡜䀡㋃瑀相㬞䫼㍰橼㔫䪈櫣䓂Ѷ ㍰㨍槢㊬ 43 8 153 141.50 44 45
♋✷⡙櫣㨍瑃MAPE ⢺ MPE ⊗⍒☯䞶⬘檫瑃⬉≲㧷䃧従侗䪂☺㿦忡㈎Ѷ

Out-of-Sample Accuracy ACF of Forecast Error


Out-of-Sample Accuracy
Measurement Measurement • The ACF of the one step forecast errors are very
useful in determining if there is any remaining
• The summary statistics so far considered pattern in the errors (residuals) after a
• The initialisation set is used to estimate any forecasting method has been applied
measure a goodness of fit of the model to
historical data㸴⮳〛➵⠠㦇㞆䪈㛷⠶⍐㋃㊓≅∸⾼㔫⢡䭄噩⶟䪈汭䅜Ѷ parameters and to initialise the method♑ⷭ❈檳䤬 – Not a measure of forecasting accuracy but gives an
⋆⍨従⌳⎍⟱㦇㊓♑ⷭ❈㧐䃧Ѷ indication if the forecasting method can be approved
– Such fitting does not necessarily imply good ∸㽶汭䅜忡㈎䪈 ACF 歊㉖㬞⛝⋆䱰⾼⭐㊱䤬汭䅜㧐䃧⠼瑃忡㈎琿㾝㈎瑀≥㩆⡔
forecasting ⽺⭐⌳⎍⚝⎑㸴㌬Ѷ揈≅㩆汭䅜◼䱰㑃䪈㋃斾瑃⍾⠝⌝㜟䴻汭䅜㧐䃧㩆⡔⠝⌝㥑
揊Ѷ
• Forecasts are made for the test set • If the forecast errors appear to be a random
• In order to measure true out-of-sample series, then the ACF would reflect that with
– Since the test set was not used in model fitting, almost no significant autocorrelationsⶤ㮰汭䅜忡㈎⡶
accuracy≲⊾屐斾䬣⿀䪈㱋㭀ⴹ◼䱰㑃瑃㑗㦇㞆☺≲“♑ⷭ❈”檳⢺
“䅜忇”檳㘲“␕䥝”檳Ѷ these forecast are genuine made without using 䞶橼㭎㊬♋瑃♍ ACF 〨⟼㨷揈∸䓂瑃☕⊆䂳㬞㩕䭄䪈嗤䫼▫Ѷ
– The total data are divided into an the values of the observations of the time series䤵 • If there is some sort of pattern in the ACF of
“initialisation” set and a “test” set or “holdout” ⋆䅜忇檳㬾䤬⋆㸴⮳㛷⠶瑃⬉㽵揈⋓汭䅜㩆⭐≅⎷䤬㨍槢㊬♋嶳䅜⑴䪈㓡◫≃揊 errors , it would imply that the forecast method
尻䪈䬣⿀汭䅜Ѷ could be improvedⶤ㮰忡㈎䪈 ACF ≥⽺⭐㯤䷎㸴㌬瑃♍㔫⢡䭄
set
⠝⌝㥑揊汭䅜㧐䃧Ѷ
– The accuracy measures are computed for the test
– e.g. referring example on slide 45, it is clear that some of
set only◼䱰㑃㋃斾⋽桷〛䅜忇檳従侗Ѷ the autocorrelations for errors would be significant
46 47 – some sort of seasonal pattern in the correlogram 48
Prediction Intervals Prediction Intervals
• As well as forecast values, it is also desirable to
provide accompanying statements, usually in the • The usual assumption for constructing prediction AA037007
form of prediction intervals橒⊾汭䅜⑴⊃ⴹ瑃揇㈫㬯㟨⏓樲㉅ intervals is that the forecast errors are normally
䪈忦㨥瑃搉㉖⌝汭䅜❬槢䪈㍿㌬Ѷ揈㎥㬞䤬瑃⬉≲⾥≲汭䅜各㟨⏓⊾“㬕⭷” distributed with zero mean㮘㌗汭䅜❬槢䪈搉㉖⑿徰㩆汭䅜忡 Time Series Analysis
㘲“㬕⶟”㓡◫䪈⍨従瑃⌝⟹〛汭䅜⠝歌㑃䪈㔻嶺Ѷ ㈎⡶櫣⭯⑴㽴㐝☺㈢Ѷ
– Useful because it provides the forecaster with • Under this assumption, an approximate prediction
• the “worst” or “best” case estimates interval for the next observation is⭐㽵⑿徰≃瑃≃∸≢嶳
• a sense of how dependable the forecast is 䅜⑴䪈揀⍴汭䅜❬槢≲
Lecture 2

– Forecasts cannot be expected to be perfect and the Ft 1 r z D 2 MSE


prediction intervals emphasise this Moving average and Classical
• ◩⾼汭䅜❬槢䪈⿟㋃琿⏃ⶤ瑃z§1.96 勗☯ 95% 䪈汭䅜❬槢瑀Ѷ
≅哸㬳㬯汭䅜㩆⾮厍䪈瑃汭䅜❬槢㍗念⊾揈∸䓂Ѷ汭䅜❬槢搉㉖Ⱑ⋆ MSE瑃
⬉≲⾥㟨⏓⊾∸㽶汭䅜忡㈎䪈⍨従Ѷ㮘㌗汭䅜❬槢䪈搉㉖⑿徰㩆汭䅜忡㈎⡶ • zD 2 determines the width of the prediction interval Decomposition Model.
櫣⭯⑴㽴㐝☺㈢Ѷ
䷻⛜㊐⭯䃧⢺勍▯☺巕㸴⮳
• Prediction intervals are usually based on MSE • zD 2 z0.025 1.96 gives a 95% prediction interval
because it provides an estimate of one-step
forecast error 49 50

Decomposition Models Decomposition Models Decomposition Models


• The exact functional form depends on the
• Decomposition assumes that data is made up as • Recall that the general mathematical form of the decomposition method used.
follows:☺巕⑿徰㦇㞆䤵⌝≃擗☺㮘㘬 decomposition approach is: – Additive form: Yt = St + Tt + Et ⛔䃧㍿㌬
data = pattern + error㦇㞆≥䪈價勝㑃擗☺琿㸴㌬瑀⢺橼㭎擗☺琿忡㈎瑀 Yt = f(St , Tt , Et) • Appropriate if the magnitude of the seasonal fluctuations
= f(trend-cycle, seasonality, error) does not vary with the level of the series揱䤬⋆⾅噼㑃䃳⛜䪈
ⵊ〱≅橼㊬♋䁆㊐⠇❈䪈㊬♋Ѷ

• Yt : time series value at period t. Monthly milk production per cow


1000
• The error is assumed to be the difference
between the combined effect of the two sub- • Tt : trend component at time t. 900

patterns of the series and the actual data.忡㈎岚⑿⾼≲ • St : seasonal component at time t. 800
㊬♋䪈≜≢⽲㸴㌬琿慺⛳⢖㬳⢺⾅噼㑃瑀䪈勂⠶㥠㊱≆⿀樳㦇㞆⊃槢䪈㈎㌟Ѷ
• Et : error (irregular or random) component at time t. 700
pounds

600
• The error is often referred to as the irregular or
500
random (or remainder) component.忡㈎搉㉖岚䷰≲≅嶵♍㘲橼
㭎琿㘲㾝㈎瑀㘬☺
400

2 3 4
Jul-90
Jul-91
Jul-92
Jul-93
Jul-94
Jul-95
Jul-96
Jul-97
Jul-98
Jul-99
Jul-00
Jul-01
Jul-02
Jul-03

Jan-90
Jan-91
Jan-92
Jan-93
Jan-94
Jan-95
Jan-96
Jan-97
Jan-98
Jan-99
Jan-00
Jan-01
Jan-02
Jan-03
Decomposition Models Decomposition Models Decomposition Graphics
– Multiplicative form: Yt = St x Tt x Et • Very often, when the original series is not additive, it can be
• Appropriate if the seasonal fluctuations increase and transformed and then can be modelled additively.㎥ⴽ㨍⑑瑃㍰⟎ⷭ • Decomposition plot
㊬♋≅㩆⛔䃧⮳㨍瑃⠝⌝搉掶捙㝺⎷▮哸ⵂ䤬⛔䃧㸴⮳㌗㸴
decrease proportionally with increases and decreases in – Helpful in visualising the decomposition procedure☺巕⬦㬞⛝⋆
the level of the series揱䤬⋆⾅噼㑃䃳⛜橼㊬♋䁆㊐䪈ⳃ★吋㘬㿦⏃ⳃ • If Yt = St x Tt x Et then log Yt = log St + log Tt + log Et. ⠝嶷❈☺巕掶下
★䪈㊬♋ • Hence we can fit a multiplicative relationship by fitting an
• More prevalent with economic series, e.g. International additive relationship to the logarithms of the data. • Example: additive decomposition of monthly sales
airline passengers:⭐勍䅟㊬♋≥㬊≲㪄搼 International airline passengers (in natural log) 㘭⌤⠝⌝搉
6.50
掶〛㦇㞆䪈 (in thousands) of new one-family houses sold in the
International airline passengers 〛㦇⑴㛷⠶ USA since 1973
450 ⶤ㮰⟎ⷭ㦇㞆 ∸≢⛔䃧▫
6.00 價㭹㛷⠶∸ – Series shows both cyclical and seasonal behaviour.
400 揱⠶⊐䃧㸴⮳瑃
≢⊐䃧▫價
⠝⌝▀〛㦇㞆 – Cyclical behaviour is related to the economic health and
350
⠅〛㦇瑃䔿⠼ 5.50 confidence of the nation.⢖㬳㑃尻≲≆⬥⿘䪈勍䅟⒜㋔䚽◫⢺␙㏠㬞▫
300 〛〛㦇捙㝺⠼
䪈㦇㞆⎷䤬⛔ – Other panels show estimates of cyclical, seasonal, and
250 5.00
䃧☺巕㧐䃧Ѷ irregular behaviour.▮⌎歎㮓㩕䴻⊾⢖㬳㑃ѵ⾅噼㑃⢺≅嶵♍尻≲䪈⍨従⑴
200
– When the three component are added together, the original
150 4.50
series is obtained.㍰揈≁≢㘬☺⛔⭐∸慦㨍瑃こ㎴♤⊾⟎ⷭ㊬♋
100
4.00
50

Jul-49
Jul-50
Jul-51
Jul-52
Jul-53
Jul-54
Jul-55
Jul-56

Apr-49
Oct-49
Apr-50
Oct-50
Apr-51
Oct-51
Apr-52
Oct-52
Apr-53
Oct-53
Apr-54
Oct-54
Apr-55
Oct-55
Apr-56
Oct-56

Jan-49
Jan-50
Jan-51
Jan-52
Jan-53
Jan-54
Jan-55
Jan-56
5 6 7

Jan-49
Jan-50
Jan-51
Jan-52
Jan-53
Jan-54
Jan-55
Jan-56

Sep-49
Sep-50
Sep-51
Sep-52
Sep-53
Sep-54
Sep-55
Sep-56

May-49
May-50
May-51
May-52
May-53
May-54
May-55
May-56
Seasonal Adjustments
Decomposition Graphics Seasonal Adjustments
Decomposition of additive ti
• A seasonal adjusted time series is one in which the
seasonal variation has been removed.⾅噼念㦋⠼䪈㨍槢㊬♋㩆㜟

90
㈒䷻橒⾅噼㑃⠇⛜䪈㨍槢㊬♋
• E.g. for monthly unemployment series

70
– Does the increase from one month to the next imply a

observed
50
worsening in the economy?㯤≢㬝♤≃≢㬝ⵔ≒䞍䪈ⳃ⛔㩆⡔㔫⢡䭄勍䅟
㒒❈睞

30
• Decomposition of times series makes it easy to

60
calculate seasonally adjusted data.㨍槢㊬♋☺巕⎷㎴従侗⾅噼念㦋
㦇㞆⠇㎴⿛㨪

50

trend
• If the increase is due to a large number of school

40
leavers seeking work (seasonal variation)ⶤ㮰揈䷎ⳃ⛔㩆䤵

30
10
⋆ⵊ斾㿧≒䤣〝㚚㈅⎔琿⾅噼㑃⠇⛜瑀

5
• For additive decomposition the seasonally adjusted
– We would not want to conclude that the economy has

seasonal
data are obtained by⭐⛔䃧㸴⮳≥瑃⌆⟎ⷭ㊬♋≥★⟪⾅噼㘬☺瑃⚝≃䪈こ㩆慺 weakened
⛳⢖㬳⢺≅嶵♍㘬☺䪈勂⠶瑃➢⾅噼念㦋㊬♋

-10 -5
– Hence seasonally adjusting such unemployment data is
Yt - St = Tt + Et useful in giving us a clearer picture with regard to the

10
economic condition.⬉㽵瑃〛㽵偹ⵔ≒㦇㞆揊尻⾅噼㑃念㦋瑃㬞⛝⋆㘭⌤㬊䈔

random
• For multiplication decomposition the seasonally 㪆⭘⊾巕勍䅟䚽◫Ѷ

-10 0
adjusted data are obtained by⭐⊐䃧㸴⮳≥瑃〨⟎ⷭ㊬♋橒⌝⾅噼㘬☺
1975 1980 1985 1990 1995 琿⾅噼㜟㦇瑀瑃㎴♤䪈こ㩆⾅噼念㦋㊬♋
8 9 10
Time Yt/St = Tt x Et
Simple moving averages
Moving Averages ䷻⛜㊐⭯㩆∸䷎㉖䤬䪈㊐䋞㨍槢㊬♋㦇㞆䪈㧐䃧瑃䤬
⌝徸♟㦇㞆≥䪈楮㬳慺⛳
Moving Averages
• We need to decide how many data points to include in
• Moving averages are fundamental building blocks in each average.㘭⌤櫭嵲◩⾼⭐㿡≢㊐⭯⑴≥✷⡙ⴽ〳≢㦇㞆䓂Ѷ
• Types of moving averages
all decomposition methods.䷻⛜㊐⭯㩆㙜㬞☺巕㧐䃧䪈Ⱑ䱂勂㘬擗☺ • Suppose we use averages of three points, namely the
– Simple moving averages observation at which we are calculating trend-cycle and
• Moving averages provide a simple method for
smoothing the “past history” data.䷻⛜㊐⭯㟨⏓⊾∸䷎㊐䋞“掶⟪➵ – Centred moving averages the points on either side. This is called a moving average
⠠”㦇㞆䪈侀➆㧐䃧Ѷ “㊐䋞”㜟䪈㩆★〳㦇㞆≥䪈橼㭎䃳⛜㘲⪓ⴔ瑃⌆吋⎷䍨⭐䪈慺⛳㬊⛔㨥㩕Ѷ – Double moving averages of order 3 or 3 MA smoother.⑿徰㘭⌤⎷䤬≁≢䓂䪈㊐⭯⑴瑃➢㘭⌤㽴⭐従侗
慺⛳⢖㬳䪈撒≢嶳䅜䓂⌝⟹▮≜⏟䪈䓂Ѷ揈岚䷰≲3樤䷻⛜㊐⭯㘲3MA㊐䋞珨Ѷ
• The idea behind moving averages is that – Weighted moving averages
observations that are nearby in time are also likely to • Simple moving averages can be defined for any odd
be close in value䷻⛜㊐⭯䪈Ⱑ㭀㐹㔏㩆瑃⭐㨍槢≂䫼揀䪈嶳䅜⑴瑃▮㦇⑴⊗⠝哸䫼 order. A moving average of order k (or k MA) where k is
揀Ѷ⬉≲⾥⑿徰⊾㨍槢㊬♋⭐䯰㬳▼相㬞∸⾼䪈揍勫㑃Ѷ an odd integer is defined as the average consisting of an
– So taking an average of points near an observation will observation and m=(k-1)/2 points on either side so that
provide a reasonable estimate of the trend-cycle of the m
1
observation .⬉㽵瑃〛∸≢嶳䅜䓂樲揀䪈ⴽ≢㦇㞆䓂⠅㊐⭯⑴瑃⠝⌝⠶䠊⭘⍨従志嶳䅜 Tt ¦Y t j
䓂䪈慺⛳⢖㬳Ѷ k j m
– The average eliminates some of randomness in the data, 侀➆䷻⛜㊐⭯⠝⌝⾼⊁≲⌳⎍⵪㦇樤Ѷ∸≢k樤䷻⛜㊐⭯琿㘲k MA瑀瑃▮≥k㩆∸≢⵪㦇瑃⾼⊁≲∸≢嶳䅜⑴
leaving a smooth trend-cycle component.㊐⭯䆙橒⊾㦇㞆≥䪈擗☺橼11 12 ⟹▮≜⏟⠲m=(k-1)/2≢䓂䪈㊐⭯⑴ ⶤ㮰k=5 (5樤)瑃♍m=(5-1)/2=2瑃屗䴻⠅㍰⚁䓂⟹▮⚁⠼⠲2≢䓂琿▩5 13
≢䓂瑀揊尻㊐⭯Ѷ
㭎㑃瑃䥝≃㊐䋞䪈慺⛳⢖㬳㘬☺Ѷ

Example: monthly sales of shampoo Yt 3 MA 5MA


700.00 Centred moving averages
• 3 MA: Tt = 1/3(Yt-1 + Yt + Yt+1),
• The simple moving average required an odd number of
• 5 MA: Tt = 1/5(Yt-2 +Yt-1 + Yt + Yt+1 + Yt+2), 600.00
observations to be included in each average. This was
Month Time Observed values Three-month Five-month to ensure that the average was centred at the middle of
period (liters) moving average moving average 500.00
3 MA 5 MA
the data values being averaged.侀➆䷻⛜㊐⭯嵲䁔⭐㿡≢㊐⭯⑴≥✷⡙⵪
㦇≢嶳䅜⑴瑃揈㩆≲⊾䱰␕㊐⭯⑴≥㏠〛猳岚㊐⭯㦇㞆䪈≥槢⑴Ѷ
Jan 1 266.00 - -
Feb 2 145.90 198.33 - 400.00 • But suppose we wish to calculate a moving average
Mar 3 183.10 149.43 178.92
Apr 4 119.30 160.90 159.42 with an even number of observations. For example, to
May 5 180.30 156.03 176.60 300.00 calculate a 4-term average or 4 MA, the trend-cycle at
Jun 6 168.50 193.53 184.88
Jul 7 231.80 208.27 199.58 time 3 could be calculated by taking average of T2.5 and
Aug 8 224.50 216.37 188.10
200.00 T3.5; ⍾㩆瑃⑿徰㘭⌤㈫㬯従侗∸≢✷⡙⒭㦇≢嶳䅜⑴䪈䷻
Sep 9 192.80 180.07 221.70 ⛜㊐⭯Ѷ⏃ⶤ瑃嵲従侗∸≢4㬳㊐⭯㘲4MA瑃㨍槢䓂3
Oct 10 122.90 217.40 212.52 䪈慺⛳⢖㬳⠝⌝搉掶⠅ T2.5 ⢺ T3.5 䪈㊐⭯⑴㭹従侗
Nov 11 336.50 215.10 206.48 ⶤ㮰䫸㞽従侗4㬳䷻⛜㊐⭯瑃⏃ⶤ Y1,Y2,Y3,Y4 䪈㊐
100.00
Dec 12 185.90 238.90 197.82 T2.5 = (Y1 + Y2 + Y3 + Y4)/4, ⭯⑴瑃揈≢㊐⭯⑴〛㊱䪈㨍槢䓂㩆2.5 (➢伬2㬳⢺伬3
Jan 13 194.30 : : 㬳⊃槢)Ѷ⠺㱋瑃Y2,Y3,Y4,Y5 䪈㊐⭯⑴〛㊱䪈㨍槢䓂
Feb 14 149.50 : : 㩆3.5Ѷ≲⊾㎴♤⭐㦋㦇㨍槢䓂3䪈慺⛳⑴瑃櫭嵲〛揈
: : : : : ≜≢歊㦋㦇㨍槢䓂䪈㊐⭯⑴◄⠅㊐⭯Ѷ
14 15 T3.5 = (Y2 + Y3 + Y4 + Y5)/4, 16
: : : : :
Quarter Period Data 4 MA Average 2 x 4 MA Average
Position Position Double moving averages
• The center of the first moving average is at 2.5, while the Q1 1 266.00 - - - -
Q2 2 145.90 178.58 2.50 - -
center of the second moving average is at 3.5.伬∸≢䷻⛜㊐⭯䪈 • The centred moving averages are an example of how a
≥㏠⭐2.5瑃吋伬⋄≢䷻⛜㊐⭯䪈≥㏠⭐3.5 Q3 3 183.10 157.15 3.50 167.86 3
Q4 4 119.30 162.80 4.50 159.98 4
moving average can itself be smoothed by another
• However, the average of the moving averages is centred moving average.≥㏠䷻⛜㊐⭯㩆∸≢⏃⽲瑃忦㨥⊾∸≢䷻⛜㊐⭯㊬♋㭀折⠝⌝岚⠔∸
Q1 5 180.30 174.98 5.50 168.89 5
at 3 [i.e., (2.5+3.5)/2=3].䔿吋瑃揈≜≢䷻⛜㊐⭯䪈㊐⭯⑴♍≥㏠〛猳⭐㨍槢䓂3 ≢䷻⛜㊐⭯◄㼲㊐䋞Ѷ
Q2 6 168.50 201.28 6.50 188.13 6
• This centred moving average is denoted as 2 X 4 MA. Q3 7 231.80 204.40 7.50 202.84 7 • Any combination of moving averages can be used
Q4 8 224.50 193.00 8.50 198.70 8 together to form a double moving average. For example
• In this case,揈㩆∸䷎屗䴻㧐䃧瑃㔫≲▀揊尻∸≢4㬳䷻⛜㊐⭯瑃䔿⠼◄〛㎴♤䪈㊬♋揊尻
∸≢2㬳䷻⛜㊐⭯瑃⌆吋⎷㬕勆勑㮰で≥瑃⟻㢟⠥ (") 搉㉖屗䴻⋄㼲㊐䋞㘲≥㏠❈䪈勑㮰Ѷ従侗 Q1 9 192.80 219.18 9.50 206.09 9 a 3 X 3 moving average is a 3 MA X 3 MA.⌳⎍䷻⛜㊐⭯䪈勂⠶擬⠝
2x4MA⍒⎷㎴㊬♋≜仯㝷ⵔ㬊ⴽ䪈㦇㞆䓂 Q2 10 ⌝∸慦⎷䤬㍿㘬⟻於䷻⛜㊐⭯Ѷ⏃ⶤ瑃∸≢3x3䷻⛜㊐⭯こ㩆∸≢3MA㞽䭄∸≢3MAѶ揈㔫⢡䭄▀
122.90 209.53 10.50 214.35 10
Q3 11 〛⟎ⷭ㊬♋揊尻∸㼲3樤䷻⛜㊐⭯瑃䔿⠼〛㎴♤䪈㧇㊬♋◄揊尻∸㼲3樤䷻⛜㊐⭯Ѷ
336.50 209.90 11.50 209.71 11
Q4 12 185.90 216.55 12.50 213.23 12 • Example: T2 = (Y1 + Y2 + Y3 )/3,
T”3 = (T2.5 + T3.5)/2 Q1 13 : : : :
194.30 揈㩆〛伬∸㼲䷻⛜㊐
⭯㎴♤䪈㊬♋
T3 = (Y2 + Y3 + Y4 )/3,
Q2 14 149.50 : : : :
T2,T3,T4 ◄揊尻∸
: : : : : : : 㼲3MA瑃㎴♤⭐㨍槢
T4 = (Y3 + Y4 + Y5 )/3,
: : : : : : : 䓂3䪈⟻於䷻⛜㊐⭯
⑴ 7ƍƍѶ揈䷎㧐䃧㉖
----------------------------
17 18 䤬⋆⍨従劽㑃慺⛳㊬ 19
♋≥䪈慺⛳ T”3 = (T2 + T3 + T4 )/3,

Weighted moving averages Classical Decomposition Additive Decomposition


• In general, a weighted k-point moving average can be • Model: Yt = St + Tt + Et
written as;搉㉖瑃∸≢k䓂⛔㭗䷻⛜㊐⭯⠝⌝◐㘬 • Additive Decomposition • Classical decomposition is carried out in 4 steps
m
Tt ¦a Y j t j Yt = St + Tt + Et • Example : New housing sales
j m – data has a seasonal period of 12
– Since the seasonal variation is fairly constant over time,
where m=(k-1)/2 is the half-width and the weights are use the additive decomposition method䤵⋆⾅噼㑃䃳⛜橼㨍槢⠇❈䫼
〛丳⾼瑃⬉㽵⎷䤬⛔䃧☺巕㧐䃧Ѷ
denoted by aj. The weights all sum to one.▮≥ m=(k-1)/2 㩆❼⿟㋃ 100
90
瑃㭗於䤬 aj 屗䴻Ѷ㙜㬞㭗於⊃⢺≲1
• Multiplicative Decomposition 80
70
60
50
Sales

Example: Yt = St x Tt x Et
40
30
3 MA: Tt = (0.25Yt-1 + 0.5Yt + 0.25Yt+1),揈㩆∸≢3樤⛔㭗䷻⛜㊐⭯䪈 20
⏃⽲Ѷ≆侀➆3MA (㭗於擬㩆1/3) ≅⠺瑃揈斻勗⋀㍰⚁嶳䅜⑴ (Yt) 㬊ⵊ䪈㭗於 (0.5)瑃吋⚁⠼≜≢嶳 10
䅜⑴ (<Wí,Yt+1) 㭗於捰〱 (0.25)Ѷ䃹㔫㭗於⊃⢺ 0.25 + 0.5 + 0.25 = 1Ѷ 0
Jan-75
Jan-77
Jan-79
Jan-81
Jan-83
Jan-85
Jan-87
Jan-89
Jan-91
Jan-93
Jan-95
Jan-97

20 21 22
Sep-75
Sep-77
Sep-79
Sep-81
Sep-83
Sep-85
Sep-87
Sep-89
Sep-91
Sep-93
Sep-95
Sep-97

May-76
May-78
May-80
May-82
May-84
May-86
May-88
May-90
May-92
May-94
May-96
Additive Decomposition Multiplicative Decomposition
• Step 1 Additive Decomposition
– Compute trend cycle using centred 12 MA⎷䤬≥㏠❈䪈12㬳䷻⛜ Decomposition of additive ti
㊐⭯従侗慺⛳⢖㬳 (Tt)Ѷ

90
• Step 2

70
– Remove the trend-cycle component, i.e. de-trend the • Similar to the additive procedure except

observed
50
series : Yt – Tt = St + Et ䷻橒慺⛳⢖㬳㘬☺瑃➢〛㊬♋揊尻⟪慺⛳ⴧ䠊 ratios are taken instead of differences≆⛔䃧掶

30
• Step 3 下偹⍴瑃⠘㩆䤬㿦䞍⌛㬔⊾㈎⑴Ѷ

60
– Estimate the seasonal component

50

trend
• Gather all the de-trended values for a given period and

40
take the average.㥎檳䚀⾼㨍㬳䪈㙜㬞⟪慺⛳⑴㊓⠅㊐⭯Ѷ⏃ⶤ瑃〛
• The method is often called the “ratio-to-

30
10
⋆㬝㋃㦇㞆瑃〨㙜㬞1㬝⌵䪈 (Yt–Tt) ⑴㥎檳慦㭹従侗㊐⭯⑴瑃㎴♤1㬝⌵ moving average” method志㧐䃧搉㉖岚䷰≲“䷻⛜㊐⭯㿦䞍

5
䪈⾅噼㜟㦇Ѷ〛2㬝♤12㬝⊗⒑⠺㱋䪈㣥⎔Ѷ 䃧”Ѷ

seasonal
• The seasonal index for January is the average of all
the de-trended values for January and so on. 1㬝⌵䪈⾅

-10 -5
噼㜟㦇㩆㙜㬞1㬝⌵⟪慺⛳⑴䪈㊐⭯⑴瑃⏕㽵偹㟀Ѷ
• The set of 12 values are repeated to make up the

10
seasonal component揈12≢⑴⍒於ⴰ⎷䤬⌝㮘㘬⾅噼㘬☺Ѷ㎴♤

random
12≢⾅噼㜟㦇⠼琿⏃ⶤ瑃⌆1㬝♤12㬝瑀瑃揈⋓㜟㦇⍒㿡㊑於ⴰ瑃㍿㘬⾮

-10 0
㦋䪈⾅噼㘬☺㊬♋ StѶ 琿䃹睜搉㉖揇櫭嵲〛揈⋓㊐⭯⠼䪈⾅噼㜟㦇揊尻
念㦋瑃䱰␕⾥⌤⭐∸≢⢖㬳▼䪈㑗⢺≲0瑃〛⋆⛔䃧㸴⮳瑀Ѷ
1975 1980 1985 1990 1995
• Step 4
23 Time 24 25
– Compute the irregular component Et =Yt – Tt – St

Multiplicative Decomposition Multiplicative Decomposition


Multiplicative Decomposition
• Example: International airline passenger data; • Step 3
• Step 1 – Estimate the seasonal component
– Because the seasonal variation increases as the
– Compute trend cycle using centred 12 MA㽶溍1 ⎷䤬≥㏠❈䪈12 • Gather all the de-trended values for a given period
level of the series increases, use the multiplicative 㬳䷻⛜㊐⭯従侗慺⛳⢖㬳 (Tt)Ѷ
decomposition method揈㩆∸≢勍▯䪈㨍槢㊬♋㦇㞆瑃㉖䤬⋆忦㨥⊐ and take the average.㥎檳䚀⾼㨍㬳䪈㙜㬞⟪慺⛳⑴琿➢ Yt/Tt 䪈
䃧☺巕瑃⬉≲▮⾅噼㑃䃳⛜橼䭄⊐⿄㦇斾䪈ⳃ⛔吋⠇ⵊѶ ⑴瑀㊓⠅㊐⭯Ѷ

International airline passengers • Step 2 • The seasonal index for January is the average of all
450 – Remove the trend-cycle component, i.e. de-trend the the de-trended values for January and so on. 1㬝⌵䪈⾅
series㽶溍2 ䷻橒慺⛳⢖㬳㘬☺瑃➢〛㊬♋揊尻⟪慺⛳ⴧ䠊Ѷ揈斻㩆≆⛔䃧☺巕䪈▫ 噼㜟㦇㩆㙜㬞1㬝⌵⟪慺⛳⑴䪈㊐⭯⑴瑃⏕㽵偹㟀
400
椝❬♟Ѷ Yt • The set of 12 values are repeated to make up the
350 St Et seasonal component揈12≢⑴⍒於ⴰ⎷䤬⌝㮘㘬⾅噼㘬☺瑃㎴♤
300
Tt 䪈12≢⾅噼㜟㦇⍒㿡㊑於ⴰѶ 琿䃹睜〛⋆⊐䃧㸴⮳瑃搉㉖揇櫭嵲〛揈⋓
250
㊐⭯⠼䪈⾅噼㜟㦇揊尻念㦋瑃䱰␕⾥⌤⭐∸≢⢖㬳▼䪈㊐⭯⑴≲1瑃㘲各
㑗⢺≲⢖㬳楮㋃瑃⏃ⶤ12≢㬝䪈㑗⢺≲12瑀Ѷ
200
• This is the ratio of actual to moving averages • The seasonal component is assumed to be constant
150
from year to year⑿⾼⾅噼㘬☺㊑ⴰ∸㊑␕㜙≅⠇Ѷ
100

50
Yt
• Step 4 Et

Jul-49
Jul-50
Jul-51
Jul-52
Jul-53
Jul-54
Jul-55
Jul-56

Apr-49
Oct-49
Apr-50
Oct-50
Apr-51
Oct-51
Apr-52
Oct-52
Apr-53
Oct-53
Apr-54
Oct-54
Apr-55
Oct-55
Apr-56
Oct-56

Jan-49
Jan-50
Jan-51
Jan-52
Jan-53
Jan-54
Jan-55
Jan-56
26 27
( St u Tt ) 28
– Compute the irregular component
Multiplicative Decomposition
Forecasting and Decomposition Forecasting and Decomposition
Decomposition of multiplicat

400
• Individual components are projected into the

300
future and recombined to form a forecast of the • Seasonal component for future years can be

observed
200
underlying series〨⠲≢㘬☺☺♟汭䅜♤㬾㭹瑃䔿⠼於㧇勂⠶⌝㍿㘬〛⟎ⷭ㊬ based on the seasonal component from the last
♋䪈汭䅜Ѷ

100
full period of data㬾㭹㊑⌵䪈⾅噼㘬☺⠝⌝Ⱑ⋆㬕⠼∸≢⾮㦋㦇㞆⢖㬳䪈⾅噼
㘬☺Ѷ

250

trend
• Rarely works well since it is difficult to obtain – However if the seasonal pattern is changing over time,
adequate forecasts of the components揈䷎㧐䃧㎥〳哸㎥⶟ this will not be adequate䔿吋瑃ⶤ㮰⾅噼㸴㌬橼㨍槢⠇❈瑃揈䷎㧐䃧こ≅
⭘㈅⎔瑃⬉≲㎥檫垱㎴〛⠲㘬☺䪈╽☺汭䅜Ѷ ⵂ䤬⊾Ѷ

seasonal
• Trend-cycle component is sometimes modelled • The irregular component may be forecast as≅嶵♍㘬
as some parametric trend model such as a linear ☺䪈汭䅜⑴瑃〛⋆⛔䃧☺巕⠝⌝㩆櫣瑃〛⋆⊐䃧☺巕⠝⌝㩆∸Ѷ
or quadratic model慺⛳⢖㬳㘬☺㬞㨍岚㌗㸴≲㯤䷎⟱㦇慺⛳㸴⮳瑃⏃ⶤ劽㑃 – Zero for additive decomposition
㘲⋄㼲㸴⮳Ѷ
– One for multiplicative decomposition

random
– However for many time series, the trend-cycle
component do not follow any parametric trend model䔿吋瑃

0.90 0.95 1.00 1.050.8 0.9 1.0 1.1 1.2 150


〛⋆循ⴽ㨍槢㊬♋瑃慺⛳⢖㬳㘬☺㊓≅摤㏇⌳⎍⟱㦇慺⛳㸴⮳Ѷ
1950 1952 1954 1956

Time 29 30 31

Multiplicative Decomposition – Example


Multiplicative Decomposition ƒ 4QMA refers to 4 quarter moving average
Forecasting using Decomposition
1. Perform classical decomposition.
Example
ƒ 4QCMA refers to 4 quarter centred moving average4QCMA
2. Compute deseasonalized series, (ࡰࢋ࢙ ࢅ࢚ )従侗⟪⾅噼❈㊬♋ • Consider quarterly soft drink sales in millions of dollars of a 㜟䪈㩆4⾅㋃≥㏠䷻⛜㊐⭯
large US corporation from 1991 to 2001.
3. Estimate regression model, for instance a linear
• This time series is given in the file softdrink.xls. ƒ For example
regression model ࡰࢋ࢙ ࢅ࢚ = ࢼ૙ + ࢼ૚ ࢚ + ࢿ, with t • Use multiplicative decomposition to forecast soft drink sales • 4QMA for Q2-91: (1734.83 + 2244.96 + 2533.80 + 2154.96)/4 |
represents a time trend variable.⍨従⬇㍯㸴⮳瑃⏃ⶤ劽㑃⬇㍯㸴⮳ for the 4 quarters of 2002. 2167.14
'HV<W ȕȕt+ࣅ瑃▮≥ t ⌛屗㨍槢慺⛳⠇斾Ѷ
• 4QCMA for Q3-91: (2167.14 + 2120.39)/2 | 2143.76
4. Compute out-of-sample forecasts for deseasonalized
series, ࡰࢋ࢙
෣ࢅ࢚ = ࢼ
෡૙ + ࢼ
෡ ૚ ࢚従侗⟪⾅噼❈㊬♋䪈㱋㭀ⴹ汭䅜⑴ • Yt/4QCMA for Q3-91: 2533.80/2143.76 | 1.1819従侗Q3-91䪈⟎ⷭ棯⥛沆
(2533.80) ≆▮慺⛳⍨従⑴ (2143.76) 䪈㿦䞍瑃㎴♤志⾅㋃䪈⾅噼-≅嶵♍⬉⽲
5. Compute forecasts of ࢅ࢚ depending on the type of
classical decomposition used:㱍㞆㙜⎷䤬䪈勍▯☺巕偹⮳従侗 Yt 䪈汭 • St for Q1 of each year: Average of 1st quarter de-trended sales
䅜⑴ for 1991 to 2001 (0.7661 + . . . + 0.8817 + 0.8882)/8 | 0.8804
• This implies that that 1st quarter soft drink sales is
x Additive: ࢅ
෡ ࢚ = ࡰࢋ࢙
෣ࢅ࢚ + ࡿ࢚
(100 – 88.04)% = 11.96% below the quarterly average.揈㔫⢡䭄伬
∸⾅㋃䪈捜浗㦰棯⥛沆㿦⾅㋃㊐⭯䁆㊐⎆ (100 – 88.04)% = 11.96%Ѷ⬉≲㩆⊐䃧
x Multiplicative: ࢅ
෡ ࢚ = ࡰࢋ࢙
෣ࢅ࢚ × ࡿ࢚ 32 33 㸴⮳瑃⾅噼㜟㦇䪈Ⱑ◼㩆1Ѷ0.8804〱⋆1瑃屗䴻志⾅㋃䪈棯⥛沆搉㉖⎆⋆㊑㊐⭯ 34
䁆㊐䪈 í ➢ 11.96%Ѷ
Multiplicative Decomposition – Example Multiplicative Decomposition - Example
Multiplicative Decomposition - Example
• The regression-based linear trend model fitted to the de-
• St for Q3 of each year: Average of 3rd quarter de- seasonalized sales is
trended sales for 1991 to 2001 Soft drink Sales
SUMMARY OUTPUT
(1.1819 + 1.0305 + . . . + 1.0765)/8 | 1.0651
Regression Statistics
Multiple R 0.9618
R Square 0.9251
This implies that that 3rd quarter soft drink sales is Trend Cycle Adjusted R Square 0.9233
Standard Error 280.7160
(106.51-100) = 6.51% above the quarterly average.揈 Observations 44
㔫⢡䭄伬≁⾅㋃䪈捜浗㦰棯⥛沆㿦⾅㋃㊐⭯䁆㊐滂 (106.51-100)% = 6.51%Ѷ
ANOVA

df SS MS F Significance F
• Et for Q3-91: 1.1819/1.0651 = 1.1097 Regression 1 40856212.85 40856212.85 518.47 2.96812E-25
Residual 42 3309661.75 78801.47
De-trended Sales Total 43 44165874.60

• Des Yt for Q1-91: 1734.83/0.88 | 1970.51⟪⾅噼❈棯⥛ Coefficients Standard Error t Stat P-value Lower 95% Upper 95%
Intercept 1380.3410 86.1027 16.0313 0.0000 1206.5788 1554.1032
沆 X Variable 1 75.8845 3.3327 22.7699 0.0000 69.1589 82.6100

Irregular Des Yt 1380.3410  75.8845 t


• Note that the | sign is used because of Component
approximations due to rounding errors. The linear fit is very good (R2 = 0.9251) and
35 36 is valid (t-Stat = 22.77; p-value = 0)揈屗㨥㨍槢慺⛳⠇斾t〛⟪⾅噼❈棯⥛沆
37
㬞歊㉖㩕塎䪈劽㑃㎎⣻Ѷ

Multiplicative Decomposition Multiplicative Decomposition - Example


Example
ƒ For example for AA037007
• Q1 - 91: t = 1 Des F1 = Des Y1 1380.341  75.8845 1 | 1456.23
• Q4 - 02: t = 48 Des F48 = Des Y 1380.341  75.8845 48 | 5022.8 Time Series Analysis
48

• Multiplying the de-seasonalized sales forecast by the


corresponding seasonal index gives the forecast of the Lecture 2
original soft drink series〨⟪⾅噼❈棯⥛沆䪈汭䅜⑴⊐⌝䫼㊱䪈⾅噼㜟㦇瑃➢⠝
㎴♤⟎ⷭ捜浗㦰㊬♋䪈汭䅜⑴Ѷ

ƒ For example for Moving average and Classical


• Q1 – 91: t = 1 S1 = 0.8804; Decomposition Model.
F1 = S1 x Des F1 = 0.8804 x 1456.23 | 1282.06
• Q4 - 02: t = 48 S4 = 0.9614;
F48 = S4 x Des F48 = 0.9614 x 5022.8 | 4828.92
38 39
Problems with classical Other decomposition methods Other decomposition methods
https://otexts.com/fpp3/methods-used-by-official-statistics-agencies.html https://otexts.com/fpp3/methods-used-by-official-statistics-agencies.html
decomposition https://otexts.com/fpp3/stl.html https://otexts.com/fpp3/stl.html
https://otexts.com/fpp3/classical-decomposition.html
SEATS method
X-11 method • “SEATS” stands for “Seasonal Extraction in ARIMA Time
• The estimate of the trend-cycle is unavailable for the first few • The X-11 method originated in the US Census Bureau and was Series”.
and last few observations.慺⛳㏇䞵⍨従䪈匸ⵔ睜〛⋆㊬♋㬕♑⢺㬕⠼☕≢ further developed by Statistics Canada. It is based on classical • This procedure was developed at the Bank of Spain and is now
嶳䅜⑴瑃㧷䃧㎴♤慺⛳㏇䞵䪈⍨従⑴Ѷ decomposition but includes many extra steps and features in widely used by government agencies around the world.
• The trend-cycle estimate tends to over-smooth rapid rises and order to overcome the drawbacks of classical decomposition.
STL decomposition
falls in the data.掶㋃㊐䋞睜慺⛳㏇䞵䪈⍨従⑴㎝㎝⍒掶㋃㊐䋞㦇㞆≥䪈㐇搎 • In particular, trend-cycle estimates are available for all
≂❹⢺≃樻Ѷ observations including the end points, and the seasonal • STL is an acronym for “Seasonal and Trend decomposition
component is allowed to vary slowly over time.慺⛳㏇䞵⍨従⑴揱䤬 using Loess”, while loess is a method for estimating nonlinear
• Classical decomposition methods assume that the seasonal relationships. “STL” 㩆 “Seasonal and Trend decomposition using Loess”琿⎷䤬 Loess
⋆㙜㬞嶳䅜⑴瑃✷㜄仯䓂Ѷ╹循⾅噼㑃㘬☺橼㨍槢匑㕾⠇❈Ѷ
component repeats from year to year. For many series, this is a 䪈⾅噼㑃⢺慺⛳☺巕瑀䪈匧◐瑃吋 Loess 㩆∸䷎⍨従歊劽㑃▫價䪈㧐䃧Ѷ
reasonable assumption, but for some longer series it is not.⾅噼 • X-11 also handles trading day variation, holiday effects and the
㑃㘬☺䪈⬢⾼㑃睜勍▯☺巕䃧⑿徰⾅噼㑃㘬☺㊑ⴰ∸㊑⭘於ⴰѶ 〛⋆㎥ⴽ㊬♋㭹 effects of known predictors.哸ⵂⴧ䠊⋜㨪㧼⠇⛜ѵ⑿㧼㥠㊱⌝⟹㈒䯨汭䅜 • STL has several advantages over classical decomposition, and
忦瑃揈㩆∸≢⠶䠊䪈⑿徰瑃⍾〛⋆∸⋓捰楮䪈㊬♋♍≅䔿Ѷ ⠇斾䪈㎎⣻Ѷ the SEATS and X-11 methods:
• Occasionally, the values of the time series in a small number of • There are methods for both additive and multiplicative i. Unlike SEATS and X-11, STL will handle any type of
periods may be particularly unusual. The classical method is not decomposition.⠺㨍㟨⏓⛔䃧⢺⊐䃧☺巕㸴⮳Ѷ seasonality, not only monthly and quarterly data.≆ SEATS ⢺ X-11
≅⠺瑃STL ⠝⌝ⴧ䠊⌳⎍偹⮳䪈⾅噼㑃瑃吋≅⋽⋽㩆㬝㋃㘲⾅㋃㦇㞆Ѷ
robust to these kinds of unusual values.〛㌟㉖⑴㥧㔻睜⭐〳㦇㨍㬳瑃 • The process is entirely automatic and tends to be highly robust
㨍槢㊬♋䪈㦇⑴⠝哸䚀♟≅〝㉖Ѷ 勍▯㧐䃧〛揈偹㌟㉖⑴≅相㬞丳⒜㑃Ѷ ii. The seasonal component is allowed to change over time, and
to outliers and level shifts in the time series.㦋≢掶下⾮■嗤⛜❈瑃㊓ the rate of change can be controlled by the user.╹循⾅噼㑃㘬☺橼㨍
2 ≌〛㨍槢㊬♋≥䪈㌟㉖⑴⢺䁆㊐⠇❈相㬞滂㋃䪈丳⒜㑃Ѷ 3 4
槢⠇❈瑃㊓≌䤬㙓⠝⌝㞿♪▮⠇❈搎䞍Ѷ

Other decomposition methods


https://otexts.com/fpp3/methods-used-by-official-statistics-agencies.html
https://otexts.com/fpp3/stl.html

STL decomposition
iii. The smoothness of the trend-cycle can also be controlled by
the user.䤬㙓⊗⠝⌝㞿♪慺⛳㏇䞵䪈㊐䋞㋃Ѷ
iv. It can be robust to outliers (i.e., the user can specify a robust
decomposition), so that occasional unusual observations will
not affect the estimates of the trend-cycle and seasonal
components. They will, however, affect the remainder
component.〛㌟㉖⑴相㬞丳⒜㑃琿➢䤬㙓⠝⌝㜟⾼丳⒜☺巕瑀瑃⬉㽵⒭〶☯
䞶䪈㌟㉖嶳䅜⑴≅⍒㎎⣻慺⛳㏇䞵⢺⾅噼㑃㘬☺䪈⍨従Ѷ ⍾㩆瑃⾥⌤⍒㎎⣻㾝
㈎汢Ѷ
• Disadvantages of STL decomposition:
i. It does not handle trading day or calendar variation
automatically.≅哸嗤⛜ⴧ䠊⋜㨪㧼㘲㧼➵⠇⛜Ѷ
ii. It only provides facilities for additive decompositions.⋽㟨⏓⛔䃧☺
巕䪈⛓哸Ѷ

You might also like