Abstract

The foremost aim of this research was to forecast the performance of three stock market indices using the multilayer perceptron (MLP), recurrent neural network (RNN), and autoregressive integrated moving average (ARIMA) on historical data. Moreover, we compared the extrapolative abilities of a hybrid of ARIMA with MLP and RNN models, which are called ARIMA-MLP and ARIMA-RNN. Because of the complicated and noisy nature of financial data, we combine novel machine-learning techniques such as MLP and RNN with ARIMA model to predict the three stock market data. The data used in this study are taken from the Pakistan Stock Exchange, National Stock Exchange India, and Sri Lanka Stock Exchange. In the case of Pakistan, the findings show that the ARIMA-MLP and ARIMA-RNN beat the individual ARIMA, MLP, and RNN models in terms of accuracy. Similarly, in the case of Sri Lanka and India, the hybrid models show more robustness in terms of forecasting than individual ARIMA, MLP, and RNN models based on root-mean-square error and mean absolute error. Apart from this, ARIMA-MLP outperformed the ARIMA-RNN in the case of Pakistan and India, while in the context of Sri Lanka, ARIMA-RNN beat the ARIMA-MLP in forecasting. Our findings reveal that the hybrid models can be regarded as a suitable option for financial time-series forecasting.

1. Introduction

Financial forecasting of a complex market is always the key area for investors. Series hybrid model is quite possibly the most generally utilized hybrid model wherein a time series is thought to be made out of two linear and nonlinear components. Financial data forecasting has become an attractive research topic for many scholars and policymakers in the time-series domain in the last few decades. For large companies and investors who conduct a huge amount of transactions in different markets, accurately predicting market price tendencies can result in high profits with small investment risks. Due to the complex and nonlinear nature of high-frequency financial data, predictive modeling is a challenging task [1]. Although many prediction frameworks had been proposed to forecast the behaviour of different financial systems based on various econometric methods, most of them failed to catch nonlinear patterns in financial data and have shown less accurate results [2]. In recent years, machine-learning techniques have become popular methods in time-series analysis because of their aptitude to captivate and detect multifaceted relationships in nonstationary data and successfully perform classification and prediction tasks. Including financial time-series forecasting (FTSF) is important for financial directors, advisors, and policymakers; besides, they are also trying to find the accurate method for improving forecasting accuracy [3]. Recently, combination techniques concerning various forecasting models have grabbed the consideration of several scholars in different extents, particularly the FTSF. Basically, the combination techniques can be classified into parallel and sequence models. Though in parallel models, forecasting is premeditated given an accumulation of forecasting results via a single model, a time series is considered to have consisted of two major parts in combination models. The first part models are utilized to analyze the one component of the time series, and by utilizing the observations from the first model, the next (second) part is modelled. If the behaviour of an underlying series is a combination of linear and nonlinear, then linear and nonlinear hybrid type models are widely used in time-series forecasting (TSF). Many researchers have explicitly addressed the series of nonlinear and linear combination models [46]; Monfared et al. 2012; [7, 8]. Chen and Wang [9] included support vector regression (SVR) and ARIMA for forecasting time-series data, containing a seasonal factor. Diaz-Robles et al. [6] used a multilayer perceptron neural network and ARIMA with exogenous variables. Besides, Pham and Yang [10] combined generalized autoregressive conditional heteroscedasticity with an autoregressive moving average model to minimize the residuals and achieve better forecasting of machine health conditions. Nie et al. (2012) defined a series using merging ARIMA and SVR models for short-horizon load prediction. Moreover, Enke and Monfared [7] combined GARCH and neural network models to forecast volatility. Finally, Sun et al. [8] planned to apply a combination of different GARCH and ARIMA models to guess solar radiation. Based on past studies, artificial neural networks (ANNs) and ARIMA widely use nonlinear and linear models to construct combination models. The ARIMA model is common by dint of its statistical properties and famous Box–Jenkins approach in model construction. The ARIMA model supposes a linear association between the response variable and its lags (past data); if such association exists in the data, then ARIMA type models can provide fantastic results. In other words, we can say linear models can effectively resolve linear problems. The ANN is the most vital and commonly used type of nonparametric, nonlinear time-series models and forecasting [11]. These models recognize the nonlinear pattern without any information about the association present in the data. Further, the model is constructed based on features shown in the data. Given the real world, where data often contain linear and nonlinear patterns, only ARIMA or ANN models separately cannot simultaneously capture the linear and nonlinear patterns. Hence, a combination of these models can effectively forecast real-world systems, for instance, financial markets. Several combination models, including ARIMA and ANNs, have been presented in the literature and were used for TSF, resulting in an excellent performance. These models are used in a combination, such as ARIMA-ANN and ANN-ARIMA. Many researchers use models of ARIMA-ANN for the forecasting of time series [12, 13]; Khashei et al., 2011; [1416]; Zeng et al. 2016; however, few studies addressed the ANN-ARIMA models [17, 18]. This research work has certain contributions. This study is comprehensive and is more different in several ways than previous studies. Firstly, this study attempts to check the predictive capabilities of the ARIMA, MLP, and RNN models together in the case of the three stock market indexes to improve the forecasting. Secondly, in most cases, the real phenomena are neither pure linear nor nonlinear, but the combination of these two. Thirdly, it tries to construct a hybrid model and identify the best algorithm to predict the execution of the MLP, RNN, ARIMA, and their hybrids in the case of three stock market indexes.

