Stock Market Forecasting using Artificial Neural ...

25 downloads 6790 Views 541KB Size Report
Email - [email protected]. 2Deptt. ... the business data stored in database or data warehouse ..... modeling techniques for database marketing in the.
(IJCNS) International Journal of Computer and Network Security, Vol. 2, No. 8, August 2010

50

Stock Market Forecasting using Artificial Neural Network and Statistical Technique: A Comparison Report K S Vaisla1 and Dr. Ashutosh Kumar Bhatt2, Dr. Shishir Kumar3 1

Deptt. of Computer Science & Engineering, VCT Kumaun Engineering College, Dwarahat, District –Almora (Uttarakhand), INDIA, Email - [email protected] 2

Deptt. Of Computer Science, Birla Institute of Applied Sciences, Bhimtal, Post- Bhimtal, Distt-Nainital (Uttarakhand), INDIA E-mail - [email protected] 3

Head, Department of Computer Science & Engineering, Jaypee University of Engineering & Technology, Raghogarh , District – Guna (MP), India, Email - [email protected]

Abstract: Stock price prediction is one of the hot areas in neural network applications. This paper presents the Neural Networks’ ability to forecast the Stock Market Prices. Predicting the stock market is very difficult since it depends on several known and unknown factors. In recent years, one of the techniques that have been used popularly in this area is artificial neural network. The power of neural network is its ability to model a nonlinear process without a priori knowledge about the nature of the process. In this paper, Neural Networks and Statistical techniques are employed to model and forecast the stock market prices and then the results of these two models are compared. The forecasting ability of these two models is accessed using MAPE, MSE and RMSE. The results show that Neural Networks, when trained with sufficient data and proper inputs, can predict the stock market prices very well. Statistical technique though well built but their forecasting ability is reduced as the series become complex. Therefore, Neural Networks can be used as an alternative technique for forecasting the stock market prices.

Keywords: Foreign Investors Inflow (FII), Wholesale Price Index (WPI), Money Supply Broad Money (MSBM), Money Supply Narrow Money (MSNM), Exchange Rate (ER).

1. Introduction Artificial neural network models are based on the neural structure of the brain. The brain learns from experience and so do artificial neural networks. Previous research has shown that artificial neural networks are suitable for pattern recognition and pattern classification tasks due to their nonlinear nonparametric adaptive-learning properties. As a useful analytical tool, ANN is widely applied in analyzing the business data stored in database or data warehouse nowadays. Customer behavior patterns identification and stock price prediction are both hot areas of neural network researching and applying. One critical step in neural network application is network training. Generally, data in

company's database or data warehouse is selected and refined to form training data sets. Artificial Neural Network are widely used in various branches of engineering and science and their property to approximate complex and nonlinear equations makes it a useful tools in econometric analysis. A number of statistical model and Neural Network model have been developed for forecasting stock market. The study of financial data is of great importance to the researchers and to business world because of the volatile nature of the series. Statistical tools like Multiple Regression Techniques [1] and Time Series Analysis are the very well built methodologies used for forecasting the series, but as the series become complex their forecasting ability is reduced, [2]. Regression models have been traditionally used to model the changes in the stock markets. Multiple regression analysis is the process of finding the least squares prediction equation, testing the adequacy of the model, and conducting tests about estimating the values of the model parameters, [3]. However, these models can predict linear patterns only. The stock market returns change in a nonlinear pattern such that neural networks are more appropriate to model these changes. Neural Network have become popular in the world of forecasting because of their non-parametric approach [4], as well as their ability to learn the behavior of the series, when properly trained. Many researches [5, 6] have been made to compare Neural Networks with statistical tools. Neural Networks have been successfully applied to loan evaluation, signature recognitions, time series forecasting and many other difficult pattern recognition problems [2, 4, 5, 6 and 7]. If stock market return fluctuations are affected by their recent historic behavior, neural networks which can model such temporal stock market changes can prove to be better

