Lecture1 2
Lecture1 2
trend
time.
where;
-3
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
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
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
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
• 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] ❬槢▼Ѷ
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
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 ⊗⍒☯䞶⬘檫瑃⬉≲㧷䃧従侗䪂☺㿦忡㈎Ѷ
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: 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
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䔿吋瑃
Time 29 30 31
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
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.⋽㟨⏓⛔䃧☺
巕䪈⛓哸Ѷ