The most primary motivation for attempting to forecast the stock market prices is financial gain. The potential to discover a statistical model that can consistently forecast future stock prices would make the model's owner very prosperous. Thus, investors, investment professionals, and data analysts are often trying to determine a stock market model that would produce higher returns than their counterparts.

In this study, we attempt to examine various relevant objectives. The study’s primary objective compares the performance of the two kinds of series hybrid models for financial time-series forecasting (FTSF) together and with the components. The study mainly focuses on determining the comparative predictive abilities of ARIMA, MLP, RNN, and their hybrid. Moreover, this study aimed to demonstrate which order of MLP, RNN, and ARIMA will enhance building hybrid series models for forecasting financial time series. Three famous standard data sets, including the three stock markets, i.e., the closing prices of the Pakistan Stock Exchange, the closing prices of India’s National Stock Exchange, and the closing prices of the Sri Lanka Stock Exchange, are selected for this purpose.

The remaining article is structured in the following parts. Section 2 covers a review of the related literature. Section 3 describes the data and methodology. Section 4 is about the data analysis and discussion. Moreover, Section 5 contains policy implication, and Section 6 consists of the conclusions of this article.

2. Review of Literature

Stock price forecasting is a debatable issue in finance, and numerous scholars and researchers have focused on this matter. Currently, there have been an ample scientific research studies interpreting the forecasting techniques to forecast the upcoming market in various financial instruments.