(IJCNS) International Journal of Computer and Network Security, 51 Vol. 2, No. 8, August 2010

predictors, the changes in a stock market can then be learned better using networks which employ a feedback mechanism to cause sequence learning.

2. Literature Review In general, the approaches to predict stock market could be classified into two classes, fundamental analysis and technical analysis. Fundamental analysis is based on macroeconomic data and the basic financial status of companies like money supply, interest rate, inflationary rates, dividend yields, earnings yield, cash flow yield, book to market ratio, price-earnings ratio, lagged returns[8,9]. Technical analysis is based on the rationale that history will repeat itself and that and the correlation between price and volume reveals market behavior. Prediction is made by exploiting implications hidden in past trading activities and by analyzing patterns and trends shown in price and volume charts[10]. Using neural networks to predict financial markets has been an active research area in both methods, since the late 1980's [11, 12, 13, 14, 15]. Most of these published works are targeted at US stock markets and other international financial markets. In this article our Prediction is made by exploiting implications hidden in past trading activities and by analyzing patterns and trends shown in monthly stock price and Industrial Production, Wholesale Price Index, Exchange Rate, Net Investment by FIIs, Export, Import, Money Supply Narrow Money, and Money Supply Broad Money. Training a Neural Network To experiment with neural networks, we used NeuralWare, NeuralWorks Predict, [16] which provides the tools to implement and test various configurations of neural networks and learning algorithms.

3. Objective of Study The objective of this study is to model the Stock Prices data using the Statistical Technique and the Neural Networks, and then to compare the results of these two techniques.

4. Neural Networks Artificial Neural Network is an artificial representation of the human brain that tries to simulate its learning process. To train a network and measure how well it performs, an objective function must be defined. A commonly used performance criterion function is the sum of squares error function.

1 E = 2

∑ ∑ (t p

N

p =1

i =1

2

p i

− yp i

)

(1)

Where, p represents the patterns in the training set, yp is the output vector (based on the hidden layer output), tp is the training target. The above equation represents the output nodes, tpi and ypi are, respectively, the target and actual network output for the ith output unit on the pth pattern. The network learns the problem at hand by adjusting

weights. The process of adjusting the weights to make the Neural Network learn the relationship between the inputs and the targets is known as learning or training. There are several methods of finding the weights of which the gradient descent method is most common.

5. Statistical Technique Multiple Regression Analysis is a Multivariate Statistical technique used to examine the relationship between a single dependent variable and a set of independent variables. The objective of the multiple regression analysis is to use independent variables whose values are known to predict the single dependent variable.

6. Data and Methodology 6.1 Data Set Used The data is obtained from the RBI site (www.rbi.org.in), NSE site [17], SEBI site (www.sebi.gov.in). The NIFTY data (closing Nifty Index), Industrial Production, Wholesale Price Index, Exchange Rate, Net Investment by FIIs, Export, Import, Money Supply Narrow Money, Money Supply Broad Money is from April, 1994 to March , 2007. All above data taken on monthly basis. The stock market can display varying characteristics for Industrial Production, Wholesale Price Index, Exchange Rate, Net Investment by FIIs, Export, Import, and Money Supply. So it is necessary to develop model for predicting monthly stock return of NIFTY. The data for the study comprises the monthly stock returns of NIFTY, monthly Industrial Production, monthly Wholesale Price Index, monthly Exchange Rate, monthly Net Investment by FIIs, monthly Export & Import, monthly Money Supply from April, 1994 to March , 2007 creating a series of 156 observations which were collected from the Reserve Bank of India website (www.rbi.org.in) , NSE site(www.nseindia.com), SEBI site(www.sebi.gov.in). To build the Neural Network forecasting models monthly data (156 observations) is used to for the measurement of forecasting accuracy. An important first step in the analysis of the data is to determine if the series is stationary, as all other calculations of invariants presume stationarity in both linear and nonlinear. A time series is said to be stationary if there is no systematic change in mean (no trend), in variance, and, if so, periodic variations have to be removed. To detect nonstationarity, the study uses a stationary test, called the unit root test (Augmented Dickey Fuller Test and Philip Perron Test). The null hypothesis tested here is “the series is non-stationary”. If the absolute value of the statistic is greater than the critical Value, then the null hypothesis is rejected and hence the series is stationary.

