Split time series (Chapter 7 of Forecasting: Principles and practice)

Earlier we learned about three models of time series: trend, seasonality and period.
When decomposing a time series into its components, it is common to combine trends and cycles into a single trend cycle component (also known as a trend). Therefore, we believe that the time series contains three parts:Trend cycle part, seasonal part and the rest(Contains any other content in the time series)

7.1 time series components
If we assume additive decomposition, then we can write:, Insert picture description herewhere yt is the data, St is the seasonal factor, Tt is the trend period part, and Rt is the remaining part. Or, write the multiplication decomposition as:Insert picture description here

If the amplitude of seasonal fluctuations or changes around the trend cycle do not change with the time series level, then additive decomposition is the most appropriate. When changes in seasonal patterns or changes around the trend cycle seem to be proportional to the time series level, then multiplicative decomposition is more appropriate , which is common in economic time series.
An alternative method of using multiplicative decomposition is to transform the data until the changes in the sequence are stable over time, and then add decomposition. When using logarithmic transformation, this is equivalent to multiplicative decomposition, because:
Insert picture description here
employment in the US retail industry
We will focus on the elements of the acquisition component of the study Insert picture description here.
Insert picture description here
The figure above shows the components of the trend cycle; the trend cycle shows the overall movement of the series, ignoring seasonality and any small random fluctuations.
Insert picture description here
Figure 7.2 shows the additional decomposition of the data. This model is used to estimate STL.
These three components are shown in the three panels at the bottom of Figure 7.2. These components can be added together to reconstruct the data displayed on the top panel.
Note that the seasonal component changes with time, so any two consecutive years have a similar pattern, but distant years may have different seasonal patterns. The remaining part displayed in the bottom panel is the part after subtracting the seasonal and trend period parts from the data.
The gray bar to the left of each panel shows the relative proportions of the components. Each gray bar represents the same length, but the size of the bars is different due to the different scale of the figure. The large gray bar graph in the bottom panel shows that the rest of the components have the smallest change compared to the change in the data, and the bar of the data is about a quarter of the size. If we shrink the bottom three panels until their bars become the same size as in the data panel, then all panels will have the same proportion.

Seasonally adjusted data
If the seasonal factor is removed from the original data, the resulting value is "seasonally adjusted" data. For additivity decomposition, seasonally adjusted data is equivalent to Insert picture description here, and for multiplicative data, seasonally adjusted data can be corrected to Insert picture description here.
Insert picture description here
If the changes are not due to seasonal factors, then seasonally adjusted series may be useful. The seasonally adjusted series contains the rest and the trend cycle, so they are not stable, and the downturn or high downturn may be misleading. If the purpose is to find turning points in the sequence and explain any changes in direction, it is best to use trend period components rather than seasonally adjusted data.

7.2 Moving averages
Moving average smoothing
The moving average of an order can be written as:
Insert picture description here
m = 2k + 1 here, that is, the estimated period t of the trend period can be obtained by the time series value of k in the average time range.
Observations that are close in time may also be close to value, so the average eliminates some randomness in the data, leaving a smooth trend period component, which we call m-MA, which represents a moving average of m orders.
Insert picture description here
Moving averages of moving averages
We can also apply moving averages to moving averages. One of the reasons for this is to make even order moving averages symmetrical.
Ex: We can take the moving average of order 4 and then apply another moving average of order 2 to the result. (Commonly used when the order is even)
Insert picture description here
Use seasonal data to estimate the trend period:
Insert picture description here

Weighted moving averages
The combination of moving averages can produce weighted moving
Insert picture description here
averages. The main advantage of weighted moving averages is that they allow a smoother estimate of the trend period; their weights are not calculated as full weight entry and exit, but weights. Increase slowly and then decrease slowly to form a smoother curve.

7.3 Classical decomposition
Classical decomposition has two forms:
 Addition decomposition
 Multiplication decomposition
Addition decomposition
Step 1:
If m is an even number, then calculate the trend period component Insert picture description here; if m is an odd number, then calculate the trend period component Insert picture description here
Step 2:
Calculate the detrend sequence : Insert picture description here
Step 3:
To estimate the seasonal composition of each season, just average the detrending values ​​for that season.
Ex: For monthly data, the seasonal component of March is the average of all the three months after removing the trend value in the data, and then adjust these seasonal component values ​​to ensure that they are added to 0; by stringing these monthly values ​​together, To replicate the order of the annual data to obtain the seasonal component. It is also assigned as Insert picture description here
Step 4: the
remaining part can be obtained by subtracting the estimated seasonal and trend period parts: Insert picture description here
multiplication decomposition:
Step 1:
If m is an even number, then the trend period component is calculated Insert picture description here; if m is an odd number, then the trend is calculated Period component Insert picture description here
Step 2:
Calculate the detrending sequence: Insert picture description here
Step 3:
To estimate the seasonal component of each season, just average the detrending value of the season.
Ex: For monthly data, the seasonal component of March is the average of all the three months after removing the trend value in the data, and then adjust these seasonal component values ​​to ensure that they are added to 0; by stringing these monthly values ​​together, To replicate the order of the annual data to obtain the seasonal component. It is also assigned to Insert picture description here
Step 4: the
remaining part can be obtained by dividing the estimated seasonal and trending cycle parts:Insert picture description here
Insert picture description here
Comments on classical decomposition
Although classical decomposition is widely used, it is not recommended because there are several better methods. The problems of classical decomposition are as follows:
 The first few observations and the last few observations cannot obtain the estimated value of the trend period