A study was employed by Kimoto et al. [19] who performed modular NN to predict the timing of selling or buying for the TOPIX. The results concluded that a huge profit was achieved. Kamijo and Tanigawa [20] made an improvement in the style identification method to predict the stock prices for Japan. This technique was proposed to investigate the recurrent networks to decrease the mismatching forms. Yoon and Swale [21] employed a four-layered NN technique to predict stock prices in the United States. The findings of this study concluded that a four-layered neural network is better than the multiple discriminant analysis procedures in terms of prediction accuracy. Saad et al. [22] carried out comparative research of time delay “neural network, probabilistic neural network, and recurrent neural network” in forecasting daily closing prices in stock exchanges. The findings mentioned that all networks can achieve similarly, but the simplest network is more appropriate. Kim [23] performed SVM to forecast the trend of stock price alterations using daily data in the “Korea Composite Stock Price Index.” The study picked twelve technical determinants to plan primary features and then evaluated that there is a possibility of applying SVM in financial prediction by associating it with “back-propagation networks (BPN) and case-based reasoning (CBR).” The findings demonstrated that SVM outperformed the back-propagation networks and case-based reasoning in terms of prediction. A research was carried out by Pai and Lin [24], and they performed the ARIMA and SVM to construct a hybrid model. The ARIMA model was employed to capture the linear part information, whereas the SVM was utilized to manage the nonlinear data in time-series forecasting (TSF). The findings indicated that their proposed strategy could markedly increase the forecasting competencies of a single ARIMA or SVM model. A study of Manish and Thenmozhi [25] performed SVM and random forest for the prediction of daily volatility of trend related to “S&P CNX NIFTY Market Index of the National Stock Exchange” and compared the results with classical methods such as discriminant, logit, and artificial neural network (ANN). They concluded that SVM performs better than random forest, ANN, and other classical methods in terms of prediction accuracy. An attempt was made by Kara et al. [26] who tested two models, i.e., artificial neural network and SVM. Ten technical factors and daily stock price for the “ISE National 100 Index” were selected to assess the model ability. The findings revealed that the performance of ANN is better than the SVM method. Wei [27] constructed a hybrid method by comparing genetic algorithm with ANFIS for stock price prediction. Root-mean-square error evaluates the method during the six-year period of the TAIEX. The results revealed that the method functioned performs better than the other three methods. Xiong [28] proposed a novel hybrid model known as FA-MSVR to predict the triplet internationally traded market indexes incorporating the “FTSE 100, S&P 500, and Nikkei 225” as well. The empirical results revealed that their model outperformed others in prediction accuracy in the counterparts, and for interval-valued financial data prediction, it is considered one of the good substitutes. Hafezi et al. [29] proposed a new sensible framework for stock price prediction known as “bat-neural network multiagent system.” The model worked in a four-layered multiagent structure to predict “Deutscher Aktienindex (German Stock Index) stock price” eight years ahead. The potential of their methodology is assessed using basic and technical “Deutscher Aktienindex (German Stock Index) stock price” information and then compared their output with different models, for example, generalized regression neural network and genetic algorithm neural network. Their results showed that in terms of prediction, bat-neural network multiagent system plays a role very accurate, and that is why this method is suitable for stock price prediction, specifically in long time intervals. Khuat and Le [30] offered a technique for the goal of stock price prediction. The method is based on the Haar wavelet transform and artificial NN optimized by directed artificial bee colony algorithm. The model was assessed on the past information related to price for numerous firms. The results are fruitful and help in facilitating the stock traders. Naugen [31] forecasted the daily stock price of triplet dynamic stocks using the “hidden Markov model (HMM)” to project a daily stock price of three dynamic stocks—Google, Apple, and Facebook depending on their past information. Thus, the models utilized single and multiple observation(s) information to forecast the close price of stocks. The results described that the hidden Markov model outperformed the naive approach in stock price prediction. In addition, the results revealed that the dealers employing the hidden Markov model achieved more return as compared to the return obtained from the naive for Google and Facebook stocks. Shah et al. [32] presented an approach called “quick Gbest-guided artificial bee colony-feedforward neural network” that relied on a neural network to diminish the forecasting error using stock price data. Consequently, the new approach has been affirmed and inspected to predict the trend of the Saudi Stock Exchange accurately. The results showed that the “quick Gbest-guided artificial bee colony-feedforward neural network” outperformed the typical computational algorithms. Chandar [33] proposed a novel hybrid model known as a wavelet adaptive network-based fuzzy inference system. The wavelet adaptive network-based fuzzy inference system was applied and used historical data of a few firms. The results showed that this method performed better as compared to other prediction models.

Bokde et al. (2020) introduced an R package known as Forecast TB that can be utilized to compare the predictive power of different forecasting techniques using time-series data. They considered time-series methods such as ARIMA, pattern sequence-based, and others to determine their predictive power.

3. Data and Methodology

3.1. Data

This study utilized weekly data of closing prices of the three stock markets, i.e., Pakistan Stock Exchange (Pakistani Rupee), National Stock Exchange India (Indian Rupee), and Sri Lanka Stock Exchange (Sri Lankan Rupee). The data span almost 11 years, the first observation begins on September 6, 2009, and the last observation is on December 26, 2019. Each stock index includes 538 weekly observations in this study. The stock indices are selected based on different numbers of stocks and geographical locations. Using the weekly frequency is to decrease the impact of different times of closing of the stock indices compared with daily time stamps. The Yahoo Finance database is used to collect data.

3.2. Methodology