(IJCNS) International Journal of Computer and Network Security, Vol. 2, No. 8, August 2010

52

Figure 1. .Monthly stock closing for period April 1994 to March 2007

Figure 9. .Monthly Export for period April 1994 to March 2007

Figure 2. .Monthly Closing alternate series

Figure 10. Export alternate series

Figure 3. .Monthly Industrial production for period April 1994 to March 2007

Figure 11. Monthly Import for period April 1994 to March 2007

Figure 4. .Monthly Industrial Production alternate series

Figure 12. Import alternate series

Figure 5. .Monthly Wholesale Price Index for period April 1994 to March 2007

Figure13. .Monthly Money Supply Narrow Money for period April 1994 to March 2007

Figure 6.Wholesale Price Index alternate series

Figure 14. Money Supply Narrow Money alternate series

Figure 7. .Monthly Exchange Rate for period April 1994 to March 2007

Figure 15. .Monthly Money Supply Broad Money for period April 1994 to March 2007

Figure 16. .Money Supply Broad Money alternate series Figure 8. Exchange Rate alternate series

(IJCNS) International Journal of Computer and Network Security, 53 Vol. 2, No. 8, August 2010

7. Design Methodology It is difficult to design a Neural Network Model for a particular forecasting problem. Modeling issues must be considered carefully because it affects the performance of an ANN. One critical factor is to determine the appropriate architecture, that is, the number of layers, number of nodes in each layer. Other network design decisions include the selection of activation functions of the hidden and output nodes, the training algorithm, and performance measures. The design stage involves in this study to determine the input nodes and output nodes, selecting the performance metrics etc. The number of input nodes corresponds to the number of variables in the input vector used to forecast future values. However currently there is no suggested systematic way to determine this number. Too few or too many input nodes can affect either the learning or prediction capability of the network. For this study the output is the forecasted monthly stock return.Monthly Closing NIFTY is taken as dependent variable(Output) and Industrial Production, Wholesale Price Index, Exchange Rate, Net Investment by FIIs, Export, Import, Money Supply Narrow Money, Money Supply Broad Money are taken as independent variable (Inputs).

Dependent Variable: Closing Nifty Method: Least Squares Sample (adjusted): 3 156 Included observations: 154 after adjusting endpoints Variable

Coefficient

Std. Error

t-Statistic

Prob.

C

0.010347

0.006730

1.537532

0.1263

Exchange Rate(-1)

-0.426087

0.364542

-1.168830

0.2444

Export(-1)

-0.042306

0.064830

-0.652570

0.5151

Foreign Investors Inflow(- 6.25E-06 1)

2.06E-06

3.039389

0.0028

Import(-1)

-0.044457

0.061156

-0.726940

0.4684

Industrial Production(-1)

0.269663

0.154961

1.740202

0.0839

Money Supply broad money(-1)

0.119117

0.286181

0.416230

0.6779

Money Supply narrow money(-1)

-0.017499

0.333083

-0.052538

0.9582

Wholesale Price Index(-1) -0.833971

0.963889

-0.865215

0.3884

R-squared

0.121900

F-statistic

2.516168

Adjusted R-squared

0.073454

Prob (F-statistic)

0.013663

From the above observation only Foreign Investors Inflow is found significant. It means if we increase the Foreign Investors Inflow by 1% the stock return will increase by 6.25E-06. Prob (F-statistics) also not showing significant result. Hear Adjusted R-squared is 0.073454 it means we can predict only 0.07% and rest 0.93% is unpredictable. This Model is chosen for forecasting the next one year values of Nifty closing. The following table gives the forecasting results using Regression Model. Table 2: Using Regression No of Obs.

