0% found this document useful (0 votes)
22 views21 pages

Time Series Decomposition Techniques

1) The document discusses various time series decomposition techniques including simple moving averages, differencing, and seasonal adjustment. 2) Simple moving averages involve calculating the average of observations over a set number of past periods to smooth out variations and generate forecasts. Differencing involves calculating the differences between observations to remove trends and achieve stationarity. 3) Seasonal adjustment techniques like centered moving averages aim to average out seasonal variations in data so that the underlying trend is estimated. Higher-order differencing can further remove trends in non-stationary time series data.

Uploaded by

General Master
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)
22 views21 pages

Time Series Decomposition Techniques

1) The document discusses various time series decomposition techniques including simple moving averages, differencing, and seasonal adjustment. 2) Simple moving averages involve calculating the average of observations over a set number of past periods to smooth out variations and generate forecasts. Differencing involves calculating the differences between observations to remove trends and achieve stationarity. 3) Seasonal adjustment techniques like centered moving averages aim to average out seasonal variations in data so that the underlying trend is estimated. Higher-order differencing can further remove trends in non-stationary time series data.

Uploaded by

General Master
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

2.

TIME SERIES DECOMPOSITION

2.1 Simple Moving Average (SMA)


When a time series pattern does not exhibit trends or seasonal characteristics
calculation of a moving average may be useful in cancelling out the random variation,
so that short-term forecasts can be generated.

This method consists of simply averaging the available observation over the most
recent ' M ' periods and using this average as the forecast of the next observation.
t+k
t-k
A moving average of order m can be written as

t-4 t t+4
k
mˆ t = ∑ wyt +i where, 9-MA: Means: m = 2k + 1, Where m = 9
i =− k

1
where w = and m = 2k + 1 . Thus, the estimate of the trend-cycle at time t is
m
obtained by averaging of the time series within k periods of t .

We call this an m-MA , i.e., a ' m ' order simple moving average.

The simple moving average method does not allow estimates of mt where t
is close to the ends of the series.

The order of the simple moving average determines the smoothness of the
trend-cycle estimate. In general, a larger order means a smoother curve.

In a moving average of order m = 2k + 1 , there are k earlier observations, k


later observations and the middle observation that are averaged, hence,
symmetric. If m is even, it would no longer be symmetric

1
It is possible to apply a moving average to a moving average. A rationale is to
make an even-order moving average symmetric. For example, 2 × 4-MA ,
means a 4-MA followed by a 2-MA

Example 2.1.1
The manager of a company wants to forecast the demand for deliveries during the next
month. The historical data is tabulated below.
Month Jan Feb Mar Apr May Jun Jul Aug Sep Oct
Orders 120 90 100 75 110 50 75 130 100 90

Compute the monthly demand forecast, using a


(a) 3-month moving average
(b) 5-month moving average.

Solution 2.21

time 3-MA 5-MA


yt −1 + yt + yt +1 yt −2 + yt −1 + yt + yt +1 + yt + 2
Orders 3 5
1 120 * *
2 y1 + y2 + y3
90 3
= 120+90
3
+100
= 103.33 *
3 y2 + y3 + y4
3
= 90+100
3
+ 75
= 88.33 y1 + y2 + y3 + y4 + y5
= 120+90+100 + 75+110
= 99
100 5 5
4 75 95 85
5 110 78.33 82
6 50 78.33 88
7 75 85 93
8 130 101.67 89
9 100 106.67
10 90

Forecast: yˆ11 = 106.67 and yˆ11 = 89

2
2.2.1 Trend-cycle with seasonality
The most common use of centred moving average is in estimating the trend-cycle from
seasonal data.

Consider the 2 × 4-MA :

mˆ t = 12  14 ( yt −2 + yt −1 + yt + yt +1 ) + 14 ( yt −1 + yt + yt +1 + yt + 2 ) 

= 18 yt −2 + 14 yt −1 + 14 yt + 14 yt +1 + 18 yt + 2

