STOCK RETURNS PREDICTION BY USING ARTIFICIAL NEURAL NETWOK MODEL FOR PAKISTAN STOCK EXCHANGE

Artificial neural networks are extensively used to predict the financial time series. This study implements the neural network model for predicting the daily returns of the Pakistan Stock Exchange (PSE). Such an application for PSE is very rare. A multi-layer perception network is used for the model used in this study, while the network is trained using the Error Back Propagation algorithm. The results showed that the predictive power of the network was performed by the return of the previous day rather than the input of the first three days. Therefore, this study showed satisfactory results for PSE. In short, artificial intelligence can be used to give a better picture of stock market operators and can be used as an alternative or additional to predict financial variables.


Introduction
Predictability of stock returns always remained vital for computational scientists as this involves enormous amount of monetary benefits. We know that stock market is a place where huge amount of investment is being done and in present day economic circular flow the share of stock market has been increased enormously. Prediction in financial engineering have been traditionally based on statistical forecasting methods but very seldom these parametric (statistical) methods proven fruitful to capture the non-linearities and noise in the time series. Whereas Neural Networks appeared to be very helpful in predicting non-liner trends and volatilities of time series which can be considered one of the major contribution of the artificial intelligence in recent years. These models can be used to analyze the relations between economic and financial variables, data filtration, forecasting, optimization and generating time series (Cameron & Scuse, 1999;Cao et al., 2005;Cheh, Weinberg, & Yook, 1999;Cogger, Koch & Lander, 1997;Cooper, 1999;Desai et al., 2012;Garcia & Gencay, 2000;Gençtürk, 2009;Ghanzanfar et al., 2017;Hamm & Brorsen, 2000;Hawley, Johnson, & Raina, 1990;Hu & Tsoukalas, 1999;Moshiri, Shtub & Versano, 1999;Oh et al., 2006;Osman et al., 2013;Terna, 1997;Tkacz, 2001;Wang et al., 2011;White, 1988White, , 1996. Neural networks have got significant reception by the financial engineers and practitioners in recent years because of their immense learning abilities. Supporters of these models include academicians, practitioners and industry persons like researchers, portfolio managers, investment banks, trading firms and most of the major investment banks. Goldman Sachs and Morgan Stanley devoted special sections to the implementation of neural networks. In the financial sector, Fidelity Investments has set up an investment fund whose distribution of investments depends solely on the recommendations of an artificial nervous system. So, resources have been put in the development of the Artificial Neural Networks (ANNs) which is supporting our argument in favor of neural network models (Shachmurove & Witkowska, 2000). Further, neural networks application in finance include risk measurement for the mortgage loans (Collins, Gohsh, & Scofield, 1988), corporate bonds are being rated by using neural network framework (Altman, et.al., 1994;Salchenberger, Cinar, & Lash, 1992), similarly credit cards rating (Susan & Chye, 1997), pricing of derivatives (Hutchinson, 1994) so on and so forth.
Keeping in view the above discussion it is very crucial for the stock market players to have a fair overview and prediction mechanism by using the different and updated methods. The weightage of importance is higher when it comes to the developing stock markets because the confidence level of investors is very low in these markets and investor's behavior is too sensitive regarding their investment returns because most of these financial markets are facing higher financial, economic and political risks. Pakistan Stock Exchange (PSE) is a developing equity market and we found very few studies in the field by using artificial neural network and those which are being found used smaller sample size as compare to the current study also the architecture of this study is comprehensive, which is discussed in the latter sections. This paper is an attempt to predict the fact that the neural networks are model free estimators and are ideal models for forecasting financial variables and their analysis, for this purpose we used daily returns of Pakistan Stock Exchange (PSE) by using the Back-propagation model, also the application of neural networks in financial engineering is been reviewed.

Literature Review
It is about 28 years since studies for stock index prediction by using neural network models have been performed. The pioneer study in this regard is the one which is conducted by Kimoto et al. (1990) for TOPIX (Tokyo Stock Exchange Price Indices) they developed numerous algorithms and prediction methods for TOPIX. In their study they compared the results obtained from NN with the results estimated by using multiple regression analysis and their conclusion was in favor of NN as the correlation coefficient appeared to be high enough(0.991) whereas, the correlation coefficient for multiple regression was lower (0.543). Yoon and George (1991) conducted study for the stock price forecasting and they made an analysis based on neural networks and multiple discriminant analysis (MDA) which showed that mean success rate based on four-layer network was 77.5% whereas MDA obtained a mean of 65%. A similar kind of study was conducted by Yoon et.al. (1993) in which a comparison has been made between discriminant analysis (DA) and neural network and results showed that the accuracy of NN is about 91% whereas DA results showed 74% accuracy. Mallaris and Linda (1996) conducted a study based on S&P index by using neural network framework and the correct prediction percentage appeared to be 0.794 whereas the correlation between neural network forecast and future volatility appeared to be 0.8535. Neural network model also been used by Muzeno et al. (1998) to predict the signals for Tokyo Stock Exchange price index (TOPIX) and their prediction appeared to be 63% accurate. Phua et al. (2000) also used neural network system and genetic algorithm for Singapore Stock Exchange (SGX) to estimate and predict the behavior by using 360 data points between 1998 and 2000 their prediction appeared to be 81% accurate. O'connor and Michael (2005) used neural network to predict the movement in the prices of Dow Jones Industrial Average (DJIA) index. Neural networks trained by using different external indicators came up with a yearly 23.5% profit while the DJIA index inflated by 13.03% annually. Li and Liu (2009) performed their study for Shanghai Stock Exchange (SSE) by using the Back Propagation (BP) network. They trained their data and made a conclusion in favor of ANN. Guresen et al. (2011) estimated that neural network models are quite efficient in performing their analysis for the NASDAQ Stock Exchange Index. They analyzed that these models are MLP dynamic artificial neural network and hybrid neural networks. The methodology used in their study was generalized autoregressive conditional heteroscedasticity (GARCH). Results showed that the MLP is a powerful and practical tool for predicting the movement of values. Aghababaeyan et al. (2011) conducted study based on the standard advanced propagation model, feed-forward back propagation (FFB) of the neural network to predict the Tehran Stock Exchange (TSE). The model predicted the stock price fluctuations with an accuracy of 83%. Wang et al. (2011) proposed a new price model for the Shanghai Composite Index (SIC), this approach is the Wavelet De-noising-based Back Propagation (WDBP) neural network. A comparison has been made of this new network with the single Back Propagation (BP) neural network and it appeared that their WDBP model is efficient. Desai et al. (2012) captured the movement in the stock market. They used a computational approach for prediction. Their sample was S&P CNX Nifty 50 Index. Their network predicted the movements in the stock market prices with an accuracy of 82%.
Hussein et al. (2015) evaluated stock market volatility by using MLP ANN whereas training KLD algorithm is used and they concluded the better performance of ANN model for the stock market predictability. The performance is been evaluated statistically as well. Lu et al. (2016) has predicted the two types of hybrid ANN models for the Chinese stock markets by taking into account the energy sector and reported that EGARCH-ANN performed better than the other model.

Artificial Neural Network (ANN)
Artificial Neural Networks (ANN) are named by inspiring the biological neural networks much similar to the human brain as far as their working nature is concerned. Human brain is strong interconnection of neurons. ANN is also similar to this architecture as neurons are organized and connected in a categorized manner. These are effective machine learning tools which are used to perform a specific task. Input layers and output layers are interweaved distinctly through a single or multiple hidden layer(s). The strength of each connection between any two neurons is generally shown by a numerical number which is generated with the help of decision boundary obtained by the ANN classifier. Different algorithms are being used to estimate the weight values when inputs and outputs are presented to Neural Network as training data set. Once the estimated values are proved stable after validation, trained ANN is then tested against a test data set to evaluate its foretelling supremacy.
The approach adopted to train the neural network in the present study is explained below as:

a) Inputs and Outputs:
The historical prices of the stocks are used as inputs. These inputs are the deferred coordinates of the time series. The number of inputs to the network is four (4), which are the consecutive returns of the four days whereas the return of the fifth day is considered to be the output. Fig.1) is chosen for the prediction which is considered to be the simplest architecture. Figure 1 depicts a typical Multi-Layer Perception (MLP) network with five inputs, one hidden layer and one output. The neural network must consist of three layers of nodes namely the input layer, hidden layer and the output layer. Following is the two-step process which determines activity of a unit in the output layer.

