You are on page 1of 42

DECOMPOSITION

METHODS
S T Q S 3 11 3 S TAT I S T I C A L M O D E L L I N G

DR. RAZIK RIDZUAN


INTRODUCTION
• Recall that a time series has 4 major components
– Trend, Cycle, Seasonal variations, Irregular fluctuations
• The decomposition methods – Decompose / Separate a time series to its four
components.
• The decomposition models are useful when the parameters describing a time
series are not changing over time.
• The decomposition models are:
– Multiplicative decomposition model – increasing/decreasing seasonal
variation.
– Additive decomposition model – constant seasonal variation.
2
RECALL – TIME SERIES COMPONENTS

• Trend
– long term movement in a time series.
– direction (upward/downward tendency) and rate of change in a time series.
– i.e. linear, quadratic,…
• Seasonal
– the component of variation in a time series which is dependent on the time
of year.
– A seasonal pattern exists when a series is influenced by seasonal factors
(e.g., the quarter of the year, the month, or day of the week)
3
RECALL – TIME SERIES COMPONENTS
• Cyclical
– data exhibit rises and falls that are not of fixed period.
– cycle has a longer duration.
– it is a non-seasonal component which varies in a recognizable cycle.
• Irregular
– left over when the other components of the series (trend, seasonal and
cyclical) have been accounted for.
– i.e. error or remainder.

4
EXAMPLE 1 – MONTHLY SALES OF SOUVENIRS

• Command in R
decompose(timeseriesdata, type = “multiplicative”)
5
MULTIPLICATIVE DECOMPOSITION METHOD
• The multiplicative decomposition model deal with a time series that exhibit
increasing or decreasing seasonal variation.
• This model can be written as

where
= the observed time series at time
= the trend component at time
= the seasonal component at time
= the cyclical component at time
= the irregular component at time
6
MOVING AVERAGE (MA)
• A method to estimate the trend-cycle component
• A moving average (MA) of order , is

where .
• The average eliminates some of the randomness in the data.
• The order is usually selected based on the number of seasons or type of data.
• For example,
– For monthly data,

7
8
CENTERED MOVING AVERAGE (CMA)

• A moving average to the moving average


• It makes an even-order MA symmetric
• A CMA of order 3, is

9
10
REVISIT EXAMPLE 1
MONTHLY SALES OF SOUVENIRS

• Let , , and denote the estimate for factors , , and .


• The calculations involve the moving average (MA) and centered moving
average () at time period .
• MA and can eliminate the seasonal variations and irregular fluctuations from
the data.
• Since the data is monthly, we select order for our MA.

11
Step 1 – Calculate MA
• 1st MA

• 2nd MA

• MA for 3rd , 4th and so on, were computed similarly until the value for is
included in the last moving average. We will have 73 MA values.
• The 1st MA corresponds to a time that is midway between period 6 and 7.

12
MA-12
1 1664.81
2 2397.53
3 2840.71
4 3547.29
5 3752.96
6 3714.74
7 4349.61 5386.34
8 3566.34 5455.93
9 5021.82 5689.32
10 6423.48 6054.69
11 7600.60 6159.58
12 19756.21 6338.58
13 2499.81 6441.63
14 5198.24 6594.08
15 7225.14 6692.90
16 4806.03 6732.45
17 5900.88 6683.42
18 4951.34 7100.04
19 6179.12 7832.17
20 4752.15 8016.94

13
Step 2 – Calculate
• The are two period MA of the previously computed for 12-period
• 1st

• 2nd

• for 3rd , 4th and so on, were computed similarly until the value for all MAs
have been included. We will have 72 values.
• Since eliminates seasonal and irregular fluctuations, can be denoted as

