Professional Documents
Culture Documents
a r t i c l e i n f o a b s t r a c t
Keywords: The close price prediction model of the Zagreb Stock Exchange Crobex index is presented in this paper.
The Zagreb Stock Exchange Crobex index For the input/output data plan modeling the Crobex index close price historical data are retrieved from
close price the Zagreb Stock Exchange ofcial internet pages. The prediction model is created in the way that for each
Adaptive neuro-fuzzy inference system of 5 days in advance it predicts the Crobex close price. The prediction model is generated based on the
(ANFIS)
input/output data plan by means of the adaptive neuro-fuzzy inference system method, representing the
Fuzzy inference system (FIS)
Neural networks (NNs)
fuzzy inference system. It is of the essence to point out that for each day a separate fuzzy inference sys-
tem is created by means of the adaptive neuro-fuzzy inference system method based on the same set of
input/output data, the only difference being that for every separate fuzzy inference system different sub-
sets for training and checking are used so that input variables are differently created. The input/output
data set represents the historical data of the Crobex index close price from 4 November 2010 to 24
January 2012 and the Crobex index close price is predicted for the subsequent 5 days, the rst day of
prediction being 25 January 2012. After that the above mentioned input/output data set is shifted 5 days
in advance and the Crobex index close price is predicted in advance for the next 5 days starting with the
last day of the input/output data set. In that way the Crobex index close prices are predicted until 19
October 2012 based on the Crobex index close price historical data. At the end of the paper qualitative
and quantitative estimates are presented for the given approach of predicting the Crobex index close
price showing that the approach is useful for predicting within its limits.
2013 Elsevier Ltd. All rights reserved.
0957-4174/$ - see front matter 2013 Elsevier Ltd. All rights reserved.
http://dx.doi.org/10.1016/j.eswa.2013.05.029
6056 I. Svalina et al. / Expert Systems with Applications 40 (2013) 60556063
Mexican stock exchange (2010) and the results for each ANFIS are predictions 1 day in advance. This limitation stipulated the devel-
evaluated by the Root Square Mean Error method (RSME). Due to opment of 1 day trade strategy based on the genetic programming
the poorer approximation of previous models, trading costs can in- obtained prediction of the lowest and highest stock prices. In paper
crease, e.g. commission charges in successive buying and selling as (Zhai, Wen, Yang, & Song, 2010) the authors investigate whether
a result of unimportant alarms and other bad forecasts of price the hybrid approach, by combining different approaches of stock
trends which do not meet the dealers expectations and can become prediction, can considerably surpass any individual approach. Per-
non-refundable, so the authors in paper (Esfahanipour & Aghamiri, formances of different hybrid approaches are compared. In the hy-
2010) developed the neuro fuzzy inference system adapted to the brid approach three well investigated approaches are combined:
TakagiSugenoKang (TSK) kind of fuzzy rules for close price pre- back propagation neural network (BPNN), adaptive network-based
diction. The proposed model was tested on the Teheran Stock Ex- fuzzy neural inference system (ANFIS) and support vector machine
change Indexes (TEPIX). In paper (Boyacioglu & Avci, 2010) the (SYM). Experimental data show that by combining individual algo-
authors investigate the stock exchange earning predictability using rithms better performances can be obtained than by individual ap-
ANFIS. The aim was to nd out if the ANFIS algorithm was suitable proach of any single algorithm. Paper (Cheng & Quek, 2007)
for accurate prediction of earning per share. Six variables are used analyzes the use of ANFIS in predicting the possible action day of
as input and three indices were used as output. The experimental investors business moves (buying or selling) and the possible busi-
data showed that the ANFIS algorithm based model was successful ness moves of investors on that day. The results showed that the
in forecasting monthly earnings by predicting stock prices of the model relatively better predicted the investors action day than
Istanbul Stock Exchange (ISE) index. In paper (Alizadeh, Rada, Jolai, their concrete moves. A number of methods used for predicting dai-
& Fotoohi, 2011) the authors suggest to use ANFIS for predicting ly stock prices are presented in paper by Afolabi and Olude (2007).
earnings on stock portfolio. They show that the forecast portfolio These methods are backpropagation, Kohonen SOM, and a hybrid
earnings can be improved by taking various technical and basic Kohonen SOM. According to the results the least error is obtained
attributes of different stock exchange indices as ANFIS inputs. The by the hybrid Kohonen SOM method. In paper (Olatunji, Al-Ahmadi,
neuro-fuzzy model is tested on the Teheran Stock Exchange portfo- Elshafei, & Fallatah, 2011) the authors propose a model based on
lios. Experimental data show that the proposed methods predict the articial neural networks for prediction of Saudi Stock market.
portfolio earnings better than the classical Markowitz portfolio The proposed model is based mostly on the Saudi Stock market his-
optimization method, multiple regression, neural networks and torical data for a large time period. The obtained results show that
the SugenoYasukawa method. In paper (Alizadeh, Jolai, Aminnay- the proposed ANN model predicts the next day close price with a
eri, & Rada, 2012) the authors analyze the performances of ve ba- low average error and a high correlation coefcient. The authors
sic and widely used input selection algorithms to determine the in paper (Ansari, Kumar, Shukla, & Tiwari, 2010) provide a state-
most relevant input variables, including both model-free methods of-art for Adaptive Neural-Fuzzy Network (ANFN) application to
and model-based methods. At the end they compare the perfor- forecast stock market index and involved market uncertainties by
mances of those algorithms by applying them to the stock price pre- combining the econometrical test to optimize the ANFIS and FIS
diction problem. The experimental data pointed to the advantages function. All the tests and analyses are studied on NASDAQ Stock
and disadvantages of those ve input selection algorithms. The Market for the years 2008 and 2009. In paper (Kim & Lee, 2004) a
WASP (Wave Analysis Stock Prediction) system based on neuro- feature transformation method is compared with two conventional
fuzzy architecture is presented in paper (Atsalakis, Dimitrakakis, methods for natural neural networks by means of genetic algorithm
& Zopounidis, 2011). The WASP system is used to predict stock (GA). Three feature transformation methods are compared and the
prices and is tested on the stock of the National Bank of Greece. results obtained by the feature transformation method using genet-
The obtained results are encouraging. The authors of paper (Atsala- ic algorithm show better performances with regard to the other two
kis & Valavanis, 2009) present the methodology based on ANFIS to methods. Based on the principles of technical analysis, in paper
predict short-term stock movements. The Athens and the New York (Tan, Quek, & Cheng, 2011) the authors propose a model of articial
Stock Exchange (NYSE) data are used for the proposed model train- intelligence which employs the adaptive network fuzzy inference
ing and evaluation. The proposed system is compared with the buy system (ANFIS) supplemented by the use of reinforcement learning
and hold strategy and several other methods and is shown to be far (RL). The results show that the proposed model is a powerful and
more superior. In paper (Hsieh, Hsiao, & Yeh, 2011) the authors valuable tool in stock investment decisions.
present the integrated system where wavelet transforms and recur-
rent neural network (RNN) based on articial bee colony (ABC) 2. The problem denition and the goal of investigation
algorithm (called ABCRNN) are combined for stock price forecast-
ing. This integrated system is tested on several international stock In order to make prot it is very important to predict stock mar-
exchanges, Dow Jones Industrial Average Index (DJIA), London ket movements as precisely as possible. Various indices are used as
FTSE-100 Index (FTSE), Tokyo Nikkei-225 Index (Nikkei), and Tai- indicators of a market. At the Zagreb Stock Exchange several indi-
wan Stock Exchange Capitalization Weighted Stock Index (TAIEX). ces such as Crobex and Crobex10 are calculated and published
The proposed system gives quite promising results and it also has daily. Index is an indicator of value of a given number of stocks
a feature for predicting stock prices and maximizing prot in the in its composition and it is used to monitor the success of a market
trading system real time. In paper (Cheng, Wei, & Chen, 2009) the or a sector. Therefore, for a market or a sector the index is an
authors suggest a new model based on multi-stock volatility cau- indicator of the stock up trends or down trends. Because of the
sality, a fusion adaptive-network-based fuzzy inference system mentioned reasons it has been decided to make a model for pre-
(ANFIS) procedure, for the problem of predicting stock price in Tai- dicting the index value on the basis of several days. The Crobex
wan. Three practical, obtained data sets for stock indices of Ameri- index is selected as it is composed of several different stocks which
can and Taiwan stock exchanges were used in the empirical show it as a more robust indicator of trends on the Zagreb Stock
experiment. The experimental data show that the suggested model Exchange.
is superior to Yus model and Chens model with regard to the root The Zagreb Stock Exchange Crobex close price index is chosen
mean square error and the realized prot. A possible prot making as the prediction model output. For the input/output data plan the
trade strategy based on predicting stock prices using genetic Crobex index historical data are used available at the Zagreb Stock
programming is proposed in paper by Kaboudan (2000). Genetic Exchange ofcial website. The prediction model is created in the
programming evolves regression models that give reasonable way that for each of the ve days, in advance, it predicts the
I. Svalina et al. / Expert Systems with Applications 40 (2013) 60556063 6057
Crobex index close price. In addition to that, historical time period After that the input/output data set changes by being moved
is simulated where the rst input/output data set is composed of 5 days in advance. The above mentioned activities are then re-
the Crobex index close price data in the time period from 4 peated. It is crucial to point out that the input/output data set shift-
November 2010 to 24 January 2012. Based on the rst set of in- ing occurs 38 times and the last datum in the 38th set of the input/
put/output data the prediction model is generated by means of output data is the Crobex close price on 19 October 2012. Fig. 1
an adaptive neuro-fuzzy inference system method representing depicts the scheme of the complete prediction model.
the fuzzy inference system. The model is created so as to generate The input/output data plan concerning prediction days is cre-
a separate fuzzy inference system for each of the 5 days based on ated based on the Crobex index close price as shown in Table 1.
the same set of input/output data of which 80% are used for train- It can be seen that the input/output data plan has got three inputs
ing and 20% for the fuzzy inference system checking. The data for and one output.
the training and the checking subsets are chosen at a random basis, The inputs are differently created for every prediction day and
the pattern of the subsets being different for each of the predicted are marked with Closep and the day on which the observed Cro-
days. The Average relative error and the Average coefcient of bex index close price is realized considering the time t which
variation of root mean square error are then used to introduce marks the day of the last known close price.
the performances of each of the fuzzy inference systems on a given For each of the fuzzy inference systems on the current predic-
prediction day. The already mentioned various training and check- tion day, input variables are selected based on multiple correla-
ing subsets and the different choice of input variables are what tions. Fig. 2 illustrates the correlations between the rst and the
makes a difference between the generated training and checking second input and the corresponding output for the ve prediction
subsets by prediction days. days.
6058 I. Svalina et al. / Expert Systems with Applications 40 (2013) 60556063
Table 1
Input/output data plan.
Fig. 2. Correlations between the rst and the second input and the corresponding output for all ve prediction days.
3.1. Fuzzy logic A fuzzy system is any static or dynamic system that uses fuzzy
logic and a corresponding mathematical environment (theory of
In 1965 paper L.A. Zadeh proposed fuzzy logic as an alternative fuzzy sets, fuzzy rules and fuzzy inference or fuzzy reasoning).
way for conveying data. Fuzzy logic or foggy logic is the logic Basically, the fuzzy inference systems include three components:
that serves for describing unreliable data or knowledge. The main basis of fuzzy rules, data base of membership functions and rea-
difference between the fuzzy and the classical logic refers to the soning mechanism. Fuzzy reasoning is the process of mapping
data membership in a set. While in the fuzzy logic data can be- from the given inputs to the outputs by means of fuzzy logic.
long to more than one set in the classical logic they either belong There are three main kinds of fuzzy systems, the difference be-
or do not belong to some set. One of the greatest advantages of tween them being in the way of calculating the output:
fuzzy logic is the use of linguistic variables that can be easily
understood. Traditional two-valued logic or often called binary lo- 1. Mamdani system (gives a fuzzy output that has to be
gic can be considered as a subset of fuzzy logic. Fuzzy logic is defuzzied).
used in many problems in which data and/or knowledge need 2. Sugeno system (uses the function that gives a real number as
not be precise. output).
I. Svalina et al. / Expert Systems with Applications 40 (2013) 60556063 6059
3. Tsukamoto system (similar to Sugeno system but uses monoto- antecedent parameters and the parameters of the Sugeno fuzzy
nous functions). system output function or consequent parameters (pi, qi and ri)
are adapted. It can be seen that by training the parameters are opti-
The main disadvantage of fuzzy systems is that the knowledge mized which can be placed in two sets: antecedent parameters and
about a problem must be known in advance for a qualitative fuzzy consequent parameters. As the consequent parameters are linear
inference system to be dened. the linear least square method is used in parameter optimizing
while a gradient descent algorithm such as backpropagation algo-
3.3. Neuro-fuzzy system rithm is used in antecedent parameter optimizing.
Fig. 3 shows the ANFIS system general architecture for a fuzzy
The disadvantages of fuzzy inference systems (expert knowl- inference system with two inputs x and y and one output fout.
edge about a problem has to be known in advance) and neural net- Basically, ve layers are used to construct this inference system
works (giving complicated rules hard to understand) are the reason (Fig. 2). Each ANFIS layer consists of several nodes described by the
why the neural fuzzy systems appeared, retaining the advantages node function. The inputs of present layers are obtained from the
of both methods and outweighing the disadvantages. The lack of nodes in the previous layers. The rule base of ANFIS contains fuzzy
fuzzy inference systems is solved by creating the knowledge about IF-THEN rules of Sugeno type. For a rst order Sugeno fuzzy infer-
a problem from the neural inference system training data while the ence system, the two rules may be stated as:
complicated and hard to understand rules of neural networks are
bypassed by using linguistic variables by means of which results Rule1 : IF x is A1 AND y is B1 THEN z is f 1 x; y
are easily explained. Rule2 : IF x is A2 AND y is B2 THEN z is f 2 x; y
A well-known neural-fuzzy system is the adaptive neuro-fuzzy
inference system (ANFIS) used in solving various problems. The where x and y are the inputs of ANFIS, Ai and Bi are the fuzzy sets
fuzzy inference system of Sugeno type can be considered as an and fi(x, y) is a rst order polynomial and represents the outputs
adaptive neural fuzzy inference system in the form similar to neu- of the rst order Sugeno fuzzy inference system. The architecture
ral networks in which by training the system on input/output data of ANFIS is shown in Fig. 3, and the node function in each layer is
set the parameters of the fuzzy inference membership functions or described below. Adaptive nodes, denoted by squares, represent
Table 2 xi
Q 3;i -i P for i 1; 2 4
Average relative error by prediction days in percentage. xi
First day Second day Third day Fourth day Fifth day
The output -i represents the normalized ring strength of a rule.-
AvRE 0.8687 0.9563 1.3586 1.4249 1.4027 Layer 4: Every node in this layer is an adaptive node, marked by a
square, with node function
Q 4;i -i fi for i 1; 2 5
the parameter sets that are adjustable in these nodes, whereas xed where f1 and f2 are the fuzzy IF-THEN rules as follows:
nodes, denoted by circles, represent the parameter sets that are Rule1 : IF x is A1 and y is B1 THEN f 1 p1 x q1 y r 1
xed in the system. Rule2 : IF x is A2 and y is B2 THEN f 2 p2 x q2 y r 2
Layer 1: this layer contains adaptive nodes with node functions
described as where pi, qi and ri are the parameter set, referred to as the conse-
quent parameters.
Q 1;i lAi x for i 1; 2 Layer 5: This layer has only one xed node, marked by a circle.
1
Q 1;i lBi2 y for i 3; 4 The node function is to compute the overall output by
X
where x and y are the input nodes, A and B are the linguistic labels, Q 5;i fout -i fi ov erall output 6
l(x) and l(y) are the membership functions. There are many types
of the membership functions that can be used. However, a bell From the ANFIS structure mentioned above, the overall output can
shaped function with maximum and minimum equal to 1 and 0 is be expressed as linear combination of the consequent parameters.
usually adopted. It can be written as follows Hence, the nal output can be written as
x1 x2
1 fout -1 f1 -2 f2 f f
lx or x1 x2 1 x1 x2 2
i 2bi
1 xc
a
-1 xp1 -1 yq1 -1 r 1 -2 xp2
i 2
x ci -2 yq2 -2 r 2 7
lx exp
ai
where ai, bi and ci are the parameter set. The bell shaped functions 4. Obtained results
vary while the values of this parameter are changing.
Layer 2: Every node in this layer is a xed node, marked by a cir- In this paper a model is proposed for predicting the Zagreb
cle. The node function has to be multiplied by input signals to serve Stock Exchange Crobex index close price value on the basis of sev-
as output for every node. eral days. The model is explained in detail in chapter 2. The model
Q 2;1 x1 lAi x lBi y for i 1; 2 3 predicts the index close price 5 days in advance, separately for
every day. In addition, historical time sequence is simulated so that
The output xi represents the ring strength of a rule. the rst close price prediction day, 25 January 2012, is the same as
Layer 3: Every node in this layer is a xed node, marked by a cir- the rst prediction day of the rst shifting increment of 5 days in
cle and labeled N, with the node function to normalize the ring advance, while 19 October 2012 is the last day close price predic-
strength by calculating the ratio of the ith node ring strength to tion day and it is the same as the fth prediction day of the last
the sum of all rules ring strength. shifting increment of 5 days in advance.
Fig. 6. Coefcient of variation of root square mean error for the ve prediction days.
1X n
jclosepti closepforecastti j
Table 3 Av RE 8
Average coefcient of variation of root square mean error AvCV(RSME) in n i1 jclosepti j
percentages.
First day Second day Third day Fourth day Fifth day r
Pn
AvCV(RSME) 1.5613 1.3914 2.0450 2.0038 1.9083 i1
closepti closepforecastti
RSME n
Av CVRSME 9
closep closep
The average relative error and the average coefcient of varia- where AvRE is the average relative error, AvCV(RSME) the average
tion of root mean square error will be used for evaluation of the coefcient of variation of root square mean error, RSME the root
model performances. square mean error, close(t) the actual close price, closeforecast(t)
the predicted close price, and closep is the close price average value.
Table 4 index close price 5 days into relative future starting from the last
AvRE, AvCV(RSME) and the amounts ratio of the real and the predicted price (RATIO). close price included in the input/output data set. The input/output
data set is moved 38 times by 5 days increment and the testing is
First day Second day Third day Fourth day Fifth day
conducted on 37 shifts by 5 days increment because the time ow
AvRE 0.6643 1.0039 1.4060 1.6602 1.5695
reaches the present time at that moment.
AvCV(RSME) 0.6667 1.0056 1.4000 1.6522 1.5750
RATIO 0.9994 1.0013 1.0025 1.0042 1.0034 Fig. 8 depicts the diagrams of the Zagreb Stock Exchange
Crobex index actual and predicted close price for all prediction
days in the phase of testing.
Table 4 shows the values of average relative error (AvRE), aver-
Fig. 4 shows the relative error ow chart for all ve prediction age coefcient of variation of root square mean error AvCV(RSME)
days with regard to the shifting increment of 5 days in advance and the ratio of the sums of the actual close price and the predicted
in the phase of checking. close price by every prediction day in the phase of testing.
Table 2 depicts average relative error (AvRE) by prediction days
in checking phase.
Fig. 5 shows the average relative error (AvRE) diagram by pre- 5. Conclusion
diction days in the phase of checking.
Fig. 6 represents the ow chart of the coefcient of variation of The paper deals with the problem of stock market prediction.
root square mean error CV(RSME) for the ve prediction days with The prediction model is built based on the ANFIS system and the
regard to the shifting increment of 5 days in advance in the phase model performances are estimated by the average relative error
of checking. and the average coefcient of variation of root square mean error.
Table 3 depicts the average coefcient of variation of root The obtained results are represented through two phases: the
square mean error AvCV(RSME) by prediction days in the phase phase of the model checking and the phase of the model testing,
of checking. discussed in Chapter 4. It is important to emphasize that the used
Fig. 7 shows a diagram of the average coefcient of variation of model does not in any way consider outside inuences such as
root square mean error AvCV(RSME) by prediction days in the political, and economic either qualitatively or quantitatively.
phase of checking. The obtained results show that in the checking phase the mod-
The above shows the results obtained in the phase of checking. els approximation of the Crobex index closing price is quite sat-
It was already mentioned that the input/output data set is divided isfactory. It is obvious from Tables 2 and 3 that for any of the
in two subsets: subset for training and subset for checking. In what prediction days the average relative error is less than 1.5% and
follows will be shown the results obtained in the testing phase of the average coefcient of variation of root square mean error is less
the model. The testing is conducted so as to forecast the Crobex than 2.5%. Nevertheless, some striking data for relative error and
I. Svalina et al. / Expert Systems with Applications 40 (2013) 60556063 6063