Iran s Stock Market Prediction By Neural Networks and GA

Similar documents
Statistical and Machine Learning Approach in Forex Prediction Based on Empirical Data

Forecasting stock market prices

Predicting the stock price companies using artificial neural networks (ANN) method (Case Study: National Iranian Copper Industries Company)

The Use of Artificial Neural Network for Forecasting of FTSE Bursa Malaysia KLCI Stock Price Index

Using artificial neural networks for forecasting per share earnings

Dr. P. O. Asagba Computer Science Department, Faculty of Science, University of Port Harcourt, Port Harcourt, PMB 5323, Choba, Nigeria

International Journal of Computer Engineering and Applications, Volume XII, Issue II, Feb. 18, ISSN

Predicting Economic Recession using Data Mining Techniques

International Journal of Computer Engineering and Applications, Volume XII, Issue II, Feb. 18, ISSN

Neural Network Prediction of Stock Price Trend Based on RS with Entropy Discretization

Development and Performance Evaluation of Three Novel Prediction Models for Mutual Fund NAV Prediction

Providing a Model to Predict Future Cash Flow Using Neural Networks on the Pharmaceutical and Chemical Industries of Tehran Stock Market

Stock Trading Following Stock Price Index Movement Classification Using Machine Learning Techniques

AN ARTIFICIAL NEURAL NETWORK MODELING APPROACH TO PREDICT CRUDE OIL FUTURE. By Dr. PRASANT SARANGI Director (Research) ICSI-CCGRT, Navi Mumbai

Artificially Intelligent Forecasting of Stock Market Indexes

Two kinds of neural networks, a feed forward multi layer Perceptron (MLP)[1,3] and an Elman recurrent network[5], are used to predict a company's

Based on BP Neural Network Stock Prediction

ANN Robot Energy Modeling

Bond Market Prediction using an Ensemble of Neural Networks

Forecasting stock market return using ANFIS: the case of Tehran Stock Exchange

Performance analysis of Neural Network Algorithms on Stock Market Forecasting

Cognitive Pattern Analysis Employing Neural Networks: Evidence from the Australian Capital Markets

Stock Market Prediction System

STOCK MARKET PREDICTION AND ANALYSIS USING MACHINE LEARNING

COMPARING NEURAL NETWORK AND REGRESSION MODELS IN ASSET PRICING MODEL WITH HETEROGENEOUS BELIEFS

Forecasting Initial Public Offering Pricing Using Particle Swarm Optimization (PSO) Algorithm and Support Vector Machine (SVM) In Iran

A multiple model of perceptron neural network with sample selection through chicken swarm algorithm for financial forecasting

An Improved Approach for Business & Market Intelligence using Artificial Neural Network

International Journal of Computer Science Trends and Technology (IJCST) Volume 5 Issue 2, Mar Apr 2017

A Dynamic Hedging Strategy for Option Transaction Using Artificial Neural Networks

An enhanced artificial neural network for stock price predications

Improving Stock Price Prediction with SVM by Simple Transformation: The Sample of Stock Exchange of Thailand (SET)

Option Pricing Using Bayesian Neural Networks

Role of soft computing techniques in predicting stock market direction

Portfolio Recommendation System Stanford University CS 229 Project Report 2015

Applications of Neural Networks in Stock Market Prediction

Do Trading Volume and MACD Indicator Contains Information Content of Stock Price? Evidence from China

Keywords Time series prediction, MSM30 prediction, Artificial Neural Networks, Single Layer Linear Counterpropagation network.

A RIDGE REGRESSION ESTIMATION APPROACH WHEN MULTICOLLINEARITY IS PRESENT

COMPARATIVE STUDY IN ESTIMATING VOLKSWAGEN S PRICE: ARIMA VERSUS ANN

Research Article Design and Explanation of the Credit Ratings of Customers Model Using Neural Networks

Evaluate the Ability of Artificial Neural Network to Predict the Stock Price of Non-Metallic Mineral Products Industry in Tehran's Stock Exchange

VOL. 2, NO. 6, July 2012 ISSN ARPN Journal of Science and Technology All rights reserved.

Stock market price index return forecasting using ANN. Gunter Senyurt, Abdulhamit Subasi

