Time series Decomposition
Pertemuan 3 - Time Series
OLEH: Dr. FITRI KARTIASIH, S.ST., S.E., M.Si.
POLITEKNIK STATISTIKA STIS
Introduction
•
One approach to the analysis of time series data is based on smoothing past data in order to separate the underlying pattern in the data series from randomness.•
The underlying pattern then can be projected into the future and used as the forecast.Introduction
•
The underlying pattern can also be broken down into sub patterns to identify the component factors that influence each of the values in a series.•
This procedure is called decomposition.•
Decomposition methods usually try to identify twoseparate components of the basic underlying pattern that tend to characterize economics and business series.
•
Trend Cycle•
Seasonal FactorsIntroduction
• The trend Cycle represents long term changes in the level of series.
• The Seasonal factor is the periodic fluctuations of constant length that is usually caused by known factors such as rainfall, month of the year,
temperature, timing of the Holidays, etc.
• The decomposition model assumes that the data has the following form:
Data = Pattern + Error
= f (trend-cycle, Seasonality , error)
Decomposition Model
• Mathematical representation of the decomposition approach is:
•
Yt is the time series value (actual data) at period t.•
St is the seasonal component ( index) at period t.•
Tt is the trend cycle component at period t.•
Et is the irregular (remainder) component at period t.) ,
,
(
t t tt
f S T E
Y =
Decomposition Model
•
The exact functional form depends on the decomposition model actually used. Two common approaches are:•
1. Additive Model•
2. Multiplicative Modelt t
t
t
S T E
Y = + +
t t
t
t S T E
Y =
1. ADDITIVE MODEL
•
An additive model is appropriate if themagnitude of the seasonal fluctuation does not vary with the level of the series.
•
Time plot of U.S. retail Sales of generalmerchandise stores for
each month from Jan. 1992 to May 2002.
2. MULTIPLICATIVE MODEL
•
Multiplicative model is more prevalent witheconomic series since most seasonal economic series have seasonal variation which increases with the level of the series.
•
Time plot of number of DVD players sold for each month from April 1997 to June 2002.Decomposition Model
• Transformations can be used to model additively, when the original data are not additive.
• We can fit a multiplicative relationship by fitting an additive relationship to the logarithm of the data, since if
• Then Y
t= S
t T
t E
tt t
t
t LogS LogT Log E
Y
Log = + +
Seasonal Adjustment
•
A useful by-product of decomposition is that it provides an easy way to calculate seasonally adjusted data.•
For additive decomposition, the seasonally adjusted data are computed by subtracting the seasonal component.t t
t
t S T E
Y − = +
Seasonal Adjustment
•
For Multiplicative decomposition, the seasonally adjusted data are computed by dividing the original observation by the seasonal component.•
Most published economic series are seasonally adjusted because Seasonal variation is usually not of primaryinterest
t t
t
t T E
S
Y = *
Decomposition Graphics
Deseasonalizing the data
•
The process of deseasonalizing the data has useful results:•
The seasonalized data allow us to see better the underlying pattern in the data.•
It provides us with measures of the extent of seasonality in the form of seasonal indexes.•
It provides us with a tool in projecting what one quarter’s (or month’s) observation may portend for the entire year.Centered Moving Average
•
The simple moving average required an odd number of observations to be included in each average. This was to ensure that the average was centered at the middle of the data values being averaged.•
What about moving average with an even number of observations?•
For example MA(4)Centered Moving Average
•
To calculate a MA(4) for the weekly sales data, the trend cycle at time 3 can be calculated as•
The center of the first moving average is at 2.5 (half period early) and the center of the second moving average is at 3.5 (half period late).•
How ever the center of the two moving averages is centered at 3.3 . 4 5
6 . 5 8
. 5 4
. 5 4
. 4
225 .
4 5
8 . 5 4
. 5 4
. 4 3
. 5
+ = +
+
+ = +
+ or
Centered Moving Average
A centered moving average can be expressed as a single but weighted moving average, where the weights for each period are unequal.
8
2 2
2
4 ) ( 4
2 1 2
4 4
5 4
3 2
1
5 4
3 2
4 3
2 1
5 . 3 5
. 2 3
5 4
3 2
5 . 3
4 3
2 1
5 . 2
Y Y
Y Y
Y
Y Y
Y Y
Y Y
Y Y
T T T
Y Y
Y T Y
Y Y
Y T Y
+ +
+
= +
+ +
+ + +
+
= +
= +
+ +
= +
+ +
= +
Classical Decomposition
1. Additive Decomposition
•
We assume that the time series is additive. A classical decomposition can be carried out using the following steps.•
Step 1: The trend cycle is computed using a centered MA of order k.•
Step2: The detrended series is computed bysubtracting the trend-cycle component from the data
t t
t
t
T S E
Y − = +
Classical Decomposition
• Additive Decomposition
•
Step3: In classical decomposition we assume the seasonal component is constant from year to year. So we theaverage of the detrended value for a given month (for monthly data) and given quarter for quarterly data
•
Step 4 Finally, the irregular series Et is computed by simply sub-tracting the estimated seasonality, trend, and cyclefrom theoriginal data series.
Classical Decomposition
2. Multiplicative Decomposition
•
We assume the time series is multiplicative.•
This method is often called the “ratio-to moving averages”method.
•
Step 4 The irregular series Et is computed as the ratio of the data•
to the trend and seasonal components:Deseasonalizing the data and Finding Seasonal Indexes
• First the trend-cycle T
tis computed using a centered moving average. This removes the short-term
fluctuations from the data so that the longer-term trend-cycle components can be more clearly
identified.
• These short-term fluctuations include both seasonal and irregular variations.
• An appropriate moving average (MA) can do the job.
Deseasonalizing the data and Finding Seasonal Indexes
•
The moving average should contain the same number of periods as there are in the seasonality that you want to identify.•
To identify quarterly pattern use MA(4).•
To identify monthly pattern use MA(12)•
To identify weekly pattern use MA(4)•
To identify daily pattern use MA(7)•
The moving average represents a “typical” level of Y for the year that is centered on that moving average.Finding the Long-Term Trend
• The long term movements or trend in a series can be described by a straight line or a smooth curve.
• The long-term trend is estimated from the
deseasonalized data for the variable to be forecast.
• To find the long-term trend, we estimate a simple linear equation as
•
Where Time =1 for the first period in the data set and increased by 1 each quarter(or month) thereafter.) (
) (
Time b
a CMA
Time f
CMA
+
=
=
Finding the Long-Term Trend
•
The method of least squares can be used to estimate a and b.•
a and b values can be used to determine the trend equation.•
The trend equation can be used to estimate the trend value of the centered moving average for the historical and forecast periods.•
This new series is the centered moving-average trend (CMAT).Finding the Long-Term Trend
• The centered moving- average trend equation for this example is
• This line is shown
along with the graph of Y and the
deseasonalized data.
0 5 10 15 20 25 30
0 2 4 6 8 10 12 14
Y
Centered moving average Trend
) (
6 . 0 40 .
13 TIME
CMAT = +
Measuring the Cyclical Component
• The cyclical component of a time series is measured by a cycle factor (CF), which is the ratio of the
centered moving average (CMA) to the Centered moving average trend (CMAT).
• A cycle factor greater than 1 indicates that the
deseasonalized value for that period is above the long- term trend of the data. If CF is less than 1, the reverse is true.
CMAT CF = CMA
Measuring the Cyclical component
•
If the cycle factor analyzed carefully, it can be the component that has the most to offer in terms of understanding where the industry may be headed.•
The length and the amplitude of previous cycles mayenable us to anticipate the next tuning point in the current cycle.
•
An individual familiar with an industry can often explain cyclic movements around trend line in terms of variables or events that can be seen to have had some import.•
By looking at those variables or events in the present, one can sometimes get some hint of the likely future direction of the cycle movement.Forecasting (1)
•
There have been many attempts to develop forecasts based directly on a decomposition.•
The trend-cycle is the most difficult component toforecast. It is sometimes proposed that it be modeled by a simple function such as a straight line or some other parametric trend model. But such models are rarely adequate.
•
The seasonal component for future years can be based on the seasonal component from the last full period of data.But if the seasonal pattern is changing over time, this will be unlikely to be entirely adequate.
Forecasting (2)
•
The irregular component may be forecast as zero (for additive decomposition) or one (for multiplicativedecomposition). But this assumes that the irregular
component is serially uncorrelated, which is often not the case.
•
However, we prefer to use decomposition as a tool for under-standing a time series rather than as a forecasting method in its own right. Time series decompositionprovides graphical insight into the behavior of a time series.
•
This can suggest possible causes of variation and help in identifying the structure of a series, thus leading toimproved understanding of the problem and facilitating improved forecast accuracy.
•
Decomposition is a useful tool in the forecaster's toolbox, to be applied as a preliminary step before selecting and applying a forecasting method.TERIMA KASIH
اركش
təşəkkür edirəm ευχαριστία
Thank you Dankeschön
gracias Obrigado!
tack
merci
hvala cảm ơn bạn
mulțumesc salamat
谢谢