When applied to quarterly data, each quarter of the year is given equal weight as the
first and the last terms apply to the same quarter in consecutive years.

Consequently, the seasonal variation will be averaged out and the resulting values of
mˆ t will have little or no seasonal variation remaining.

If the seasonal period is even and of order m , use a 2 × m-MA to estimate the
trend-cycle.

If the seasonal period is odd and of order m , use a m-MA to estimate the
trend-cycle.

3
2.2 Differencing
This procedure is useful for removing a trend, it is simply to difference the series until
it becomes stationary. For non-seasonal data, first-order differencing is usually
sufficient to attain apparent stationarity.
Thus, a new series { x2 ,...., xn } is formed from the original observed series, { y1,...., yn }
by
xt = yt − yt −1 = ∇yt for t = 2,3,..., n

To forecast a one-step ahead: ∇


ˆ y = yˆ − y
t t t −1

Consider the expression ∇yt = yt − yt −1


Now
∇ 2 yt = ∇ ( ∇yt )
= ∇ ( yt − yt −1 )
= ∇yt − ∇yt −1
= ( yt − yt −1 ) − ( yt −1 − yt − 2 )
= yt − 2 yt −1 + yt −2

Alternatively, since D ≡ 1− B

D 2 yt = (1 − B ) yt
2
so:

(
= 1 − 2 B + B 2 yt )
= yt − 2 yt −1 + yt −2

4
Example 2.2.1
Consider the sales data below. We wish to forecast sales for period 9 by taking the
first-order difference, then a 3-point moving average on the first-order difference.

t 1 2 3 4 5 6 7 8 9
yt 16 22 29 35 42 48 55 60

Solution 2.2.1

t yt ∇yt 3-MA
1 16 - -
2 22 6 *
3 29 7 6.33
4 35 6 6.67
5 42 7 6.33
6 48 6 6.67
7 55 7 6.00
8 60 5

Now, 3-MA estimate for the data in period 9 would be 6.00.

The forecast for month 9, ŷ9 can be derived as follows:

When t = 9 : ∇
ˆ y = yˆ − y
9 9 8 i.e. 6 = yˆ9 − 60 ⇒ yˆ9 = 66

Dyt = (1 − B ) yt = yt − yt −1

5
Example 2.2.2
Consider the sales data below. We wish to forecast sales for period 9, by taking the
second-order difference, then a 3-point moving average on the second-order
difference.

Time ( t ) 1 2 3 4 5 6 7 8 9

Sales ( y ) 1 7 17 30 47 68 94 124

Solution 2.2.2

t yt ∇yt ∇ 2 yt 3-MA
1 1 - - -
2 7 6 - *
3 17 7 4 *
4 30 6 3 3.67
5 47 7 4 3.67
6 68 6 4 4.33
7 94 7 5 4.33
8 124 5 4

Second difference: ∇ 2 yt = yt − 2 yt −1 + yt −2
Forecast: ∇
ˆ 2 y = yˆ − 2 y + y
t t t −1 t −2

When t = 9 :

ˆ 2 y = yˆ − 2 y + y
9 9 8 7 i.e. 4.33 = yˆ9 − 2 (124 ) + 94 ⇒ yˆ9 = 158.33

6
Example 2.2.3
Consider the sales data below. We wish to forecast sales for period 9, by taking the
third-order difference, then a 2-point moving average on the third-order difference.

Time ( t ) 1 2 3 4 5 6 7 8 9

Sales ( y ) 15 27 20 33 58 78 42 57

2*2-MA: 1/2 * {1/2[y_t-1 + y_t] + 1/2[y_t + y_t+1] }

Solution 2.2.3
2-MA: 1/2[y_t-1 + y_t]

t yt ∇yt ∇ 2 yt ∇3 yt 2-MA
1 15 - - - -
2 27 12 - - -
3 20 -7 -19 - -
4 33 13 20 39 *
5 58 25 12 -8 15.5
6 78 20 -5 -17 -12.5
7 42 -36 -56 -51 -34
8 57 15 51 107 28
9 28