Stock Market Prediction using Artificial Neural Networks IME611 - Financial Engineering Indian Institute of Technology, Kanpur (208016), India

Abstract Making good predictions for stock prices is an important task for the financial industry. The way these predictions are carried out is often

A Novel Prediction Method for Stock Index Applying Grey Theory and Neural Networks

International Journal of Advance Engineering and Research Development. Stock Market Prediction Using Neural Networks

Journal of Internet Banking and Commerce

Price Pattern Detection using Finite State Machines with Fuzzy Transitions

STOCK PRICE PREDICTION: KOHONEN VERSUS BACKPROPAGATION

Barapatre Omprakash et.al; International Journal of Advance Research, Ideas and Innovations in Technology

SURVEY OF MACHINE LEARNING TECHNIQUES FOR STOCK MARKET ANALYSIS

Prediction of Stock Closing Price by Hybrid Deep Neural Network

China Stock Market Regimes Prediction with Artificial Neural Network and Markov Regime Switching

Application of Innovations Feedback Neural Networks in the Prediction of Ups and Downs Value of Stock Market *

Time Series Forecasting Of Nifty Stock Market Using Weka

STOCK MARKET TRENDS PREDICTION USING NEURAL NETWORK BASED HYBRID MODEL

LITERATURE REVIEW. can mimic the brain. A neural network consists of an interconnected nnected group of

Prediction Using Back Propagation and k- Nearest Neighbor (k-nn) Algorithm

Department of Management, College of Management, Islamic Azad University of Qazvin, Qazvin, Iran

Stock price development forecasting using neural networks

Stock Market Prediction with Various Technical Indicators Using Neural Network Techniques

ARTIFICIAL NEURAL NETWORK SYSTEM FOR PREDICTION OF US MARKET INDICES USING MISO AND MIMO APROACHES

Creation and Application of Expert System Framework in Granting the Credit Facilities

Accounting disclosure, value relevance and firm life cycle: Evidence from Iran

Predicting Abnormal Stock Returns with a. Nonparametric Nonlinear Method

COGNITIVE LEARNING OF INTELLIGENCE SYSTEMS USING NEURAL NETWORKS: EVIDENCE FROM THE AUSTRALIAN CAPITAL MARKETS

Estimating term structure of interest rates: neural network vs one factor parametric models

CHAPTER 3 MA-FILTER BASED HYBRID ARIMA-ANN MODEL

A Comparative Study of Various Forecasting Techniques in Predicting. BSE S&P Sensex

FUZZY LOGIC INVESTMENT SUPPORT ON THE FINANCIAL MARKET

Accepted Manuscript. Enterprise Credit Risk Evaluation Based on Neural Network Algorithm. Xiaobing Huang, Xiaolian Liu, Yuanqian Ren

Stock Market Forecasting Using Artificial Neural Networks

Prediction of Future Stock Close Price using Proposed Hybrid ANN Model of Functional Link Fuzzy Logic Neural Model

Multi-factor Stock Selection Model Based on Kernel Support Vector Machine

STOCK MARKET FORECASTING USING NEURAL NETWORKS

The Effect of Expert Systems Application on Increasing Profitability and Achieving Competitive Advantage

Fuzzy and Neuro-Symbolic Approaches to Assessment of Bank Loan Applicants

REGRESSION, THEIL S AND MLP FORECASTING MODELS OF STOCK INDEX

The use of artificial neural network in predicting bankruptcy and its comparison with genetic algorithm in firms accepted in Tehran Stock Exchange

Understanding neural networks

Neuro-Genetic System for DAX Index Prediction

Alternate Models for Forecasting Hedge Fund Returns

Ant colony optimization approach to portfolio optimization

State Switching in US Equity Index Returns based on SETAR Model with Kalman Filter Tracking

Data based stock portfolio construction using Computational Intelligence

APPLICATION OF ARTIFICIAL NEURAL NETWORK SUPPORTING THE PROCESS OF PORTFOLIO MANAGEMENT IN TERMS OF TIME INVESTMENT ON THE WARSAW STOCK EXCHANGE

Application of Deep Learning to Algorithmic Trading