b) Network Structure: Multi-Layer Perception (MLP-
It computes the total weighted input X j by using the following formula: = Where y i is the activity level of the j th unit in the previous layer whereas W ij is the connection of weight between i th and j th unit.
Secondly, activity y j is been calculated by a unit using a total weighted input function. Typically, sigmoid function is used for this purpose which is:

d) Training Scheme:
The most common and suitable algorithm is the Back-Propagation the basic theme of this algorithm is to adjust the weights which can reduce the errors.
The error, E is defined as: Here is the activity level of jth unit in the top layer ,d i is the j th unit's desired level of output.
Next, some discussion about the Back-Propagation algorithm which consists of four important steps as follows: The derivative of error (EA) must be computed with respect to the y j, the activity level, which shows how fast the error changes with the change in output activity level.

= .
Next step is to compute that how fast the errors changes as input changes with that of a change in output unit and this change is represented by EI.
Now, compute the speed of adjustment of error in response to a change in weight to the output unit change and is represented by EW.
In the last step, determine how quickly the error changes as the activity of the unit changes to the previous layer. This is the most necessary step because it allows the back propagation on a multilayered network. When the activity of a unit in the previous layer is changed then all exit activities are performed.
The EAs can be used to convert a single layer units into the EAs of the previous layer, by using step 2 and step 4. This step can be repeated depends how many EAs we need for the previous layer. After having the EAs we can use step 2 and step 3 to compute the EWs on its incoming connections.
The time series of market returns of Pakistan Stock Exchange (PSE) is trained and evaluated by using Multi-Layered Perception structure and Back-Propagation training method.

