Improving forecasting accuracy for stock market data using EMD-HW bagging

Many researchers documented that the stock market data are nonstationary and nonlinear time series data. In this study, we use EMD-HW bagging method for nonstationary and nonlinear time series forecasting. The EMD-HW bagging method is based on the empirical mode decomposition (EMD), the moving block bootstrap and the Holt-Winter. The stock market time series of six countries are used to compare EMD-HW bagging method. This comparison is based on five forecasting error measurements. The comparison shows that the forecasting results of EMD-HW bagging are more accurate than the forecasting results of the fourteen selected methods.


Introduction
In financial time series analysis, one of the primary issues is modeling and forecasting financial time series, specifically stock market index. This is because these data are nonlinear and nonstationary. Moreover, it has a height heteroscedasticity. Bagging forecasting is used in this study to overcome these problems. Bagging forecasting, as presented by [1], is a method for generating multiple versions of forecasting and using these versions of forecasting to obtain an aggregated forecasting. Then the average of these versions of forecasting was evaluated.
A bootstrap aggregation of exponential smoothing (EXP) method was presented by [2]. Box-Cox transformation, STL decomposition, and moving block bootstrap (MBB) were used in this study. The M3 data competition (M3 data competition are 3003 time series. The competition results in [3] study are used in comparative papers.) were used to compare this method with original EXP model. In addition as in [4], the M3 data competition were used to compare their method. In this method, the ETS (ExponenTial Smoothing methods) and autoregressive (AR) model with a sieve bootstrap methods were applied. In [5], the Multi-channel Singular Spectrum Analysis (MSSA) technique with HW-Bootstrap method was used to forecast the Natural Inflow Energy time series in Brazil. [6] proposed a bootstrap aggregation (bagging) methodology to reduce the variance of tourism demand forecasting. [7] used the bagging HW method to obtain highly-accurate air transportation demand forecasts. [8] suggested the bagging of STL, Box.Cox, MBB, and ARMA methods to forecasting electric energy demand. Table 1 presents the summary of this literature review.
With regard to all those literature reviews, we use the construction of EMD-HW bagging to forecast the stock market data. In order to assess the performance of forecasting, the EMD-HW bagging is compared with fourteen different forecasting models. The experimental results show that the EMD-HW bagging is superior to other methods in terms of RMSE, MAE, MAPE, TheilU, and MASE.
Therefore, the significant of this research article can be summarized. For instance, after an intensive research in the financial forecasting literature, a lot of research papers that have been conducted in forecasting the content of stock market data such as [9], [10], and [11]. Also, most of the articles have used the mentioned models directly without any combination such as [12] and [13].
Section 1 introduces methods that are used in this paper which are EMD, IMF, HW, fourier transform, and MBB. Section 2 presented the proposed methodology and the data that was used. Section 3 analyzes the data with a discussion on the result showing the capability of EMD-HW bagging. Finally, in last Section, some concluding remarks were addressed.

Methodology
In this section, the various steps for the implementation of the EMD-HW bagging method will be described in details. These methods are Empirical Mode Decomposition (EMD), IMF, HW, Fourier Transform (FT), and Moving Block bootstrap (MBB).