Forecast: ∇
ˆ 3 y = yˆ − 3 y + 3 y − y
t t t −1 t −2 t −3

When t = 9 : ∇
ˆ 3 y = yˆ − 3 y + 3 y − y
9 9 8 7 6

28 = yˆ9 − 3 ( 57 ) + 3 ( 42 ) − 78
⇒ yˆ9 = 151

D3 yt = (1 − B ) yt
3

(
= 1 − 3B + 3B 2 − B3 yt )
= yt − 3 yt −1 + 3 yt −2 − yt −3

7
2.5 Seasonal variation
The time plot should be examined to see which model, whether additive or
multiplicative is likely to give a better description.

The seasonal indices {st } are usually assumed to change slowly through time, so that
st ≃ st −m , where ' m ' is the number of observations per year.

The indices are usually normalised so that they


(a) sum to zero for the additive model
(b) average to one for the multiplicative model

(i) With monthly data, the most common way to eliminate seasonal effect is to
calculate

1x
2 t −6
+ xt −5 + xt −4 + ..... + xt +5 + 12 xt +6
xt =
12

The two end coefficients are different from the rest, but coefficients sum
to unity

A simple moving average cannot be used as this would span 12 months


and would not centred on an integer value of ' t '

A simple moving average over 13 months cannot be used, as this would


give twice as much weight to the month appearing at both ends

8
(ii) For quarterly data, the seasonal effect can be removed by calculating

1x
2 t −2
+ xt −1 + xt + xt +1 + 12 xt + 2
xt =
4

For 4-weekly data, one can use a simple moving average over 13
successive observations

A check should be made that the seasonal are reasonably stable, and then the
average monthly, or quarterly effects can be calculated.

Seasonal differencing can also be used to eliminate seasonal effect. For example,
with monthly data one can employ the operator

∇12 yt = yt − yt −12 i.e. one year to the next

9
2.6 Classical Decomposition of time series
A classical approach to time series analysis is to decompose the series into its
components.

(i) Trend (Tt ) : a smooth long-term movement

(ii) Seasonal effect ( St ) : periodic by nature

(iii) Cyclical effect ( Ct ) : other movements such as trade or economic cycles

(iv) Irregular event ( I t ) : remaining variation; could be white noise (random) or have
a structure (not random)

The idea is to create separate models for these four elements and then combine them,
either additively
Yt = Tt + St + Ct + I t
or multiplicatively
Yt = Tt × St × Ct × I t

In classical decomposition, we assume the seasonal components is constant from year


to year.

10
2.6.1 Basic Steps in Decomposition

(i) The first step is to estimate the trend. Two different approaches with many
variations of each.
One approach is to estimate the trend with a smoothing procedure such
as moving averages. With this approach, no equation is used to describe
trend
The second approach is to model the trend with a regression equation

(ii) The second step is to ‘de-trend’ the series.


For an additive decomposition, this is done by subtracting the trend
estimates from the series.
For multiplicative decomposition, this is by dividing the series by the
trend values.

(iii) Seasonal factors are estimated using the de-trended series.


For monthly data, this entails estimating an effect for each month of the
year.
For quarterly, estimating an effect for each quarter. The simplest way is
to average the detrended values for a specific season. For example, to
get a seasonal effect for January, we average the de-trended values for all
January in the series, and so on. (Minitab uses medians, rather than
means)
The seasonal effects are usually adjusted so that they average to zero for an
additive decomposition, and, they average to 1 for a multiplicative
decomposition.

(iv) The final step is to determine the random component.


For additive model:- random = series – trend – seasonal
For multiplicative model:- random = series/(trend*seasonal)

(v) In step (iii), we could use the seasonal factors to de-seasonalise the series and
then return to step (i) to estimate the trend based on the de-seasonalised series.
Minitab does this (and estimates the trend with a straight line in the iteration).

11
2.6.2 Additive Model
The additive model is useful when:-
The behaviours of the components are independent from each other. For
instance, an increase in the trend-cycle will not cause an increase in the
magnitude of seasonal dips and troughs.