Data
The empirical analysis in this paper is made on the data of KSE100 index, Pakistan Stock Exchange (PSE) previously known as Karachi Stock Exchange (KSE), which is the official equity market. There are 4,017 observations from 1 st January2007 to 31 st December 2017.

Empirical Findings
Prediction Accuracy: Both the training and test data set were used repeatedly to train the network. Four parameters are used to identify to know the stop point of training, namely the RMSE error and the correlation coefficient for the training set and test set, RMSE is defined as: It appeared that by 5500 iterations training correlation coefficient and test set correlation coefficient are 0.039 and 0.036 respectively. There was no decrease seen in the errors as training was stopped after 5500 iterations. Thus any further training would not be significant or productive. The results in this study showed that the predictive accuracy of the training data is 95.1 percent and of test data is 95.3 percent and these results are significant at 5 percent level of significance. We have also seen that the correlation between the input and the predicted output has improved for the test data and this claim is supported by the results of RMSE and correlation coefficient.

Importance of Inputs:
Once the network is fully formed, sensitivity analysis is performed to see the relative importance of each input. The objective of this analysis is to determine the sensitivities which can be done by cycling the input of all drive schemes also calculating the effects of the output response on the network.

Utilization of Hidden Nodes:
In the final phase, an analysis is performed to evaluate the optimal use of hidden nodes. This has been done to avoid the over-design of the hidden layer on the grid, which can lead to many nodes, which will contribute little or no response to the output response. If there are many nodes in the layer that show a great contribution, this layer can be divided into too many nodes. In the same way, if all the nodes show a strong contribution to the conclusion that adding additional nodes can help the model. Table 1 shows the descriptive statistics of the training as well as for the test data sets. Table 1 and Table 2 show neural network information for calculating daily yields. A hidden layer is used with three input layers, while the input layers and the hidden layers have four nodes whereas the output layer has only one node. The network is fully connected. This article uses sigmoid transfer functions. The total number of cartridges was 4,612, the last 1,400 for testing, which means that the first 3,212 were the learning set.

Conclusion
This article is an attempt to predict the daily return on the stock market for PSE. For this purpose, a multilayer observation network is used and the data is generated using the algorithm for error propagation. The foretelling power of previous day's return is higher than that of the first three days. The analysis showed that the maximum number of useful hidden nodes is four. The predictive accuracy of the model is high for the training and test data sets, while the model best matches the test data with the training data.
Neural networks are generally experimental in nature which requires a lot of trials so the process associated with high percentage of errors. Different structures of the neural network used to predict the behavior of the stock market than a comparison based on the accuracy results can be performed to choose the suitable architectures. Stock market players should consider developing different trading strategies in equity markets by using neural networks. New experiences are probably needed to produce better results, forecast share prices and continue work by checking weekly or monthly returns, and the inclusion of other microeconomic and macroeconomic variables as inputs. In addition, the role of macroeconomic variables such as interest rates, economic stability, Gross Domestic Product (GDP), global trend, etc., should be considered for a better network structure. Further network can be extended and developed for technical analysis. A better network structure can be obtained by changing the parameters of the learning algorithm. Financial markets contribution is carrying crucial place in the present day economic pie so the accurate prediction of stock market get more important therefore, academicians and practitioners have devoted their efforts in finding the most appropriate model we should not conclude that the Neural network is the best one but it can be said that the neural networks have the ability to predict financial markets and if they are well trained, individual and institutional investors can benefit from their use prognostic tool.