Figure 17. Neural Network Model. Hear Noisy Data has been taken for Neural Network forecasting and Data Transformation level is moderate. The variable selection for the network is comprehensive. Adaptive Gradient Learning Rule is applied hear, the output Layer Function is taken Sigmoid for the forecasting.

Neural Network

Table 1 : Using Neural Network No of MAE MSE RMSE Obs. 0.05007 0.00419 0.06475 156

Modelling & Forecasting using Multiple Regression Technique:Closing nifty is taken as dependent variable and Industrial Production, Wholesale Price Index, Exchange Rate, Net Investment by FIIs, Export, Import, Money Supply were taken as independent variables. The variables (closing nifty, Industrial Production, Wholesale Price Index, Exchange Rate, Export, Import, Money Supply) were transformed using natural log to achieve normality and linearity.

Regression

% Error

156

MAPE

MAE

MSE

RMSE

0.017077

0.000552

0.023492

Comparison of the Models:The Stock Market Monthly closing values were forecasted using Neural Networks and Regression technique. The comparison between the two models is done on the basis of the MAPE, MSE and RMSE values obtained for the forecasted values of the two models. An accuracy measure is often defined in terms of the forecasting error, which is the difference between the actual (desired) and predicted value. The ultimate and the most important measure of performance is the prediction accuracy. The following table gives the table of comparison:Table 3: Comparison of Models MAE

MSE

RMSE

Regression

No of Obs. 156

0.066

0.007

0.082

Neural

156

0.05007

0.00419

0.06475

Network

54

(IJCNS) International Journal of Computer and Network Security, Vol. 2, No. 8, August 2010

Where formulae for the statistics are: MAE = abs (Actual –Forecast)/n. MSE = 1/n * [Actual –Forecast] 2. RMSE = SQRT (MSE). From the above Table, Neural Networks performs well than compared to Statistical forecasting of monthly closing Nifty values. The following figures shows the MAE, MSE and RMSE calculated for the forecast period using the above two forecasting techniques

clearly depicts the fact that Neural Networks outperform Statistical technique in forecasting stock market prices. The effectiveness of neural network can be measured using the hit rate, which may be a better standard for determining the quality of forecast instead of the traditional measures like RMSE, SSE, and MAE. The field of neural networks is very diverse and opportunities for future research exist in many aspects, including data preprocessing and representation, architecture selection, and application. The logical next step for the research is to improve further the performance of NNs, for this application, perhaps through better training methods, better architecture selection, or better input.

References

Figure 18. MAE of Neural Network and Statistical Method

Figure 19. MSE of Neural Network and Statistical Method

Figure 20. RMSE of Neural Network and Statistical Method The experiments illustrate a varying degree of predictability of the monthly stock returns. For Example based on the values of RMS, MAE, RMSE and other statistics. The above comparision of Neural Network and Statistical model clearly shows that the Neural Networks prediction is better than the Statistical technique.

8. Conclusion In this paper, two techniques for modeling and forecasting stock market prices have been shown: Neural Network and Statistical Technique. The forecasting ability of models is accessed on the basis of MSE, MAE and RMSE. This