Designing a Hybrid AI System as a Forex Trading Decision Support Tool

A Comparison of Jordanian Bankruptcy Models: Multilayer Perceptron Neural Network and Discriminant Analysis

Pattern Recognition by Neural Network Ensemble

Modeling customer revolving credit scoring using logistic regression, survival analysis and neural networks

COST MANAGEMENT IN CONSTRUCTION PROJECTS WITH THE APPROACH OF COST-TIME BALANCING

Detecting Earnings Management via Statistical and Neural Network Techniques

Neuro Fuzzy based Stock Market Prediction System

Modeling and Forecasting TEDPIX using Intraday Data in the Tehran Securities Exchange

Application of Bayesian Network to stock price prediction

PARAMETRIC AND NON-PARAMETRIC BOOTSTRAP: A SIMULATION STUDY FOR A LINEAR REGRESSION WITH RESIDUALS FROM A MIXTURE OF LAPLACE DISTRIBUTIONS

Solving dynamic portfolio choice problems by recursing on optimized portfolio weights or on the value function?

Transcription:

Iran s Stock Market Prediction By Neural Networks and GA Mahmood Khatibi MS. in Control Engineering mahmood.khatibi@gmail.com Habib Rajabi Mashhadi Associate Professor h_mashhadi@ferdowsi.um.ac.ir Electrical Eng. Dep. / Faculty of Eng. / Ferdowsi University of Mashhad Abstract: Stock market prediction is one of the areas that had been very interesting for investors, economists and managers. For this purpose, classical and modern methods such as AR and ARIMA models, Neural Networks, GA, Fuzzy Logic, etc, have been proposed but among them NNs play an essential role. In this paper, the ability of three different neural networks, namely MLP, RBF and GRNN, are compared for stock market prediction. Unknown parameters of each network are optimized for minimum error by GA in training phase. Then trained networks are used for prediction of two and three monthly returns. In addition, for the first time in the literatures, the optimum order for each model, i.e. the number of input variables for each NN model is determined using trial and error. Keywords: GA, Prediction, Neural Networks, Returns, Stock Market. 1 Introduction Financial or stock market prediction is one of the areas that had been very interesting for investors, economists and managers. The primary focus is to determine the market timing to buy, hold or sell. Unfortunately, stock market prediction is not an easy task, due to the fact that stock market is essentially nonlinear, dynamic, nonparametric, complicated, and chaotic in the nature. The difficulty of the task has raised questions on whether the stock market price can be predicted. Efficient Market Hypothesis (EMH) or Random- Walk Hypothesis [1], states that market price is unpredictable. It is claimed that future changes in stock market prices cannot be predicted from information of the past prices. Viewing from the other hand, financial time series are shown to exhibit nonrandom behavior. The financial market is not always efficient and this suggests that, there is some predictability in financial time series, at least for weak form of EMH. For this purpose several tools have been used such as AR 1 and ARIMA models which are based on Regression and Least Mean Square Error []. These methods are regarded as classical methods. However there are modern methods which use Artificial Intelligence methods such as Neural Networks, GA, Fuzzy Logic and etc, among them NNs play an essential role. Among all NNs, Perceptrons are used widely for prediction [3] but training of them is time consuming and often has difficulty of local minimums [4], so the use of other NNs such as RBF networks would be noticeable. One of the most valuable stock s data is its return. Return for a stock in period T is defined as follow: pl1 pl + divl ri = (1) pl where: p L is price of the stock in the beginning of period T, p L1 is price of the stock in the end of period T and div L is divided earning per share over the period T. In this paper we want to predict stock return of a company in Iran s stock market. For this purpose we chose Iran Khodro Co. since it is a great and 1. Auto Regressive. Auto Regressive Integrated Moving Average