Empirical mode decomposition (EMD)
EMD was described in 1998 by [14], and this method has been applied in [15], [16], [17], [18], [19], [20], [21], and [22]. The main idea of EMD is the decomposing of nonlinear and non-stationary time series data into several of simple time series data. It analyzes time series by keeping the time domain of the signal. It supplies a strong and adaptive process to decompose a time series into a combination of time series that is known as Intrinsic Mode Functions (IMF) and residual. Later, the original signal can be constructed back as the follows: where x(t) represents the original time series, r(t) represents the residue of the original time series data decomposition, and IMF i represent the i th intrinsic mode function (IMF) series. However, the EMD technology has a number of limitations in its algorithm. First, the theoretical base is not fully established, and most of the steps of the EMD methodology ignore mathematical expressions. The second limitation is related to the sensitivity toward endpoint treatments (i.e., boundary effect) when using an EMD algorithm [23], and many studies were developed using the EMD methodology to overcome this limitation. Such as, [24] accompanied local polynomial quantile regression with a sifting process for automatic boundary  [5] MSSA-Boot-HW Natural Inflow Energy [6] Resembling-GETS Tourism demand [7] STL-HW Air transportation demand correction. The third limitation is related to mode mixing [25]. The methodology of EMD-HW bagging method able overcomes these limitations with the basic EMD. In the other word, there are a number of studies used extension method (developed method) for the EMD in forecasting method such as [26] and [27], but EMD-HW bagging does not need to use any of these developed methods.
In order to estimate these IMFs, the following steps should be initiated and the process is called the sifting process of time series x(t) [14]. Thus, this is shown below: 1. Taking the original time series x(t) by assuming that the iteration index value is i = 1.
2. Then, evaluating all the local extrema values of the time series x(t).
3. After that, form the local upper envelope function u(t) by connecting all local upper values using a cubic spline line. In a similar way, form the local lower envelope l(t), and then form the mean function m(t) by using the following; 4. Next, define a new function h(t) using m(t) and x(t) on this formula: Check the function h(t) which is an IMF, according to IMF conditions: a. The difference between the number of local extreme points and the number of crowszero points is less than or equal to 1.
b. The absolute value of the mean function is less than ε, where ε is a very small positive number which is close to zero. Sometime, it is equal to zero. (shown in the second part of this section). If the function h(t) has satisfied IMF conditions, then go to step 5. If not, go back to step 2 and renew the value of x(t) such that it becomes h(t).

5.
Save the result of the IMF obtained from the last step, and renew i value such that it becomes i = i + 1, and it attains the residue function r(t) using the IMF and x(t) by the formula.
6. Finally, if r(t) is a monotonic or constant function, then save r(t) as residue and all the IMFs obtained. If r(t) is not monotonic or constant function, return to step 2.
Real time series data application of most prediction methods needs high degrees of programming for implement of bootstrap [28]. The steps 1 to 6 which were discussed above allow the sifting process to separate time-altering signal features.

Holt-Winter (HW)
More than fifty five years ago, the basic formula of the Holt-Winter (HW) model or Triple Exponential Smoothing have been presented by [29] and [30]. The HW forecasting procedure is a variant of exponential smoothing. HW is simple Which does not need high data-storage requirements and is easily automated. Moreover, HW is particularly suitable for producing short-term forecasts for sales or demand time-series data. In this method, the recent observations have effect which is more robust than old observations in forecasting value.
The HW was employed to short-term forecasting in many studies in literature. Such as; [31] used the HW method in short-term forecasting Ionospheric delay. The HW method used in short-term load forecasting by [32], HW was performing better than six selected forecasting methods. [33] used HW model to forecast electricity demand and concluded that the HW outperform as compared to well-fitted ARIMA models. [34] forecasted the short-term electricity demand for UK and concluded that the HW gives good forecasting results.
Two Holt-Winter models which were described in this study are the Multiplicative Model and the Additive Model. However, the seasonal component determines whether the additive or multiplicative model will be used [35]. Mathematically, the additive Holt-Winters forecasting function is defined by the following: where a t , b t and s t are given by And the multiplicative Holt-Winters forecasting function is defined by the following: where a t , b t , and s t are given by where a t , b t , and s t represent the level, slope, and seasonal of series at time t, respectively. Also, p represents the number of seasons in a year. The constants α, β and γ are smoothing parameters in the [0, 1]-interval, h is the forecast horizon. This method uses the maximum likelihood function to estimate the starting parameters and then it may estimate iteratively all the parameters in forecasting future values of time series. The data in x(t) are required to be non-zero for a multiplicative model, but it makes more sense if they are all positive.

Moving block bootstrap (MBB)
The moving block bootstrap (MBB) formulated the first structural form in short by [36]. Thus it was known as a general bootstrap method. Now we describe the MBB suppose that {X t } t 2 N is a stationary weakly dependent time series and that {X 1 , . . ., X n } X n are observed. Let ℓ be an integer satisfying 1 < ℓ < n This gives; '=n ! 0 as n; ' ! 1: Here, the overlapping blocks B 1 , . . ., B N of length ℓ is contained in X n as: where N = n − ℓ + 1. Let k = [n/ℓ], where for any real number x, [x] denotes the least integer greater than or equal to x. Thus, n = ℓ Ã k. To generate the MBB samples, we selected k blocks at random with replacement from the collection {B 1 , B 2 , . . ., B N }. Since each resampled block has ℓ elements, concatenating the elements of the k resampled blocks serially yields ℓ Ã k bootstrap observations X Ã 1 ; . . . ; X Ã n .