[1] E. M. Azoff. “Neural network time series forecasting of financial market.” JohnWiley & Sons Ltd. 1994. [2] C.M. Bishop, “Neural Networks for Pattern Recognition,” Oxford University press. 1995. [3] Fama, F. Eugene & French, R. Kenneth, “Dividend yields and expected stock returns,” Journal of Financial Economics, Elsevier, vol. 22(1), pp. 3-25. 1988. [4] Hair, Anderson, Tatham, Black, “Multivariate Data Analysis,” Pearson Education press. 1998. [5] Kalyani Dacha “Causal Modeling of Stock Market Prices using Neural Networks and Multiple Regression: A Comparison Report,” Finance India, Vol. xxi , No.3, pp. 923-930. 2007. [6] Lakonishok et al. “The Journal of Finance,” Volume 49, Issue 5, pp. 1541-1578. Dec. 1994. [7] Mendenhall and Beaver, “Introduction to Probability and Statistics,” Ninth Edition, International Thomson Publishing, 1994. [8] National Stock Exchange (NSE), Available: www.nseindia.com. [9] NeuralWare, NeuralWorks Predict, Available: http://www.neuralware.com. [10] H.P. PAN, “A joint review of technical and quantitative analysis of the financial markets towards a unified science of intelligent finance,” Proc.2003 Hawaii International Conference on Statistics and Related Fields, June 5-9, Hawaii, USA, 2003. [11] R. Sharda, and R. Patil, “Neural Networks as forecasting experts: an empirical test,” Proceedings of the 1990 International Joint Conference on Neural Networks, Vol-I, pp. 491-494, Washington DC, USA. 1990. [12] Smirlock Michael and Starks, T. Laura, “A Further Examination of Stock Price Changes and Transactions Volume,” Journal of Financial Research 8, pp. 217225. 1985. [13] G.S. SWALES, and Y.YOON, “Applying artificial neural networks to investment analysis,” Financial Analysts Journal, 48(5). 1997. [14] Tang, Almeida and Fishwick, Simulation, “Time series forecasting using neural networks vs. Box-Jenkins methodology,” pp. 303-310. November 1991. [15] P.C.Verhmf, P.N. Spnng, J.C. Hmksb, “The commercial use of segmentation and predictive

(IJCNS) International Journal of Computer and Network Security, 55 Vol. 2, No. 8, August 2010

modeling techniques for database marketing in the Netherlands,” Decision Support Systems, 34(4), pp. 471-481. 2003. [16] Wong B.K., Bodnovich T.A., Selvi, Y., “A bibliography of neural networks business application research”: 1988-September 1994”, Expert Systems, 12(3), pp. 253-262. 1995. [17] Yao J.T., Tan C.L., “Time dependent directional profit model for financial time series forecasting”. In proceeding of the IJCNN, Como, Italy, Vol. 5, pp. 291 - 296, 2000.

Authors Profile K. S. Vaisla received the Graduation in Science (B. Sc.) and Master (MCA) degrees in Computer Applications from University of Rajasthan, Jaipur in 1994 and 1998, respectively. Presently working as Associate Professor (Computer Science & Engineering) in Kumaon Engineering College (A Govt. Autonomous College), Dwarahat (Almora) – Utarakhand. Interested field of research are ICT impact on G2C of e-Governance, Data Warehouse and Mining, Complex / Compound Object Mining, IBIR. Authored many research papers in International / national journals/conferences in the field of computer science and also many books in reputed publishing house. Dr. Ashutosh Kumar Bhatt is Ph.D. in (Computer Science) from Kumaun University Nainital (Uttrakhand). He received the MCA in 2003. Presently he is working as Assistant Professor in Dept of Computer Science, at Birla Institute of Applied Sciences, Bhimtal, Nainital (Uttrakhand). His area of interest is including Artificial Neural Network, JAVA Programming, Visual Basic. He has a number of research publications in National journals, Conference Proceeding. He is running project entitled “Automated Analysis for Quality Assessment of Apples using Artificial Neural Network” under the Scheme for Young Scientists and Professional (SYSP) Govt. of India, Department of Science and Technology (DST) New Delhi for 3 year. Dr. Shishir Kumar is currently working as Head in Dept. of Computer Science & Engineering, Jaypee University of Engineering & Technology, Guna, India. He has completed his PhD in the area of Computer Science in 2005.He is having around 12 year teaching experience. His area of Interest is Image Processing & Network Security.