old company which its data are available for a long period. Then three neural networks type, namely MLP, RBF and GRNN, are trained with all monthly return data of a period except two or three months of its end. Unknown parameters of each network are optimized for minimum error by GA in training phase. Finally these trained optimized networks are tested for prediction of two or three monthly returns which didn t present on the training set. This paper is organized as follow: section is brief review of the literature, section 3 is problem statement, section 4 describes MLP neural network and its results when applied to the problem, section 5 describes RBF neural network and its results when applied to the problem and finally section 6 describes GRNN neural network and its results when applied to the problem. Literature Review We can categorize almost all papers about stock market prediction in three main groups: 1. Papers that are trying to predict an index of a stock, based on previous values of it. The index usually is stock s price or stock s return. In this kind of analysis authors try to find a function like F so that: ~ r[ n] = F( r[ n 1]), r[ n ], K, r[ n p]) () ε ~ n = r[ n] r[ n] (3) where r [n] denotes the value of index in time n, ε n is the error of prediction and p is order of the model. A good function must lead to a less value of variance for ε n. For this purpose several methods have been used such as AR model, ARIMA model [5-6], NN models [-3], etc.. Another group of papers are trying to classify stocks, e.g. proper for purchase or no proper [7-8]. These two kinds of analysis also are called Technical analysis [9]. 3. Another group of papers are trying to find a relationship between the value of an index and financial ratios, exchange rate, oil price, etc [4]. This kind of analysis also is called Fundamental analysis [9]. In Iran s Stock market case, several researches have been done. In [1], authors employed a neuro-fuzzy approach to forecast stock price and compared their results with ARIMA model. Their research shows that neuro-fuzzy works better than ARIMA model and has such properties as fast convergence, high precision and strong function approximation ability and it is suitable for real stock price forecasting. In [11] authors have examined efficiency of Iran stock market by using AR and Perceptron models. Their research shows AR model can t predict Iran s stock market accurately and so it is efficient but by using Perceptron model, a good function can be fitted to the data history and so it is inefficient. Other researches show Iran s stock market has weak efficiency. 3 Problem Statement 1 1 8 6 4 - -4-6 4 6 8 1 1 14 Figure 1: Stock Return of Iran Khodro Co. (1995-5) Fig. 1 shows the diagram of monthly stock return of Iran Khodro Co. through 1 years (1995-5). This is the question: "How accurate stock s returns of the L months (N, N-1,..., N-L+1) can be predicted when we know stock s returns of previous months?". This question yields to finding function F in () by our data of previous months and analyzing its error for predicted returns in the duration of L months: (N, N-1,..., N-L+1). In this paper, function F is estimated for different p by three Neural Network types: Perceptron, RBF and GRNN. Each network is trained by data of previous months and then its error for predicted returns in the duration of L months is analyzed. Error in duration L months is defined as: L ε F ( N + i L) i= 1 ErF ( L) = L (4) Optimum parameters for three NNs, are obtained by GA in the training phase. The problem is studied for L=3 and L=. For each L, two different situations are tested and the optimum

model s order for prediction is determined using trial and error. So there are four cases: Case1: In this case L=3 and three last monthly returns are: -1, 14.83 and 17.66. Case: In this case L=3 and three last monthly returns are : 4.1, -3.6,.75. Case3: In this case L= and three last monthly returns are : 14.83, 17.66. Case4: In this case L= and three last monthly returns are : -3.6,.75. First of all, for neglecting spouts, every return more than is assumed and every return less than -1 is assumed -1. Then the data are normalized in the range -1 to 1. 4 Perceptron case and its results In this section, we give a brief presentation of multi-layer Perceptron, which is the most popular and widely-used network paradigm in many applications including forecasting. An MLP is typically composed of several layers of nodes. The first or the lowest layer is an input layer where external information is received. The last or the highest layer is an output layer where the problem solution is obtained. The input and output layers are separated by one or more intermediate layers called hidden layers. The nodes in adjacent layers are usually fully connected from a lower layer to a higher layer. Fig. gives an example of a fully connected MLP with one hidden layer. of wij s and b j s. Usually BP 3 algorithm or a modified version of it, is used for determination of weights and biases. Although the algorithm is fast.6.5.4.1.4 5 5.1.5 a) case 1.5.45.4 5 5 b) case.1.5 c) case 3.5.45 Figure : An MLP with one hidden layer Input layer is only a fan-out layer and does not any processing. Output of every neuron in hidden and output layer is obtained by (5): y j = f ( wij. xij + b j) (5) i where x ij is i-th input of j-th neuron and w ij is its associated weight and b j is the bias of j-th neuron. Training process includes determination.4 5 5.1.5 d) case 4 Figure 3: MLP Results 3. Back Propagation