One way to evaluate three stock market indices predicting the performance of the MLP, RNN, and ARIMA on past data is to split the sample data into two groups. This process is known as “out-of-sample testing.” The first group of data set, called the in-sample set, is utilized to estimate the different model parameters. These estimated models are then utilized to predict the index prices for the second group of the time period called the out-of-sample set. The left-out data comprise the recent data that could be utilized to check the accuracy of predictions compared with the ex post realizations and determine whether their error statistics are similar to those made for the case of in-sample data.

In this research, the stock market section is measured by the stock market index. The closing prices of selected stocks are computed using the following formula:where represents the outstanding shares of stock i at time t and denotes the base day outstanding shares.

3.3. The Autoregressive Integrated Moving Average (ARIMA) Model

The ARIMA model is basically used for time-series prediction using historical data. It comprises two main components AR (autoregressive) and MA (moving average): these two components are concatenated to create a model known as ARMA. The “I” represents an integrated part. In case of the nonstationary series, we transformed it by differencing and showing by integrated part in ARIMA model. The ARIMA time-series prediction formulation is provided in the following equation:where is the real value in time t. It is believed as white noise that is independent and distributed with zero mean and constant variance of .are polynomials in C of degree P and Q, and are parameters of model, is the operator of backward shift, Q and P are integers and often referred to as model orders, and an integer d indicates here that how many times the series is differenced to achieve stationarity. ARIMA modeling methodology also requires three iterative steps, including model identification, parameter(s) estimation, and diagnostic check [34].

3.4. Artificial Neural Network

One of the most used intelligent models, especially in time-series modeling and prediction, is ANN models, which were successfully applied in many areas. The core reason is that ANN models do not require any pre-assumption about the data distribution, whether the underlying series is linear or nonlinear. Furthermore, the ANN is illustrated by their universal approximators, which can approximate a broad function class precisely. In the literature, there are various ANN design architectures. Neural networks have a similar structure but are structured to differentiate between various types of networks of neural. ANN contains three layers known as the input, hidden, and output layers.

Layer input phase: an ANN fits with a lagged value of actual data for time-series data problems ( ..., ) as the input vector. The input layer, therefore, consists of p nodes linked to the hidden layers.

An interface between layers of output and input is called the hidden layer. The ANN models built in this study possess a single layer of hidden q nodes. One of the chief objectives in this step is to determine the activation function’s () type that identifies the association between the layers of output and input. ANNs favor a broad series of activation processes, including tan hyperbolic, quadratic, linear, and logistic functions. The transfer function of the hidden layer can also be represented by the logistic function, as shown in the following equation:

Output layer phase: the neural network output is utilized to forecast the future time-series values by choosing the function of activation transfer and the correct node number. This study constructs the output layer through ANN containing a node, as one forward phase prediction is considered. In addition, the linear function is employed for the layer of output as a nonlinear function of activation. The input-output layer relationship equation is provided in the following equation:where and are referred to as connection weights.

3.5. The ARIMA and ANN

Specific techniques can be categorized as below for time-series prediction: intelligent models and statistical models. The analysis of statistical techniques is conducted by examining the past quality of time-series components. However, the connections between input and output nodes are determined in intelligent models despite the shape of the input(s) and output nexus by analyzing the data features. Nonlinear processing is the central benefit of these kinds of unique techniques. The two most famous approaches used in the construction of hybrid models are ARIMA and ANN. This study focuses on two key types of ANNs: multilayer perceptron (MLP) and recurrent neural network (RNN).

3.6. Error Metrics

Root-mean-square error (RMSE), mean absolute percentage error (MAPE), and mean absolute error (MAE) are employed to measure the model performance used in the neural network. Suppose (, , ..., ) represent the actual observation while (, , , ..., ) are the predicted or expected values, then the equation can be used to measure MAPE, MAE, and RMSE.

The formulae for RMSE, MAPE, and MAE measure the forecast error, respectively. and are the actual and predicted values, and H indicates the predicted horizon. We have taken a 20 percent forecast horizon. In this study, we are interested to discover the forecast behaviour of the underlying methods, in the long run, using historical information because hidden information in historical data plays a key role in accurate forecasting of long time series. Therefore, we use several techniques for solving multi-horizon probabilistic forecasting tasks that forecast the full distribution of a time series on future horizons.