Fourier transform
The Fourier transform is the converting of the time series from time domain to frequency domain. In this study, a fast Fourier transform (FFT) was used. The fast Fourier transform is a computational procedure for calculating the finite discrete Fourier transform of a time series. Mathematically, the discrete Fourier transform of finite length is defined as presented by [37]. Let x 0 , . . .., x N−1 be a time series with N observation.

Quantile regression (QR)
The quantile regression was presented [38]. Theoretically, let Y be a real valued random variable with cumulative distribution function F Y (y) = P(Y y). The τ th quantile of Y is given by: where τ 2 [0, 1].

Statistical techniques for consideration methods
In this study. The EMD-HW bagging method was compared with fourteen methods. Traditional HW method, a hybrid EMD-HW without bagging, ARIMA models, Structural Time Series, Theta method, Exponential smoothing state space method (ETS), and Random Walk method (RW) are used to validate the forecasting performance of EMD-HW bagging. These statistical methods were selected based on their performance in forecasting competitions and other empirical applications, as well as based on their ability to capture salient features of the data. ARIMA (Autoregressive Integrated Moving Average) or Box-Jenkins models are generally denoted ARIMA(p, d, q). Where parameters p, d, and q are non-negative integers, p is the order of the Autoregressive model, d is the degree of differencing, and q is the order of the Moving-average model. Recently, ARIMA has been employed by several studies in forecasting financial time series such as [39]. He applied ARIMA to forecast the cultivated area and production of maize in Nigeria.
ETS was applied to get short-term solar irradiance forecasting in [40]. The results show that the ETS method majorally has better performance than naive forecasting methods. [41] presented that the forecasts obtained using the Theta method are equivalent to simple exponential smoothing with drift. Also it shows that this method is the best performing method in the M3-Competition [3]. Structural Time Series is applied by [42] on Inbound tourism to New Zealand from selected countries. This method has outperformed the naive process. A random walk (RW) is a process where the current value of a variable is composed of the past value with adding an error term defined as a white noise. It was first studied several hundred years ago as models for games of chance. Recently, [43] have shown that the random walk model turns out to be a hard to beat benchmark in forecasting the CEE exchange rates. While in [44], a variable drift term with the random walk process was applied. This was estimated using a Kalman filter. A Support Vector Machine (SVM) is a discriminative classifier formally defined by a separating hyperplane, the foundations of SVM have been developed by [45]. The Neural Networks have been designed to imitate the biological neural networks that constitute the human brain. In forecasting time series, the historical incidence is sent into the input neurons, and corresponding forecasting incidence is generated from the output neurons after the network is adequately trained [46]. This simple statistical process was shown to perform better than all the three models that were selected in out-of-sample forecasts.

Data and methodology
This section contains two parts. The first part is about the data that are used to implement the proposed methodology, while the second part presents the proposed methodology EMD-HW bagging with detailed description.