but often falls in a local minimum. So using GA for determining weights is notice of worth. In this work a Perceptron with one hidden layer is used and weights and biases are determined for minimum error by GA. The number of cells in the hidden layer is determined so that the number of training patterns is ten times greater than the number of weights. Moreover some good members which are obtained by BP are posed in initial population. Fig.3 shows the results of the MLP for the 4 cases: It is seen a Perceptron with "p"= has good performance in the four cases. In the case 1 (when the 3 last monthly returns are -1, 14.83, 17.66), the network has average error equal to 6.9. In the case (when 3 last monthly returns are 4.1, - 3.6,.75), it has average error equal to 1.5. In the case 3 (when the last monthly returns are 14.83, 17.66), the network has average error equal to 1.95 and finally in case 4 (when last monthly returns are -3.6,.75) it has average error equal to 1.35. 5 RBF case and its results RBF is a three layer NN [5]. Input layer is only a fan-out layer and does not any processing. Second layer or hidden layer do a nonlinear mapping from input space to often a higher dimension space and output layer do a simple weighted summation and then transfer result from a linear function. For classification a hard limiting function is required in output. The centers.5.45.4 5 5 x i are training data or centers of.5.45.4 5 5.1.5 a) case 1.5.45.4 5 5 b) case c) case 3.5.45.4 Figure 4: RBF Structure for the problem The main difference between RBF and Perceptron is in hidden layer processing. The idea in RBF is that every neuron on hidden layer is a Gaussian function with a center and a variance: N x j xi yi = exp( ) (6) σ j = 1 i 5 5.1.5 d) case 4 Figure 5: RBF Results them and so there is not special training process. Variance σ i can be obtained by several methods. One suggestion is (7):

P 1 i = ( d ik ) P k = 1 σ (7) where d ik is distance between xk and x i. The output layer is just as output layer of Perceptrons. An RBF structure like Fig.4 is used to predict stock return. In this Fig. "p" is the order of model. For different "p", the corresponding network is trained for n=p+1,..., N-L where N is the number of all members of training set and L is the length of the prediction period. For this purpose the first-layer weights is set to P where P is input vector of training set and the first-layer biases are all set to.836 σ, resulting in Gaussian functions that cross.5 at weighted inputs of ± σ. The second-layer weights IW{,1} and biases b{} are found by simulating the first-layer outputs A{1} and then solving the following linear expression: [ W,1} b{} ]*[ A{1}; ones] = T { (8) T is the output vector of training set. For easiness, it is presumed a constant σ for all Gaussian functions and it is optimized by GA for minimum error for every "p". Assuming a constantσ, improve the speed of optimization significantly while don t has significant effect on results as will seen. Also it is very useful to impose constriction σ > 1 to the problem for avoiding overtraining. The optimized network is tested for L month of the end that didn t present in training set. Fig.6 shows the results of the RBF for the 4 cases: It is seen an RBF with "p"=56 has good performance in the four cases. In case 1 (when the 3 last monthly returns are -1, 14.83, 17.66), the network has average error equal to 5.4. In case (when 3 last monthly returns are 4.1, -3.6,.75), it has average error equal to 1.5. In case 3 (when the last monthly returns are 14.83, 17.66), the network has average error equal to 5.4 and finally in case 4 (when last monthly returns are - 3.6,.75) it has average error equal to.9. These results are comparable with MLP results when we remember training of RBF is less time consuming than MLP training. 6 GRNN case and its Results A GRNN network is very similar to RBF NN. The difference is in the output layer. The weights of output layer are corresponding outputs divided to a coefficient. Mathematically: y i = N j = 1 N 55 5 45 4 35 3 5.15.1.95.9.85.8 j = 1 a) case 1.75 1 5 95 9 85 8 75 GRNN Performance for Prediction set b) case 7 5.145.14.135.13.15.1.115 c) case 3.11 d) case 4 Figure 6: GRNN Results ( xi x j ) y j exp( ) σ ( xi x j ) exp( ) σ j j (9)