14
MA-12
1 1664.81
2 2397.53
3 2840.71
4 3547.29
5 3752.96
6 3714.74
7 4349.61 5386.34 5421.13
8 3566.34 5455.93 5572.62
9 5021.82 5689.32 5872.00
10 6423.48 6054.69 6107.13
11 7600.60 6159.58 6249.08
12 19756.21 6338.58 6390.10
13 2499.81 6441.63 6517.85
14 5198.24 6594.08 6643.49
15 7225.14 6692.90 6712.68
16 4806.03 6732.45 6707.94
17 5900.88 6683.42 6891.73
18 4951.34 7100.04 7466.11
19 6179.12 7832.17 7924.55
20 4752.15 8016.94 8037.95

15
Step 3 – Compute seasonal variation
• Since

Thus,

• The estimate will be

• For example,

16
MA-12
1 1664.81
2 2397.53
3 2840.71
4 3547.29
5 3752.96
6 3714.74
7 4349.61 5386.34 5421.13 0.8023
8 3566.34 5455.93 5572.62 0.6400
9 5021.82 5689.32 5872.00 0.8552
10 6423.48 6054.69 6107.13 1.0518
11 7600.60 6159.58 6249.08 1.2163
12 19756.21 6338.58 6390.10 3.0917
13 2499.81 6441.63 6517.85 0.3835
14 5198.24 6594.08 6643.49 0.7825
15 7225.14 6692.90 6712.68 1.0763
16 4806.03 6732.45 6707.94 0.7165
17 5900.88 6683.42 6891.73 0.8562
18 4951.34 7100.04 7466.11 0.6632
19 6179.12 7832.17 7924.55 0.7797
20 4752.15 8016.94 8037.95 0.5912

17
Step 4 – Find the average seasonal estimate, according to the month
• January: (0.3835+0.5507+0.5519+0.4423+0.4947+0.4061)/6=0.4715
• February: 0.6004

• December: 3.1273

Step 5 – Normalize the seasonal estimate

where

18
Step 6 – Estimate the seasonal component

Step 7 – Deseasonalize the observations at time

19
MA-12
1 1664.81 0.4745 3508.26
2 2397.53 0.6042 3967.83
3 2840.71 0.9829 2890.17
4 3547.29 0.6568 5400.78
5 3752.96 0.6749 5561.12
6 3714.74 0.6794 5467.70
7 4349.61 5386.34 5421.13 0.8023 0.7779 5591.57
8 3566.34 5455.93 5572.62 0.6400 0.7650 4662.09
9 5021.82 5689.32 5872.00 0.8552 0.8356 6009.68
10 6423.48 6054.69 6107.13 1.0518 0.9217 6969.15
11 7600.60 6159.58 6249.08 1.2163 1.4797 5136.41
12 19756.21 6338.58 6390.10 3.0917 3.1473 6277.20
13 2499.81 6441.63 6517.85 0.3835 0.4745 5267.86
14 5198.24 6594.08 6643.49 0.7825 0.6042 8602.91
15 7225.14 6692.90 6712.68 1.0763 0.9829 7350.95
16 4806.03 6732.45 6707.94 0.7165 0.6568 7317.22
17 5900.88 6683.42 6891.73 0.8562 0.6749 8743.89
18 4951.34 7100.04 7466.11 0.6632 0.6794 7287.85
19 6179.12 7832.17 7924.55 0.7797 0.7779 7943.47
20 4752.15 8016.94 8037.95 0.5912 0.7650 6212.23

20
Step 8 – Estimate trend using
linear regression for time series

where .
We will get

Initial fitted/estimated model

21
Step 9 – Compute Cyclical component
• Since

Thus,

• The estimate will be

• For monthly or quarterly data, the can be average out using three consecutive
values, resulting in

22
1 1664.81 493.31 3.3748
2 2397.53 813.26 2.9480 2.6907
3 2840.71 1624.01 1.7492 2.4849
4 3547.29 1286.47 2.7574 2.3206
5 3752.96 1528.57 2.4552 2.4463
6 3714.74 1747.00 2.1264 2.1749
7 4349.61 2238.58 1.9430 1.8445
8 3566.34 2435.76 1.4642 1.7096
9 5021.82 2916.75 1.7217 1.6738
10 6423.48 3499.59 1.8355 1.6030
11 7600.60 6071.78 1.2518 1.5036
12 19756.21 13878.38 1.4235 1.2641
13 2499.81 2237.92 1.1170 1.4178
14 5198.24 3034.72 1.7129 1.4031
15 7225.14 5237.53 1.3795 1.4636
16 4806.03 3701.20 1.2985 1.3832
17 5900.88 4009.64 1.4717 1.3122
18 4951.34 4244.76 1.1665 1.2834
19 6179.12 5098.43 1.2120 1.0946
20 4752.15 5248.12 0.9055 1.0117