The difference of the trend and the raw data is roughly constant in similar
periods (months, quarters) irrespectively of the tendency of the trend.

The pattern of seasonal variation is roughly stable over the year, i.e. the seasonal
movements are the approximately same from year to year.

Example, monthly Australian beer production in millions of litres. The time series runs
from January 1956 to August 1995.

• Increasing trend (linear, quadratic?)


• Seasonal (monthly) effect

12
Example 2.6.1
Table 1 shows the quarterly sales for Toys Intl for the years 2000 to 2005. The sales
are reported in millions of dollars.
Year Winter Spring Summer Autumn
2000 6.7 4.6 10.0 12.7
2001 6.5 4.6 9.8 13.6
2002 6.9 5.0 10.4 14.1
2003 7.0 5.5 10.8 15.0
2004 7.1 5.7 11.1 14.5
2005 8.0 6.2 11.4 14.9

Solution 2.6.1
First we plot the data.

T ime S e r ie s P l o t o f s a l e s

15 .0

12 .5
sales

10 .0

7 .5

5 .0

2 4 6 8 10 12 14 16 18 20 22 24
Ind e x

Notice the seasonal nature of the sales. For each year, the fourth-quarter sales are the
largest and the second-quarter sales are the smallest. Also, there is a moderate increase
in the sales from one year to the next. Over the six-year period, the sales in the fourth
quarter increased (bold in the table).

13
Let us assume that an additive model is suitable and there is no cyclical effect.

So our model, Yt = Tt + St + I t

Also, since quarterly data, we use a 4-point centred moving average to smooth/remove
seasonal effect

1x
2 t −2
+ xt −1 + xt + xt +1 + 12 xt + 2
xt =
4

Adj.
Year t Quarter Sales ($M) 4-MA Index Index IRR
2000 1 winter 6.7
2 spring 4.6
3 summer 10 8.475 1.525 1.305 0.22
4 autumn 12.7 8.45 4.25 4.795 -0.545
2001 5 winter 6.5 8.425 -1.925 -2.16 0.235
6 spring 4.6 8.5125 -3.9125 -3.95 0.0375
7 summer 9.8 8.675 1.125 1.305 -0.18
8 autumn 13.6 8.775 4.825 4.795 0.03
2002 9 winter 6.9 8.9 -2 -2.16 0.16
10 spring 5 9.0375 -4.0375 -3.95 -0.0875
11 summer 10.4 9.1125 1.2875 1.305 -0.0175
12 autumn 14.1 9.1875 4.9125 4.795 0.1175
2003 13 winter 7 9.3 -2.3 -2.16 -0.14
14 spring 5.5 9.4625 -3.9625 -3.95 -0.0125
15 summer 10.8 9.5875 1.2125 1.305 -0.0925
16 autumn 15 9.625 5.375 4.795 0.58
2004 17 winter 7.1 9.6875 -2.5875 -2.16 -0.4275
18 spring 5.7 9.6625 -3.9625 -3.95 -0.0125
19 summer 11.1 9.7125 1.3875 1.305 0.0825
20 autumn 14.5 9.8875 4.6125 4.795 -0.1825
2005 21 winter 8 9.9875 -1.9875 -2.16 0.1725
22 spring 6.2 10.075 -3.875 -3.95 0.075
23 summer 11.4
24 autumn 14.9

14
Seasonal Year Winter Spring Summer Autumn
Index
2000 1.525 4.25
2001 -1.925 -3.9125 1.125 4.825
2002 -2 -4.0375 1.2875 4.9125
2003 -2.3 -3.9625 1.2125 5.375
2004 -2.5875 -3.9625 1.3875 4.6125
2005 -1.9875 -3.875
Total -10.8 -19.75 6.5375 23.975
mean -2.16 -3.95 1.3075 4.795
median -2 -3.9625 1.2875 4.825

R-Code
eg261=[Link]("[Link]",header=T)
sal=ts(eg261,freq=4)
plot(sal)
[Link]=decompose(sal,type="additive")
[Link]
plot([Link])

