Why decompose a time series




















A multiplicative decomposition is appropriate when variations around the trend of the data are proportional in magnitude to the magnitude of the data at any given time. Examples of instances where a multiplicative decomposition would be appropriate include the earnings of a growing company as time passes or the amount of text written by a child in school per day over a period of 10 years. As a business application that illustrates how a decomposition plays out in the real world, one could take the example of decomposing the time series data of the number of flights per month on a passenger airline over 10 years.

This is because the seasonal variation can be thought of as ratios of passengers willing to travel in a given month compared with those traveling in the month of January, rather than as an additive factor. The season may explain variations such as reduced travel during the winter months when it is less convenient to travel and higher travel during the summer months when many people decide to take vacations.

The number of passengers flying on an airline in a given month is driven by the random decisions of millions of individual people and this will produce considerable randomness in the data from month to month. Sometimes the randomness is driven by events such as unusually bad weather or pandemics.

Skip to main content. How does time series decomposition work? Alternatively, an additive form after a log transformation log-additive can be used for series with growth. In additive decomposition the value of an original series y for each day t is:. The decomposition process is carried out by sequentially identifying and separating the different components. There are several ways to extract each component.

Once the seasonal part is identified and removed if it exists the next step is to use a smoothing procedure to define the trend part. The order window length determines the smoothness of the trend. This method is only really useful for historical data analysis because the beginning and end of the estimates are undefined, making forecasting impossible.

Lastly, it is possible to estimate stochastic trends using the Hodrick-Prescott filter. It is a model-free based approach; similar to a symmetric weighted average, but includes adjustments at the end of the sample. The HP filter is a technique commonly used with macro-economic series that have a trend long-term movements , business cycle and irregular parts short-term fluctuations.

It constructs the trend component by solving an optimisation problem. It aims to form the smoothest trend estimate that minimises the squared distances to the original series. In other words, it has to find equilibrium between the smoothness of the trend and its closeness to the original. The components can be found by solving the following minimisation problem, which has a unique solution:. The first term in the formula penalises the irregular component and the second penalises variations in the growth rate of the trend component.

This trade-off between the goodness of fit and the smoothness is controlled by lambda, a non-negative multiplying parameter. It affects the sensitivity of the trend to short-term fluctuations. The larger the value of lambda, the smoother the trend. STEP 1: Try to guess the duration of the seasonal component in your data.

STEP 2: Now run a 12 month centered moving average on the data. This moving average is spread across a total of 13 months. The 12 month centered MA is an average of two moving averages that are shifted from each other by 1 month, effectively making it a weighted moving average.

Continuing with our Python example, here is how we can calculate the centered moving average in Python:. As you can see, our moving average transformation has highlighted the trend component of the retail sales time series:. STEP 3: Now we have a decision to make. If we inspect the original car sales time series, we can see that the seasonal swings are increasing in proportion to the current value of the time series.

Thus the retail used car sales time series is assumed to have the following multiplicative decomposition model:. STEP 5: Finally, we will divide the noisy seasonal value that we had isolated earlier with the averaged out seasonal value to yield just the noise component for each month.

So there you have it! We just hand cranked out the procedure for decomposing a time series into its trend, seasonal and noise components.

And here is the link to the data set used in the Python example. Download link to curated data set. Samuel H. U P: Table of Contents. A headfirst dive into a powerful time series decomposition algorithm using Python A time series can be thought of as being made of 4 components: A seasonal component A trend component A cyclical component, and A noise component. The Seasonal component The seasonal component explains the periodic ups and downs one sees in many data sets such as the one shown below.



0コメント

  • 1000 / 1000