Ex:If m = 12, there is no trend period estimate for the first 6 or last 6 observations, so there is no estimate for the remaining part in the same time period ( ? Why )
 The trend period estimate tends to be too smooth for fast rising and falling data.
 The classic decomposition method assumes that the seasonal component repeats every year. For many series, this is a reasonable assumption, but for some longer series it is not.
Ex: With the popularity of air conditioners, the power demand pattern has changed over time. Specifically, in many regions, the seasonal usage pattern of decades ago reached its maximum demand in winter (due to heating), while the current seasonal pattern reached its maximum demand in summer (due to air conditioning). Classical decomposition methods cannot capture these seasonal changes over time
 Sometimes, the time series values ​​in a few periods may be particularly unusual
Ex: The monthly air passenger traffic may be affected by labor disputes, making the traffic during the dispute different from usual . The classical decomposition method is not robust to these outliers.

7.4 X11 decomposition The
X11 method is based on classical decomposition, but includes many additional steps and functions to overcome the shortcomings of classical decomposition.
In particular, trend period estimates can be used for all observations, including the end point, and seasonal components can change slowly over time. X11 also has some sophisticated methods to deal with trading day changes, holiday effects and the effects of known forecasting factors. It is highly reliable for outliers and horizontal shifts in time series

7.5 SEATS decomposition
"SEATS" means "seasonal extraction in ARIMA time series"; this process is onlySuitable for quarterly and monthly dataTherefore, other types of seasonality (such as daily, hourly or weekly data) require alternative methods.
Insert picture description here
7.6 STL decomposition
STL is a general and robust method for decomposing time series.
STL has the following characteristics, better than classic, SEATS and X11 decomposition:
 Unlike SEATS and X11, STL will handle any type of seasonality, not just monthly and quarterly data
 Seasonal components are allowed to change over time, And the rate of change can be controlled by the user.
The user can also control the smoothness of the trend period.
It can be robust to outliers (that is, the user can specify a robust decomposition). Seasonal component estimates, however, they will affect the rest.
In addition, STL has some disadvantages. In particular, it does not automatically deal with trading day or calendar changes, and only provides the function of cumulative decomposition.
It can also obtain multiplication decomposition by first taking the log of the data and then inversely transforming its components. Decomposition between addition and multiplication can be used to switch Box-cox and satisfies Insert picture description here; and Insert picture description herecorresponds to the decomposition of the multiplication, and Insert picture description herecorresponds to the decomposition of addition.
Insert picture description here
7.7 Measuring the intensity of trends and seasonality
Time series decomposition can be used to measure the intensity of trends and seasonality in time series. In the formula:;
Insert picture description here
here Insert picture description hereis the smooth trend component, which Insert picture description hereis the seasonal component, and Insert picture description herethe remaining component.

Trend strength
For seasonal data, seasonally adjusted data has more changes than the rest. Therefore, Insert picture description hereit should be relatively small. But for data with little or no trend, the two variances should be almost the same, so we can define the trend strength as:
(? Why the trend strength is defined by 1-Var (Rt) / Var (Tt + Rt))
This also measures the strength of the trend between 0 and 1. Since the variance of the remaining amount may sometimes be greater than the variance of seasonally adjusted data, we set the smallest possible value Insert picture description hereequal to 0.

Seasonal intensity
Seasonal intensity is similar, it can be defined as:
Insert picture description here
if a series of seasonal intensity Fs is close to 0, it means that it has almost no seasonality, and when Var (Rt) is much smaller than Var (St + Rt), then A series of seasonal intensity Fs is close to 1, indicating that it has a strong seasonality.

7.8 Prediction decomposition
Decomposition can also be used for prediction. Assuming an additive decomposition, the decomposed sequence can be expressed as:, Insert picture description here
and here Insert picture description hereis the seasonal adjustment component.
Or, if it is multiplicative decomposition, then we can write Insert picture description here, here Insert picture description here.
In order to predict the time series after decomposition, we separately predict the seasonal component Insert picture description hereand the seasonally adjusted component Insert picture description here.
It is generally assumed that the seasonal component is constant or changes slowly, so the last year of the estimated component can be simply used for prediction, or seasonal naïve is used for seasonal components.
In order to predict seasonally adjusted components, any non-seasonal prediction method can be used, such as a random walk model with drift, Holt method, or non-seasonal ARIMA model.

Published 69 original articles · praised 11 · 20,000+ views

Guess you like

Origin blog.csdn.net/weixin_41636030/article/details/103228610