15
2.6.3 Multiplicative Model
The multiplicative model is useful when:-

The seasonal and irregular fluctuations changes in a specific manner, as a result


of the behaviour of the trend. In this type of relationship the amplitude of the
seasonality increase (decrease) with an increasing (decreasing) trend, therefore,
on the contrary to the additive case, the components are not independent from
each other.

The seasonal variation increases or decreases over time. This is more prevalent
in economic series since most seasonal economic series have seasonal variation,
which increases or decreases with the level of the series.
For example, the quarterly earnings for Johnson and Johnson Corporation. The
seasonal variation increases as we move across time.

Johnson and Johnson Corporation Quaterly Earnings


15
uarterlyEarningsperShare

10
5
Q

1960 1965 1970 1975 1980

Time

When can fit a multiplicative relationship by fitting an additive relationship to the


logarithm of the data; that is,
ln Yt = ln Tt + ln St + ln Ct + ln I t

16
Example 2.6.2
Consider the quarterly sales of electricity in billions of kwh
Year Spring Summer Autumn Winter
1985 3 2.4 2.48 2.85
1986 2.23 2.05 2.3 2.82
1987 2.45 2.5 2.41 3.66
1988 3.18 3.1 3.7 4.70

Solution 2.6.2
There are several methods developed to measure the typical seasonal fluctuation in a
time series. The most commonly method used to compute the typical seasonal pattern
is the ratio-to-moving-average method. This eliminates the trend, cyclical and
random components from the original series.

Time S e ries P lot of Electr icity s a les


5.0

4.5

4.0
Electricity sales

3.5

3.0

2.5

2.0
2 4 6 8 10 12 14 16
Winter 85/86 qua rt e rs

The model can be expressed as Yt = Tt × St × Ct × I t

17
In order to break down the time series data and measure the effects of the individual
components we shall proceed in four steps:-

(i) Isolate the seasonal variation ( St ) , and then deseasonalise the data
Tt × St × Ct × I t Y
= Tt × Ct × I t = t
St St

(ii) Compute the trend (Tt ) , then remove its influence


Tt × Ct × I t
= Ct × I t
Tt

(iii) Identify the cyclical fluctuation ( Ct ) , then remove its influence


Ct × I t
= It
Ct

(iv) Recognise that the residual is the effect of the unpredictable irregular events

The moving averages represent the effects of the trend and cycles. The centring
moving averages will allow smoothing effect on the data as it removes all
seasonal variations and effects of irregular events

The ratio of actual values to centred moving averages as a percentage, highlights


the magnitudes of the seasonal and irregular components for each quarter.
Tt × St × Ct × I t
Thus, mathematically, = St × I t , this represents the effects of
Tt × Ct
seasonal and irregular events
For example, the actual sales of electricity for autumn 1985 were 97.58% of the
level we would expect from the effects of trend and cycle alone.

18
Having de-seasonalise the data, we can now seek to identify the trend using least
squares method. The de-seasonalise data reflects the effects of Tt , Ct and I t .
If we divide each de-seasonalise observation by the trend, we end up with
cyclical and irregular components of the series;
Tt × Ct × I t
= Ct × I t
Tt

One way of removing or at least minimising the effects of irregular events is to


resort to the method of centring moving average

After decomposing the data into these factors to explain past behaviour and then to
use them to predict future behaviour.

Suppose we want to trace the individual effect of each of the four factors on the sale
of electricity in Autumn 1987 when the stock market crashed.
The isolation was predicted on the classical multiplicative model, Yt = Tt × St × Ct × I t .

We compute the trend value first then multiply by the others.

1) Tˆt = 2.1793 + 0.0799t = 2.1793 + 0.0799 (11) = 3.058

2) Tˆt × Cˆt = 3.058 ( 91.9


100 )
= 2.810

3) Tˆt × Cˆt × Sˆt = 2.810 ( 96.68


100 )
= 2.717

4) Tˆt × Sˆt × Cˆt × Iˆt = 2.717 × 0.886 = 2.407