4. Data Analysis and Discussion

4.1. For Pakistan
4.1.1. Comparison of Forecasting Results

To compare the forecasting performance of various techniques, it is essential to assess them on unobserved data, i.e., test data. The prediction performance is assessed by utilizing the statistical metrics: the RMSE, the MAPE, and the MAE. The smaller the RMSE, MAPE, and MAE values, the closer the observed and forecasted values are to each other. In this section, the predictive power of ARIMA, MLP, RNN, and their hybrids is compared together in the three abovementioned data sets. There are three standard accuracy measures, namely, RMSE, MAE, and MAPE. The three measures are computed using equations (1), (2), and (3). Basically, all the three measures are used to compare the forecasting performance of ARIMA, MLP, and RNN and their combination. In the case of Pakistan, the results of forecasting the mentioned model to test the data set are summarized in Table 1. Empirical estimates showed that the hybrid model beat the other two models. MAPE, MAE, and RMSE related to the hybrid model are significantly lower than the MLP, RNN, and ARIMA models. It may recommend that separate MLP, RNN, and ARIMA models have no capability to capture all of the patterns in the data. In addition, the graphical representation of the three-error metrics reveals that the hybrid model outperforms in terms of prediction than ARIMA, MLP, and RNN models. Figure 1 has shown the same comparison graphically. However, Figure 1(a) is about RMSE; Figure 1(b) is about MAPE; and Figure 1(c) is about MAE result graphical representation.

In Figure 2, it can be seen that the stock prices of Pakistan are increasing over time, which is evidence of unit root. More specifically, the statistical properties of the original series such as mean, variance, and covariance are not constant over time. To remove the time trend from the data and achieve stationarity, we carry out a difference transformation.

4.2. For Sri Lanka

The predictive capabilities of ARIMA, multilayer perceptron (MLP), recurrent neural network (RNN), and their hybrid models are compared together in the Sri Lanka context. In Table 2, based on MAPE, MAE, and RMSE, the forecast results remarkably suggested that the hybrid models can be considered an effective model to improve the accuracy of forecasting attained by either of the models used separately, in the sense that having the lowest forecast errors. It may recommend that ARIMA, MLP, and RNN models may fail to capture all of the patterns in the data. Furthermore, the graphical representation of the three error metrics reveals that the hybrid model outperforms in terms of prediction than ARIMA, MLP, and RNN models. In Figure 3, we have shown the comparison graphically. Figure 3 has shown the same comparison graphically. However, Figure 3(a), is about RMSE; Figure 3(b), is about MAPE; and Figure 3(c), is about MAE result graphical representation.

In Figure 4, we can observe that the stock prices of Sri Lanka are augmenting over time, reflecting the unit root problem. To be more specific, the statistical properties of an original series such as mean, variance, and covariance vary with time. To eliminate the time trend from the data, we execute the difference transformation.

4.3. For India

The predictive capabilities of ARIMA, multilayer perceptron (MLP), recurrent neural network (RNN), and their hybrid models are compared together in the context of India. In Table 3, based on MAPE, MAE, and RMSE, the forecast results remarkably suggested that the hybrid models can be considered an effective model to enhance the accuracy of forecasting attained by either of the models used separately, in the sense that having the lowest forecast errors. It clearly suggests that an individual model has no ability to capture all of the patterns in data. Furthermore, the graphical representation of the three-error metrics reveals that the hybrid model outperforms in terms of prediction than ARIMA, MLP, and RNN models. These results are graphically shown in Figure 5. Figure 5 has shown the same comparison graphically. However, Figure 5(a), is about RMSE; Figure 5(b), is about MAPE; and Figure 5(c), is about MAE result graphical representation.

In Figure 6, we can observe that the stock prices of India are rising over time, which reflects the problem of a unit root. To be more specific, the statistical properties such as mean, variance, and covariance of the original series vary with time. We used a unique transformation to eliminate the time trend from the data. Post-transformation, we achieved stationary series.

5. Policy Implications