55.5 GRN RB.45 5 ion set ion set 45.4 35 4 A GRNN structure is used to predict stock return. For different "p" the corresponding Network is trained for n=p+1,..., N-L where N is the number of all members of training set and L is the length of prediction. For this purpose the first-layer weights are set to P T where P is input vector of training set and the first-layer biases are all set to.836 σ, resulting in Gaussian functions that cross.5 at weighted inputs of ± σ. The secondlayer weights are set to T where T is output vector of training set. Again for easiness and speed, it is presumed a constant σ for all Gaussian functions and it is optimized by GA for minimum error for each "p". Also for avoiding overtraining it is very useful to impose constriction σ > 1 to the problem. The optimized network is tested for L month of the end that didn t present in training set. Fig. 7 shows the results of the GRNN for the 4 cases: It is seen a GRNN with "p"=49 has good performance in the four cases. In case 1 (when the 3 last monthly returns are -1, 14.83, 17.66), the network has average error equal to 6.9. In case (when 3 last monthly returns are 4.1, -3.6,.75), it has average error equal to.4. In case 3 (when the last monthly returns are 14.83, 17.66), the network has average error equal to 8.3 and finally in case 4 (when last monthly returns are - 3.6,.75) it has average error equal to 3.6. It is obvious that these results are not comparable with MLP and RBF results. Table 1 summarizes the results: Table 1: Summarized Results NN Best Deg Case1 Case Case3 Case4 MLP 6.9 1.5 1.95 1.35 RBF 56 5.4 1.5 5.4.9 GRNN 49 6.9.4 8.3 3.6 Conclusion In this paper, stock market return of Iran Khodro Co. has been predicted. For this purpose, monthly returns of 1 years are collected as training set. Then three neural networks namely MLP, RBF and GRNN are compared for stock market prediction. The parameters of each network have been optimized in order to minimize the prediction error using GA. Then trained networks have been used for prediction of two and three monthly returns which didn t present on the training set. Furthermore the optimum order for each model, has been determined. Results show combination of RBF or MLP neural networks with GA, can predict the complex time series in a sufficient manner. References [1] Hellström, T., Holmström, K. Predicting the stock market. Technical Report Ima-TOM- 1997-7, Center of Mathematical Modeling, Department of Mathematics and Physics, Mälardalen University,Västeras, Sweden. [] Guoqiang Zhang, B. Eddy Patuwo, Michael Y. Hu, Forecasting with artificial neural networks:the state of the art, International Journal of Forecasting,vol.14, pp. 35 6, 1998. [3] A. Vellidoa, P.J.G. Lisboaa, J. Vaughanb, Neural networks in business: a survey of applications (199 1998), Expert Systems with Applications, Vol. 17, pp. 51 7, 1999. [4] Dennis Olson, Charles Mossman, Neural network forecasts of Canadian stock returns using accounting ratios, International Journal of Forecasting, Vol. 19, pp. 453 465, 3. [5] Pai, P.F., Lin, C.S., A hybrid ARIMA and support vector machines model in stock price forecasting, Omega, Vol. 33, 5, P.P. 497 55. [6] Wang,J.-H.&Leu,J.-Y.(1996). Stock market Trend Prediction using ARIMA based neural networks. IEEE international Conference on Neural networks, 16-165. [7] Leung,M.T., Daouk, H.,& Chen,A.- S.(1).Forecasting stock indices: A comparison of classification and level estimation models. International Journal of Forecasting, 16,173-19. [8] Swales, G.S.Jr., Yoon, Y., Applying Artificial Neural Networks to Investment Analysis, Financial Analysts Journal, September- October, 199, pp. 78-8. [9] Mohammed Omran, Linear Versus Non-linear relationships Between Financial Ratios and Stock Returns: Empirical Evidence from Egyptian Firms, Review of Accounting and Finance, Vol. 3, No, pp. 84-1, 4. [1] A.Afsar, A.Azar, Strengthening Neural networks for prediction stock market prices by fuzzy logic systems (In Persian). [11] Patterning process of price's behavior in Tehran stock market, comparing nonlinear and linear models, Oct. 1998, (In Persian).