This value is almost identical to the actual observed value of 2.41. The small difference
could be rounding errors.

A plausible interpretation of the data for Autumn 1987, is that trend alone would have
accounted for 3.058 billion kwh of sales.
However, since the quarter was in a depressed cycle, the sales was 91.9% of the trend,
that is, 2.81 billion kwh. In addition, electricity usage during the autumn season is

19
96.68% of the average and we need to adjust this figure downwards to 2.717 billion
kwh.
Finally, due to unpredictable stock market crash and drought of 1987, we need to
multiply the amount by 88.6% to get the reconstruction value of 2.407 billion kwh.

(3) = (1)/(2) (4)


(1) (2) Ratio-to- Adj. (5) = (1)/(4) (6) (8) (9) = (8)*100
Year t Quarter Sales MA(4) moving- seasonal Deseasonalise Trend (7) = (5)/(6) Cyclical cyclical Index (10) = (7)/(8)
average (%) Index sales projection Detrend data MA(3) (%) Irregular
1985 1 spring 3 0.9758 3.07 2.26 1.358
2 summer 2.4 0.8829 2.72 2.34 1.162 1.194 119.4 0.973
3 autumn 2.48 2.58625 95.89 0.9668 2.57 2.42 1.062 1.065 106.5 0.997
4 winter 2.85 2.44625 116.5 1.1745 2.43 2.5 0.972 0.974 97.4 0.998
1986 5 spring 2.23 2.38 93.7 0.9758 2.29 2.58 0.888 0.911 91.1 0.975
6 summer 2.05 2.35375 87.1 0.8829 2.32 2.66 0.872 0.876 87.6 0.995
7 autumn 2.3 2.3775 96.74 0.9668 2.38 2.74 0.869 0.864 86.4 1.006
8 winter 2.82 2.46125 114.58 1.1745 2.4 2.82 0.851 0.862 86.2 0.987
1987 9 spring 2.45 2.53125 96.79 0.9758 2.51 2.9 0.866 0.889 88.9 0.974
10 summer 2.5 2.65 94.34 0.8829 2.83 2.98 0.95 0.877 87.7 1.083
11 autumn 2.41 2.84625 84.67 0.9668 2.49 3.06 0.814 0.919 91.9 0.886
12 winter 3.66 3.0125 121.49 1.1745 3.12 3.14 0.994 0.94 94 1.057
1988 13 spring 3.18 3.24875 97.88 0.9758 3.26 3.22 1.012 1.023 102.3 0.989
14 summer 3.1 3.54 87.57 0.8829 3.51 3.3 1.064 1.07 107 0.994
15 autumn 3.7 0.9668 3.83 3.38 1.133 1.118 111.8 1.013
16 winter 4.7 1.1745 4 3.46 1.156

Seasonal
Year Spring Summer Autumn Winter
Index
1985 95.89 116.5
1986 93.7 87.1 96.74 114.58
1987 96.79 94.34 84.67 121.49
1988 97.88 87.57
Total 288.37 269.01 277.3 352.57 1187.25
mean 96.12 89.67 92.43 117.52 395.74
median 96.79 87.57 95.89 116.5 396.75
Adj mean 0.9715 0.9064 0.9342 1.1879 4
Adj median 0.9758 0.8829 0.9668 1.1745 4

 96.12 
 4
 395.75 
20
R-Code
eg262=[Link]("[Link]",header=T)
sale=ts(eg262,freq=4)
plot(sale)
[Link]=decompose(sale,type="multiplicative")
[Link]
plot([Link])

2.6.4 The Slutzky-Yule Effect


To remove both trend and seasonal components we might successively apply a number
of moving averages, or more to remove trend and another to remove seasonal effects.
This procedure is followed by some standard forecasting packages. However, this is
dangerous, since applying successive moving averages can introduce spurious effects.
The Slutzky-Yule effect is concerned with the fact that a moving average repeatedly
applied to a purely random series can introduce artificial cycles.

21

You might also like