It is fact that stock market behaviour is irregular and random. The findings reveal that there is the practical implication of the forecasted index of prices for trading and investing on index-linked funds or for the index derivatives to be traded in the derivative market. More probably, while forecasting economic or financial time-series data, apart from traders, policymakers, mutual funds, investment bankers, FIIs, and arbitrageurs can utilize ARIMA-ANN/ARIMA-RNN hybrid model. Our study outcomes would be of particular attention to investors, traders, regulators, etc. A good prediction or knowing the trends of the stock indices for the developed economy and the developing economy would help traders to formulate more fruitful business and trading plans and a useful decision on asset allocation. Furthermore, based on prediction, they can also take precautionary measures to alleviate possible currency risk. They can formulate more robust trading plans according to the hybrid models and choose the one with the best risk/profit combination.

6. Conclusion

Nearly all financial decision-makers, i.e., money managers, investors, hedge funds, and investment banks, require predicting financial asset prices such as bonds, exchange rate, options, interest rate, and stocks, and a view to precise decisions. It is the chief cause why the struggle to boost prediction models' competence did not stop in finance. Albeit, the literature explains that precise financial forecasting is a mandatory but difficult task faced by financial stakeholders. Merging various models is one of the most adopted approaches in the literature of forecasting for additional accuracy.

In the existing literature, several techniques have taken place to tackle the shortcomings of a single model and get more robust results. One of the most famous hybrid models is a hybrid technique that decomposes a time series into its nonlinear and linear parts. It has been practically and theoretically declared to be successful among single models. These models have respective unique benefits of linearity and nonlinearity in time-series relationships. This study compares the outcomes of different models, such as predictive abilities of a hybrid linear/nonlinear of multilayer perceptron (MLP), recurrent neural network (RNN), and autoregressive integrated moving average (ARIMA) models; i.e., ARIMA-MLP and ARIMA-RNN are compared with their components in the case of three stock market indices from SAARC countries. An empirical investigation based on three well-known real data sets of stock prices of three stock market indices, i.e., Pakistan Stock Exchange, National Stock Exchange of India, and Sri Lanka Stock Exchange, indicates that the use of hybrid models is worthy of getting more accurate outcomes than utilization of separate components.

Generally, it is theoretically manifested that the hybrid model can obtain results that are better than the results obtained from individual models. On the other side, the results provided by the hybrid models are not generally inferior to the results provided by all their components. To be more specific, RMSE, MAE, and MAPE associated with the hybrid models are significantly smaller than the error associated with ARIMA, MLP, and RNN models in the case of Pakistan. In the case of the Sri Lanka Stock Market, hybrid models have superior forecasting performance than ARIMA, MLP, and RNN models by utilizing the same error metrics, i.e., MAPE, RMSE, and MAE. The same forecast errors associated with hybrid models are significantly lower than the ARIMA, MLP, and RNN models in the case of India. In addition, ARIMA-MLP outperformed the ARIMA-RNN under Pakistan and India cases, while in the context of Sri Lanka, ARIMA-RNN beat the ARIMA-MLP in forecasting. Finally, the conclusion drawn from [3537] the findings reveals that the hybrid models could be considered the most appropriate approach than others while dealing with the financial time-series forecasting.

Data Availability

All the stock market data are publically available.

Conflicts of Interest

The authors declare no conflicts of interest.

Acknowledgments

This study was supported by a major project of the National Social Science Foundation of China (17ZDA045), “A Study on the Influence of the Security Pattern of the Countries around the Bay of Bengal on the Implementation of ‘Belt and Road Initiative’ (BRI) in China,” and the major project of the Key Research Base of Humanities and Social Sciences of the Ministry of Education, “Research on Political and Legal Environment ‘Belt and Road Initiative’ (BRI) Construction in South Asian Countries” (16JJDGJW014). Moreover, this study was also supported by Anhui University of Science & Technology’s Introduction of Talent Research Start-up Fund “ASEAN, AU Institution Evolution Research” (Program Number: 13200382) and Research on the Evolution of the ASEAN and AU Institution (Program Number SK2020A0198), a key project of the Humanities and Social Science Research Project of Anhui Province Colleges and Universities.