23
Step 10 – Compute Irregularity component
• The estimate will be

• In fitted model
• If are close to 1 for most , then is sufficient.
• If are close to 1 for most , then is sufficient.

24
1 1664.81 493.31 3.3748
2 2397.53 813.26 2.9480 2.6907 1.0957
3 2840.71 1624.01 1.7492 2.4849 0.7039
4 3547.29 1286.47 2.7574 2.3206 1.1882
5 3752.96 1528.57 2.4552 2.4463 1.0036
6 3714.74 1747.00 2.1264 2.1749 0.9777
7 4349.61 2238.58 1.9430 1.8445 1.0534
8 3566.34 2435.76 1.4642 1.7096 0.8564
9 5021.82 2916.75 1.7217 1.6738 1.0286
10 6423.48 3499.59 1.8355 1.6030 1.1450
11 7600.60 6071.78 1.2518 1.5036 0.8325
12 19756.21 13878.38 1.4235 1.2641 1.1261
13 2499.81 2237.92 1.1170 1.4178 0.7878
14 5198.24 3034.72 1.7129 1.4031 1.2208
15 7225.14 5237.53 1.3795 1.4636 0.9425
16 4806.03 3701.20 1.2985 1.3832 0.9388
17 5900.88 4009.64 1.4717 1.3122 1.1215
18 4951.34 4244.76 1.1665 1.2834 0.9089
19 6179.12 5098.43 1.2120 1.0946 1.1072
20 4752.15 5248.12 0.9055 1.0117 0.8950

25
26
27
FORECASTING USING MULTIPLICATIVE
DECOMPOSITION

• Since , .
• Since in this example,

• For example,

• But what is the value of ? Recall that the seasonal factor for a particular season
is constant. So,

28
But what is the value of ?
• One possible way is to predict the
cycle component using time series
regression.

• At , .

29
FORECASTING USING MULTIPLICATIVE
DECOMPOSITION

• Assuming , .
• Since in this example,

• For example, .
• But what is the value of ? Recall that the seasonal factor for a particular season
is constant. So,

30
• The prediction interval for is:

where can be obtain from the prediction interval for model.


• Prediction interval at time is

where is the time step, is the length of time series where is the number of
independent variable and the standard error is

• When , linear trend for the time series regression.


• When , quadratic trend for the time series regression.

31
ADDITIVE DECOMPOSITION MODEL

• The additive decomposition model deals with a time series which exhibit
constant seasonal variation.
• The model can be written as

• Consider the beer production time series data

32
• Command in R
decompose(timeseriesdata, type = “additive”)
33
Step 1 – Calculate

Step 2 – Calculate the estimated seasonal and irregular component

Step 3 – Compute the average seasonal factor, and find the estimated
normalized seasonal component

34
Step 4 – Compute the deseasonalized observation

Step 5 – Fit the trend component.


If it is linear, the estimated model for trend component becomes

Step 6 – Compute the estimate for cycical and irregular fluctuation


components

Step 7 – Estimate

35
Step 8 – Estimate the irregular component

Note
If or have values close to zeroes , then the component is not significant. The
final fitted model can be writen as

36
OTHER USEFUL DECOMPOSITION METHODS
(NON-CLASSICAL METHODS)

• x11 decomposition method


– Allows the seasonal component to change slowly (over time)
– No missing observations
• STL decomposition method
– Robust to outliers
– Handles any type of seasonality
– But only works for monthly and quarterly data

37
38
39
40
41
42

You might also like