Full text
45 TRENDY EKONOMIKY A MANAGEMENTU TRENDS ECONOMICS AND MANAGEMENT ISSN 1802-8527 (Print) / ISSN 2336-6508 (Online) 2020 35(1): 45–57 DOI: http://dx.doi.org/10.13164/trends.2020.35.45 Prediction of European Stock Indexes Using Neuro-fuzzy Technique Zuzana Janková, Petr Dostál Abstract Purpose of the article: The paper is focused on the forecast of stock markets of the Central European countries, known as V4, by means of soft computing. The tested model is constructed by a combination of fuzzy logic and artificial neural networks. A total of four SAX, PX, BUX, WIG stock indices differing in their liquidity and efficiency are selected for the forecast. Methodology/methods: The methods of analysis, synthesis and techniques of mathematical neuro-fuzzy modelling were used to achieve this goal. The proposed neuro-fuzzy decisionmaking model consists of 3 input variables, one block of rules (with 21 fuzzy rules) and one output variable predicting the normalized price of stock indexes of the selected countries. The input variables have three attributes (L – large, M – medium, and S – small). Scientific aim: The aim of the paper is to create a suitable model that will be used to forecast stock indices of the Central European countries with a relatively low error. Findings: The developed ANFIS model is a suitable tool for predicting stock indexes. The importance of the neuro-fuzzy model can be seen especially in the fact that it shows a strong predictive capacity of both efficient and less efficient stock markets. Conclusions: The paper discussed the design of the neuro-fuzzy model as a supporting tool for predicting the selected stock indexes listed on the European stock markets. For further research, it would be appropriate to extend the proposed model with other significant fundamental indicators, or to incorporate technical and psychological indicators and to monitor the strength of the revised model also in several stock markets, for example according to the geographical distribution. Keywords: ANFIS, financial market, fuzzy logic, neural networks, soft computing JEL Classification: C45, G11, G12
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 46 Introduction Stock markets are an inherent part of all national economies. According to Billah et al. (2016), it is actually the most important way of acquiring capital. It is a big challenge for financial analysts, traders and brokers to identify the best moment for purchase or sale of equity instruments. Rajab, Sharm (2019) mention that stock price forecasting is a complicated and difficult task due to the chaotic behaviour and a high level of uncertainty of equity instrument prices in the market. The proposal of a highly accurate, simple and comprehensible forecasting model is of utmost importance in this area. Chen et al. (2016) add the numerous factors potentially affecting stock prices in the stock markets need to be considered. Every trader attempts to make their own forecasts, either subjectively, i.e. through models based on their personal feelings and experience, or objectively using various types of software. Although a number of techniques for improving the stock index forecasts have been developed, there is no universal model yet that would be suitable for various types of data and applications. Even a slight improvement of forecast accuracy may bring considerably higher returns to investors. A huge amount of research and scientific works have been published recently, searching for optimal forecasting models for the stock markets. The majority of research works focused on forecasts use the statistical methods of time series analysis. However, these models are considerably restricted, in particular when applied to seasonal and non-linear problems related to uncertainty. For this reason, non-linear methods such as neural networks, fuzzy logic and genetic algorithms have been attracting increased attention. Tung, Le (2017) state that fuzzy logic and artificial neural network represent a method with a wide range of application in forecasting future changes of stock prices, exchange rates, commodities, and other financial instruments. Fuzzy logic allows definitive conclusions to be drawn from unclear, ambiguous or inaccurate information. The artificial neural network has been widely accepted mostly for its capacity to learn to reveal the relationships between non-linear variables. The artificial neural network primarily overcomes the statistical regression models and allows a deeper analysis of large data sets. A hybrid neuro-fuzzy system was created by a combination of artificial neural networks and fuzzy logic. The system strives to use the advantages of both artificial intelligence methods. Negnevitsky (2002) emphasises that the adaptive neuro-fuzzy inference system (ANFIS) has become one of the widespread neuro-fuzzy systems. The aim of the paper is to create an ANFIS model for modelling and forecasting the development of stock index return of a financial market with limited liquidity and thus use the advantages of both the neural network and fuzzy logic. The ANFIS model, as explained by Cheng et al. (2007), has been selected for its strong capability of modelling and computing flexibility, therefore also for its suitability for modelling the systems of complex, dynamic and non- -linear relationships common in the financial markets. 1. Literature Review Cheng et al. (2007) use the adaptive neuro- -fuzzy inference system for forecasting investors’ behaviour (when and whether to buy or sell) in the stock market in expectations of significant interest rate changes or political election results, for instance. The selected input variables are the DJIA, Nikkei 225, and FTSE indexes, NYSE market turnover, discount rate changes, results of S&P 500 and political events. Their research findings show the forecasting potential of the ANFIS in financial applications but at the same time, they suggest that certain market behaviours are too complex to be predicted. Abbasi,
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 47 Abouec (2008) explore the current stock price trend using the adaptive neuro-fuzzy inference system in the Tehran exchange. The study results show that the development of stock prices in the market can be forecasted with a low error rate. In their article, Boyacioglu, Avci (2010) present the ANFIS model for forecasting the Corbex index in the Zagreb exchange. The input data are monthly macroeconomic indicators, namely the DJI, DAX and BOVESPA indexes and the return of ISE National 100. The selected data set covers the period from 1990 to 2008. The set is divided into two parts and the first data set (122 observations) is used for model testing. The second data set (106 observations) is used for training of the designed model. According to the authors, this approach is useful for forecasting in the stock market within its limits. Esfahanipour, Aghamiri (2010) developed a neuro-fuzzy inference system for forecasting the prices of equity instruments based on the Takagi-Sugeno-Kang rule based system. The created model applies a technical index as an input variable. The authors implement fuzzy c-mean clustering for identification of the number of rules. The Gaussian membership function has been selected. The proposed model is tested on the Tehran stock exchange index (TEPIX). This index was successful in forecasting the index development with high accuracy of 97.8% in several experimental tests. Wei et al. (2011) propose a hybrid model for forecasting the prices of equity instruments of the TAIEX index that uses technical indicators as forecast factors and in the intelligent inference system as a forecast algorithm, which provides comprehensive rules to ordinary investors. The authors selected the technical indicators based on a correlation matrix and then used the method of subtractive clustering to granulate the data set of the basic technical indicators to a set of data on language variables and used FIS for extracting non-linear relationships (rules) among the data in the set. Finally, they applied an adaptive network for optimization of FIS parameters to improve the forecast accuracy and create comprehensive rules. On the other hand, the research of Chen et al. (2013) focused on the fundamental powers affecting the return of equity instruments and volatility across domestic and foreign stock markets. The authors examined the correlation of other markets with the stock market in Taiwan. Highly correlated markets were selected as the input variables for the ANFIS prediction model. In their article, Chakraborty et al. (2016) accepted a fuzzy approach based on grid partition, discussing the factors of uncertainty in forecasting stock of any company. The parameters of the determination rules are optimised adaptively using a hybrid neural network mechanism. This ANFIS model focuses on solving the problem of stock price prediction with 94–95% accuracy. In their study, Trinato et al. (2015) perform the prediction of three blue chip shares of an Indonesian bank using an adaptive neuro-fuzzy inference system with Takagi-Sugeno rules and generalized bell membership function. The study results show that the ANFIS performed a good prediction of the selected shares. Chandar (2016) proposed a neuro-fuzzy approach based on subtractive clustering for prediction of prices of the Apple stock. The author used technical indicators as input variables. The simulation results show his model was considerably better than the ANFIS or sole subtractive clustering. Atsalakis et al. (2016) present a model based on the neuro-fuzzy approach for forecasting short-term stock trends in turbulent times of the stock market. The proposed methodology is tested and evaluated using the data on shares from the New York Stock Exchange. The data set demonstrates transactions that took place in the course of four turbulent market periods. Their model proved useful in business simulations and provides better results than the Buy and Hold strategy.
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 48 In the proposed model, Chen et al. (2016) first applied the gradual regression analysis to ensure the objective selection of technical indicators and then created a forecast model in combination with the ANFIS. The results show the superiority of the proposed combined model that surpassed other models in terms of the RMSE and profitability. Vlasenko et al. (2018) proposed a hybrid five-layer neuro-fuzzy model and a corresponding learning algorithm with the application in prediction tasks of stock market time series. The key difference between the conventional ANFIS architecture and the proposed model is in the fourth layer, where the multi-dimensional Gaussian function is used instead of the polynomials to achieve better computing performance and representation capacity in the processing of highly non-linear and volatile data sets. The experimental research results showed obvious advantages of the described model. Rajab, Sharma (2019) propose an effective and easily interpretable ANFIS for prediction of share prices using multiple technical indicators. The interpretability is ensured by reducing basic rules. Moreover, learning during the model optimisation phase is restricted so that simple restrictions affect the updates of the fuzzy set parameters so that it remains easily interpretable and the prediction accuracy is not threatened. The authors use the Bombay stock exchange index, CNX Nifty and S&P 500. The simulation results show that the proposed system achieves better balance between accuracy and interpretability compared to other methods. 2. Adaptive Neuro-Fuzzy Inference System Adaptive neuro-fuzzy inference system (ANFIS) is a combination of an artificial neural network (ANN) and fuzzy inference system (FIS). Thanks to its design, the ANFIS can benefit from both soft computing techniques, but also overcome their shortcomings. Compared to ANN, the ANFIS model is more transparent to users and causes fewer errors in remembering. As a result, there are several advantages of the ANFIS, including adaptive ability, nonlinear ability and rapid learning capability. Neural networks can easily learn from data. However, it is difficult to interpret the acquired knowledge as a meaning associated with every neuron and every mass that is quite difficult to understand. In contrast, as described by Mathur et al. (2016), fuzzy logic itself cannot learn from the data. However, fuzzy models are easy to understand because they use linguistic terms rather than numeric and IF-THEN rules structure. Language variables are defined as variables whose values are words or sentences in natural language with associated degrees of membership. The fuzzy set to which the linguistic variables belong is an extension of the crisp set where the element can have full or no membership. However, fuzzy sets also allow for partial membership, which means that an element may partially belong to more than one set. The ANFIS constructs a fuzzy inference system (FIS) whose parameters of the membership function are derived from training examples. The most commonly used fuzzy inference systems are Mamdani and Sugeno. The main difference between Mamdani and Sugeno is that the output function of the Sugeno membership is either linear or constant (Arkhipov et al., 2008). However, the output functions of the Mamdani membership may be triangular, Gaussian, etc. In this study, the Sugeno type fuzzy inference system was used, as the Sugeno system is more computationally efficient than the Mamdani type. Mamdani is more dependent on expertise. However, the Sugeno type is trained with real data, as added by Şahin, Erol (2017). Mathur et al. (2016) describe the ANFIS model. In the ANFIS, the crisp input signal is converted to fuzzy inputs using the membership function. The fuzzy input together
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 49 with the membership function is then fed to the neural network block. A neural network block consists of a rule base that is connected to an inference engine. The back propagation algorithm is used to train the inference engine to select the right rule base. After the training, appropriate rules can be generated and omitted from the neural network block to provide an optimal output. The language output from the neural network block is then converted to a crisp output by means of a decryption unit. The structure of the neuro- -fuzzy model consists of different adaptive layers. Each of these layers has nodes with an associated network of transfer functions through which the fuzzy inputs are processed. The output from these nodes is then merged to give a single crisp output, since the ANFIS configuration allows only one model output. This crisp output is feedback as an input to the model and compared to the set value. If any deviation occurs, the error signal thus generated becomes an input to the ANFIS, maintaining stability in the system. Yilmaz (2003) describes the ANFIS structure as follows: A neural network consists of 5 layers in addition to the input layer (Layer 0). Layer 0: The input layer has n nodes, where n is the number of inputs to the system. Layer 1: A fuzzification layer in which each node represents a value of membership to a linguistic concept represented by a mean value membership function: ( ) 2 1 1 bi Ai x x ci ai µ =− + . (1) Where ai, bi, ciare the parameters of the membership function. These are adaptive parameters. Their values are adjusted through the back propagation algorithm during the learning phase. Layer 2: The rule layer provides the rule strength for each node using a multiplication operator. Performing min (AND) operations. Represented values of the membership μAi(x0) and μBi(x0) are multiplied to find the rule power, where the variable x0 has the linguistic value Ai and xi has the linguistic value Bi in the antecedent portion of rule i. There are pn nodes indicating the number of rules in layer 2. Each node represents an antecedent part (if part of and if- -then rule) of the rule. Here n is the number of input variables and p is the number of membership functions. ( ) ( ) 01 wi Ai x Bi x µµ = ⋅ . (2) Figure. 1. Basic structure of the ANFIS. Source: Salleh et al., 2018.
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 50 Layer 3: Is a normalization layer that normalizes the strength of all rules according to the following equation: 1 R j wi wi wj = =∑. (3) Where wi is the force ith of the rule that was calculated in layer 2. The node i calculates the ratio of the force of this rule to the sum of all the rules. In this layer there are nodes pn. Layer 4: Is a layer of adaptive nodes. Each node in this layer calculates a linear function where the coefficients are adjusted using a multi-layer feed-forward neural network. ( ) 0 0 11 2ifi i w w px px p= ++ , (4) pi’s are the parameters where i = n + 1 and n is the number of inputs to the system (i.e. the number of nodes in layer 0). This equation was given for two inputs. Finally wi is the output from layer 3. These parameters are updated by the learning step. The least squares approximation is used in ANFIS. In the temporal model, back-propagation algorithm is used for training. Layer 5: The output layer whose function is the sum of the net outputs of nodes in layer 4. The output is calculated according to: i ii wifi wifi wi = ∑ ∑∑. (5) Where wifi is the output of node i in layer 4. This indicates the consequent part of rule i. The overall output of the neuro-fuzzy system is a summary of rule consequents. Among the advantages of the ANFIS is the robustness of the results generated by the model. The ANFIS, like neural networks, is capable of generalization. Also, the ANFIS is able to take crisp output and represent it in the form of membership and fuzzy rule functions, from which it generates crisp output. It is a very promising tool that needs to be explored in solving various non-linear and complex problems. However, as further described by Salleh et al. (2017), the ANFIS computational costs are high due to complex structure and gradient learning. This is a significant problem especially for large input applications. In general, the constraints are: a) the type and number of membership functions, b) the location of membership function, and c) the curse of dimensionality. In addition, a compromise between interpretability and accuracy is considered a major problem with this system. In the context of the ANFIS’s interpretability with grid partitioning, it creates a large number of rules that model users may not understand easily and easily. The interpretability is therefore compromised, although a large number of rules contribute to improving the model accuracy. As the authors further state, the ANFIS works well when there are no more than five inputs. 3. Proposed model Central European stock markets have been selected for testing. Specifically, the Prague Stock Exchange, the Bratislava Stock Exchange, the Warsaw Stock Exchange and the Budapest Stock Exchange have been selected. The Prague Stock Exchange is the largest and oldest organiser of securities market in the Czech Republic. The official PSE index is the PX index, which was created in 2006 by merging the PX50 and PX-D indices. The PX Index is a market capitalized price index composed of the most traded stock titles. It currently contains a total of 12 stock titles. The official stock index of the Bratislava Stock Exchange is SAX. This is a capital-weighted index. The Warsaw Stock Exchange is the largest stock exchange in Eastern Europe and one of the most respected Polish financial institutions. For the purpose of this paper, we have selected the largest stock index of the Polish Stock Exchange called WIG. The history of
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 51 Table. 1. A portion of stock indexes data. Date SAX WIG BUX PX 26.02.2016 303.74 45,455.80 23,065.93 855.43 25.02.2016 302.66 45,834.88 22,705.29 879.15 24.02.2016 304.51 45,639.62 22,536.03 886.64 23.02.2016 304.51 44,288.45 22,888.51 871.22 22.02.2016 305.59 44,377.27 22,571.80 878.51 Source: official stock exchanges websites, 2019. Figure. 2. Historical development of the SAX. Source: BSSE, 2019. Figure. 3. Historical development of the WIG. Source: GPW, 2019. Figure. 4. Historical development of the BUX. Source: BSE, 2019. Figure. 5. Historical development of the PX. Source: PSE, 2019. this stock index dates back to 1991. Currently, the WIG contains over 300 companies. The Budapest Stock Exchange is the second largest stock exchange in Central Europe in terms of market capitalization and liquidity. The official index of this exchange is the BUX stock index. This index consists of approximately 20 shares of blue chips listed on the Budapest Stock Exchange. Daily stock indexes closing rates for the selected period 2014 to 2018 are used. Since the stock index value is relatively large and the index differences are significant, which may have a negative impact on the model performance, it is necessary to pre-process the original data using the following standardization procedures used in Li, Xionga (2005) and Zhai et al. (2010): t t xm y Mm − = − , (6) where xt is the closing daily price of the stock index at time t, { } max t Mx= and { } min t mx =.
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 52 Then the vector of the variables entering the model is defined as follows: ( ) 321 , , , tt tt yyyy −−− . (7) The ANFIS model can be built by dividing the input and output data into rules. This can be achieved using a number of methods. The grid partition method has been selected for this paper. The grid partition technique has been applied to generate FIS by using given training data set therefore based on the total amount and category of the membership function. The grid partition approach divides data space into grids as mentioned by Talpur et al. (2017). A fuzzy inference system (FIS) type Takagi-Sugeno is created with three input variables and one output variable predicting the normalized price of selected stock indices of the Central European countries. Given the nature of the data coming from the stock market, Gaussian membership functions have been chosen that best fit their nature. This type of the membership function is also recommended by Talpur et al. (2017). Table. 2. A portion of normalized stock indexes data. Date SAX WIG BUX PX 26.02.2016 0.6621 0.1451 0.2837 0.2759 25.02.2016 0.6556 0.1374 0.2857 0.2319 24.02.2016 0.6668 0.0841 0.2717 0.2527 23.02.2016 0.6668 0.0877 0.2652 0.2499 22.02.2016 0.6733 0.0669 0.2788 0.2037 Source: Own research, 2019. Table. 3. A portion of inputs and output of the SAX index. Date Input 1 Input 2 Input 3 Output (t−3) (t−2) (t−1) (t) 22.02.2016 0.3078 0.2933 0.2666 0.2788 23.02.2016 0.2933 0.2666 0.2788 0.2652 24.02.2016 0.2666 0.2788 0.2652 0.2717 25.02.2016 0.2788 0.2652 0.2717 0.2857 26.02.2016 0.2652 0.2717 0.2857 0.2837 Source: Own research, 2019. Figure. 6. FIS model of 3 inputs and 1 output. Source: Own research, 2019.
Zuzana Janková, Petr Dostál: Prediction of European Stock Indexes using Neuro-fuzzy Technique 53 The created FIS is divided into three attributes (LOW, MEDIUM, HIGH). The actual structure of the FIS model is shown in Figure 6. The proposed model uses Takagi-Sugeno rules in the form of IF-THEN, generated by the adaptive neuro-fuzzy inference system. The ANFIS created a total of 27 rules. Figures 7 to 10 show the result of the ANFIS training process containing output values and the number of training data. The output values are represented by normalized price of the analysed stock indices. Nearly 1,400 values are selected for model training. The created ANFIS model uses the hybrid- -learning (training) algorithm. This learning algorithm, as reported by Loganathan, Girija (2013), combines the least-squares estimator and gradient descent method. Initially, each fuzzification neuron is assigned initial functions in the form of Gaussian distribution with certain parameters. During the training process, the training data set is presented to the ANFIS cyclically. Each cycle through all the training examples is called an epoch. In the ANFIS learning algorithm, each epoch comprises of a forward pass and a backward pass. The purpose of the forward pass is to form and adjust the consequent parameters, while that of the backward pass is to adjust the parameters of the activation functions. For this model, the number of training epochs is 30 and training error tolerance is set to zero. Setting the training error tolerance to zero is recommended in specialised literature such as Azar (2010) or Bohra, Bhatia (2012) and many others because of the uncertainty of behavioural error in training. The training process stops whenever the maximum epoch number is reached or the training error goal is achieved. The figure shows that the ANFIS model is almost perfectly trained on the selected training data set. The crosses indicate the values generated by the ANFIS model. The circles then indicate the actual stock index values Figure. 7. ANFIS training process of the SAX. Source: Own research, 2019. Figure. 8. ANFIS training process of the WIG. Source: Own research, 2019. Figure. 9. ANFIS training process of the BUX. Source: Own research, 2019. Figure. 10. ANFIS training process of the PX. Source: Own research, 2019.