Data
In this study, the daily stock market data of six countries were used. These countries are Australia, France, Malaysia, Netherlands, Sri Lanka and US-S&P 500. The selection of these data was based on the fact that these data are nonlinear and nonstationary time series with a high heteroscedasticity. Table 2 presents the names of countries with the basic statistics for each country, where SD is Standard Deviation, Sk is Skewness, Kts is Kurtosis, N is Number of observations, and Nimf is the number of IMFs.
The KPSS (Kwiatkowski-Phillips-Schmidt-Shin by [47]), RESET (Ramsey Regression Equation Specification Error Test by [48]), and BP (Breusch-Pagan test by [49]), were used to test the nonstationary, nonlinear and heteroscedasticity, respectively. According to p-value for all these tests (< .05), all these stock market are significantly nonlinear and nonstationary with high heteroscedasticity. The data were extracted from the Yahoo finance website. Figs 1, 2, 3, 4, 5, and 6 show the stock market with its IMFs and residue plots of these countries, respectively. The daily closing prices are used as a general measure of the stock market over the past six years. The whole data set -for each country-covers the period from 9 February 2010 to 7 January 2016, a long sample period renders the results of our test more convincing. Dickey-Fuller test was introduced [47] and was implemented on time series data to prove nonstationarity.
The data set are divided into two parts. The first part (n observations) is used to determine the specifications of the models and parameters. The second part, on the other hand (h observations), is reserved for out-of-sample evaluation. This part is used for the comparison of performances among various forecasting models. The Malaysian stock market data (KLSM) are In the other words, we take six different periods of forecast steps. These periods are one day, two days, three days, four days, five days, and six days. This means we use six different training periods for each data. 4. The high frequency components are aggregate to gather to get a high frequency time series.
This time series is bootstrapped using MBB with length ℓ observations (The optimal block length is estimated automatically for each time series by [51].). Also, the value of B (In theory, the ideal bootstrap will be obtained when the B value goes to infinity [52]. There is no a Improving forecasting accuracy for stock market data using EMD-HW bagging formal method for selecting the B value in the literature [53]. So, selecting B value is still a problem so that the time spent for bootstrapping depends on B value as well as on the sample length [54].) is selected in this step. The value of B is fixed in this study at B = 2000 provides a reasonable approximation see [55]. Which they are 1999 new series with the original series.  Improving forecasting accuracy for stock market data using EMD-HW bagging 7. In the last step, B forecasting point were calculated. The resulting forecasts were combined using the median (The median is the aggregating measure adopted as it is less sensitive to outliers [7].) to get the point forecasting for the original time series x(t).
8. The forecasting result was compared with fourteen forecasting technique based on five error measurements.
As mentioned before, for each data there are six different of forecast periods. For all these periods the same steps are used. In the other word, the different forecast steps do not affect the forecasting model selection or parameter selection. Fig 7 present the flow chart of EMD-HW bagging.

Results and discussion
In this study, we present the bagging for EMD and HW technique (EMD-HW bagging) using HW, EMD, and MBB. The stock market data of six countries are used to evaluate the forecasting accuracy of the EMD-HW bagging method. Fourteen forecasting models are used in order to validate the forecasting performance EMD-HW bagging method. Root Mean Squared Error (RMSE), Mean Absolute Error (MAE), Mean Absolute Percentage Error (MAPE), Theil's Ustatistic (TheilU), and Mean Absolute Scaled Error(MASE) will be utilized to evaluate the forecasting accuracy for each method. Eqs (10), (11), (12), (13), and (14) show the formula of RMSE, MAE, MAPE, MASE, and TheilU, respectively. Whereŷ i is the forecast value of the variable y at time period i based on the knowledge of the actual series values.
Tables 3 and 4 present the average of RMSE, MAE, MAPE, TheilU, and MASE for the forecasting of EMD-HW bagging and fourteen method at h = 1, 2, 3, 4, 5, and 6 for the stock market data of six countries. These are Australia, France, Malaysia, Netherlands, Sri Lanka, and US-S&P 500. This indicates that the forecast accuracy for EMD-HW bagging method is better than the fourteen forecasting models. As a conclusion, this proved that the EMD-HW bagging method Improving forecasting accuracy for stock market data using EMD-HW bagging is giving a better forecasting result than selected models. The authors believe that our conclusions of robust performances of improving the forecasting accuracy for EMD-HW bagging will be useful to the governments' decision makers and the investments. The authors plan to used EMD-HW bagging to forecast other kinds of financial time series such as exchange rate.

Conclusion
In this study, the EMD-HW bagging is used to forecast daily stock market data of six counties. These countries are Australia, France, Malaysia, Netherlands, Sri Lanka, and US-S&P 500. Consequently, this method is used to forecast nonstationary and nonlinear time series. The result of EMD-HW bagging forecasting technique were compared with forecasting result of six traditional method with three bootstrapping methods. This comparison is based on five forecasting error measurements (RMSE, MAE, MAPE, TheilU, and MASE). In general, the comparison shows that the forecasting results of EMD-HW bagging have more accuracy than the results of these fourteen forecasting methods.