You are on page 1of 6

50 (IJCNS) International Journal of Computer and Network Security,

Vol. 2, No. 8, August 2010

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 - vaislaks@rediffmail.com
2
Deptt. Of Computer Science,
Birla Institute of Applied Sciences,
Bhimtal, Post- Bhimtal, Distt-Nainital (Uttarakhand), INDIA
E-mail - ashutoshbhatt123@rediffmail.com
3
Head, Department of Computer Science & Engineering,
Jaypee University of Engineering & Technology,
Raghogarh , District – Guna (MP), India,
Email - dr.shishir@yahoo.com

company's database or data warehouse is selected and


Abstract: Stock price prediction is one of the hot areas in refined to form training data sets.
neural network applications. This paper presents the Neural Artificial Neural Network are widely used in various
Networks’ ability to forecast the Stock Market Prices. Predicting branches of engineering and science and their property to
the stock market is very difficult since it depends on several approximate complex and nonlinear equations makes it a
known and unknown factors. In recent years, one of the useful tools in econometric analysis. A number of statistical
techniques that have been used popularly in this area is
model and Neural Network model have been developed for
artificial neural network. The power of neural network is its
ability to model a nonlinear process without a priori knowledge forecasting stock market.
about the nature of the process. In this paper, Neural Networks
and Statistical techniques are employed to model and forecast The study of financial data is of great importance to the
the stock market prices and then the results of these two models researchers and to business world because of the volatile
are compared. The forecasting ability of these two models is nature of the series. Statistical tools like Multiple Regression
accessed using MAPE, MSE and RMSE. The results show that
Techniques [1] and Time Series Analysis are the very well
Neural Networks, when trained with sufficient data and proper
inputs, can predict the stock market prices very well. Statistical
built methodologies used for forecasting the series, but as
technique though well built but their forecasting ability is the series become complex their forecasting ability is
reduced as the series become complex. Therefore, Neural reduced, [2]. Regression models have been traditionally used
Networks can be used as an alternative technique for forecasting to model the changes in the stock markets. Multiple
the stock market prices. regression analysis is the process of finding the least squares
Keywords: Foreign Investors Inflow (FII), Wholesale Price Index prediction equation, testing the adequacy of the model, and
(WPI), Money Supply Broad Money (MSBM), Money Supply conducting tests about estimating the values of the model
Narrow Money (MSNM), Exchange Rate (ER). parameters, [3]. However, these models can predict linear
patterns only. The stock market returns change in a
1. Introduction nonlinear pattern such that neural networks are more
Artificial neural network models are based on the neural appropriate to model these changes.
structure of the brain. The brain learns from experience and
so do artificial neural networks. Previous research has Neural Network have become popular in the world of
shown that artificial neural networks are suitable for pattern forecasting because of their non-parametric approach [4], as
recognition and pattern classification tasks due to their well as their ability to learn the behavior of the series, when
nonlinear nonparametric adaptive-learning properties. As a properly trained. Many researches [5, 6] have been made to
useful analytical tool, ANN is widely applied in analyzing compare Neural Networks with statistical tools. Neural
the business data stored in database or data warehouse Networks have been successfully applied to loan evaluation,
nowadays. Customer behavior patterns identification and signature recognitions, time series forecasting and many
stock price prediction are both hot areas of neural network other difficult pattern recognition problems [2, 4, 5, 6 and
researching and applying. One critical step in neural 7]. If stock market return fluctuations are affected by their
network application is network training. Generally, data in 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 weights. The process of adjusting the weights to make the
learned better using networks which employ a feedback Neural Network learn the relationship between the inputs
mechanism to cause sequence learning. and the targets is known as learning or training. There are
several methods of finding the weights of which the gradient
2. Literature Review descent method is most common.
In general, the approaches to predict stock market could be
classified into two classes, fundamental analysis and
technical analysis. Fundamental analysis is based on
5. Statistical Technique
macroeconomic data and the basic financial status of
companies like money supply, interest rate, inflationary Multiple Regression Analysis is a Multivariate Statistical
rates, dividend yields, earnings yield, cash flow yield, book technique used to examine the relationship between a single
to market ratio, price-earnings ratio, lagged returns[8,9]. dependent variable and a set of independent variables. The
Technical analysis is based on the rationale that history will objective of the multiple regression analysis is to use
repeat itself and that and the correlation between price and independent variables whose values are known to predict the
volume reveals market behavior. Prediction is made by single dependent variable.
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 6. Data and Methodology
markets has been an active research area in both methods,
6.1 Data Set Used
since the late 1980's [11, 12, 13, 14, 15]. Most of these
published works are targeted at US stock markets and other The data is obtained from the RBI site (www.rbi.org.in),
international financial markets. In this article our Prediction NSE site [17], SEBI site (www.sebi.gov.in). The NIFTY
is made by exploiting implications hidden in past trading data (closing Nifty Index), Industrial Production, Wholesale
activities and by analyzing patterns and trends shown in Price Index, Exchange Rate, Net Investment by FIIs, Export,
monthly stock price and Industrial Production, Wholesale Import, Money Supply Narrow Money, Money Supply Broad
Price Index, Exchange Rate, Net Investment by FIIs, Export, Money is from April, 1994 to March , 2007. All above data
Import, Money Supply Narrow Money, and Money Supply taken on monthly basis. The stock market can display
Broad Money. 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
Training a Neural Network model for predicting monthly stock return of NIFTY. The
To experiment with neural networks, we used NeuralWare, data for the study comprises the monthly stock returns of
NeuralWorks Predict, [16] which provides the tools to NIFTY, monthly Industrial Production, monthly Wholesale
implement and test various configurations of neural Price Index, monthly Exchange Rate, monthly Net
networks and learning algorithms. Investment by FIIs, monthly Export & Import, monthly
Money Supply from April, 1994 to March , 2007 creating a
3. Objective of Study series of 156 observations which were collected from the
The objective of this study is to model the Stock Prices data Reserve Bank of India website (www.rbi.org.in) , NSE
using the Statistical Technique and the Neural Networks, site(www.nseindia.com), SEBI site(www.sebi.gov.in).
and then to compare the results of these two techniques.
To build the Neural Network forecasting models monthly
data (156 observations) is used to for the measurement of
4. Neural Networks
forecasting accuracy. An important first step in the analysis
Artificial Neural Network is an artificial representation of of the data is to determine if the series is stationary, as all
the human brain that tries to simulate its learning process. other calculations of invariants presume stationarity in both
To train a network and measure how well it performs, an linear and nonlinear. A time series is said to be stationary if
objective function must be defined. A commonly used there is no systematic change in mean (no trend), in
performance criterion function is the sum of squares error variance, and, if so, periodic variations have to be removed.
function. To detect nonstationarity, the study uses a stationary test,
2

∑ ∑ (t )
1 p N called the unit root test (Augmented Dickey Fuller Test and
E = p i − yp i (1) Philip Perron Test). The null hypothesis tested here is “the
2 p =1 i =1
series is non-stationary”. If the absolute value of the statistic
Where, p represents the patterns in the training set, yp is the is greater than the critical Value, then the null hypothesis is
output vector (based on the hidden layer output), tp is the rejected and hence the series is stationary.
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
52 (IJCNS) International Journal of Computer and Network Security,
Vol. 2, No. 8, August 2010

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

Figure 2. .Monthly Closing alternate series Figure 10. Export alternate series

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

Figure 4. .Monthly Industrial Production alternate series Figure 12. Import alternate series

Figure 5. .Monthly Wholesale Price Index for period April Figure13. .Monthly Money Supply Narrow Money for
1994 to March 2007 period April 1994 to March 2007

Figure 6.Wholesale Price Index alternate series Figure 14. Money Supply Narrow Money alternate series

Figure 15. .Monthly Money Supply Broad Money for period


Figure 7. .Monthly Exchange Rate for period April 1994 to
April 1994 to March 2007
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
Dependent Variable: Closing Nifty
It is difficult to design a Neural Network Model for a
Method: Least Squares
particular forecasting problem. Modeling issues must be
Sample (adjusted): 3 156
considered carefully because it affects the performance of an
Included observations: 154 after adjusting endpoints
ANN. One critical factor is to determine the appropriate
architecture, that is, the number of layers, number of nodes
Variable Coefficient Std. Error t-Statistic Prob.
in each layer. Other network design decisions include the
C 0.010347 0.006730 1.537532 0.1263
selection of activation functions of the hidden and output
nodes, the training algorithm, and performance measures. Exchange Rate(-1) -0.426087 0.364542 -1.168830 0.2444

The design stage involves in this study to determine the Export(-1) -0.042306 0.064830 -0.652570 0.5151
input nodes and output nodes, selecting the performance Foreign Investors Inflow(- 6.25E-06 2.06E-06 3.039389 0.0028
metrics etc. 1)
The number of input nodes corresponds to the number of Import(-1) -0.044457 0.061156 -0.726940 0.4684
variables in the input vector used to forecast future values. Industrial Production(-1) 0.269663 0.154961 1.740202 0.0839
However currently there is no suggested systematic way to Money Supply broad 0.119117 0.286181 0.416230 0.6779
determine this number. Too few or too many input nodes money(-1)
can affect either the learning or prediction capability of the Money Supply narrow -0.017499 0.333083 -0.052538 0.9582
network. For this study the output is the forecasted monthly money(-1)
stock return.Monthly Closing NIFTY is taken as dependent Wholesale Price Index(-1) -0.833971 0.963889 -0.865215 0.3884
variable(Output) and Industrial Production, Wholesale Price R-squared 0.121900 F-statistic 2.516168
Index, Exchange Rate, Net Investment by FIIs, Export,
Adjusted R-squared 0.073454 Prob (F-statistic) 0.013663
Import, Money Supply Narrow Money, Money Supply Broad
Money are taken as independent variable (Inputs).

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 %
Figure 17. Neural Network Model. Obs. Error
MAPE MAE MSE RMSE

Hear Noisy Data has been taken for Neural Network Regression 156 0.017077 0.000552 0.023492
forecasting and Data Transformation level is moderate. The
variable selection for the network is comprehensive. Comparison of the Models:-
Adaptive Gradient Learning Rule is applied hear, the output The Stock Market Monthly closing values were forecasted
Layer Function is taken Sigmoid for the forecasting. using Neural Networks and Regression technique. The
comparison between the two models is done on the basis of
Table 1 : Using Neural Network the MAPE, MSE and RMSE values obtained for the
No of MAE MSE RMSE forecasted values of the two models. An accuracy measure is
Obs. often defined in terms of the forecasting error, which is the
Neural 156 0.05007 0.00419 0.06475 difference between the actual (desired) and predicted value.
Network The ultimate and the most important measure of
performance is the prediction accuracy.
Modelling & Forecasting using Multiple Regression The following table gives the table of comparison:-
Technique:-
Closing nifty is taken as dependent variable and Industrial Table 3: Comparison of Models
Production, Wholesale Price Index, Exchange Rate, Net No of Obs. MAE MSE RMSE
Investment by FIIs, Export, Import, Money Supply were Regression 156 0.066 0.007 0.082
taken as independent variables. The variables (closing nifty, Neural 156 0.05007 0.00419 0.06475
Industrial Production, Wholesale Price Index, Exchange Network
Rate, Export, Import, Money Supply) were transformed
using natural log to achieve normality and linearity.
54 (IJCNS) International Journal of Computer and Network Security,
Vol. 2, No. 8, August 2010

Where formulae for the statistics are: clearly depicts the fact that Neural Networks outperform
MAE = abs (Actual –Forecast)/n. Statistical technique in forecasting stock market prices.
MSE = 1/n * [Actual –Forecast] 2. The effectiveness of neural network can be measured using
RMSE = SQRT (MSE). the hit rate, which may be a better standard for determining
From the above Table, Neural Networks performs well than the quality of forecast instead of the traditional measures
compared to Statistical forecasting of monthly closing Nifty like RMSE, SSE, and MAE. The field of neural networks is
values. very diverse and opportunities for future research exist in
The following figures shows the MAE, MSE and RMSE many aspects, including data preprocessing and
calculated for the forecast period using the above two representation, architecture selection, and application. The
forecasting techniques 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
[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
Figure 18. MAE of Neural Network and Statistical Method 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
Figure 19. MSE of Neural Network and Statistical Method and Statistics,” Ninth Edition, International Thomson
Publishing, 1994.
[8] National Stock Exchange (NSE), Available: www.nse-
india.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
Figure 20. RMSE of Neural Network and Statistical Method forecasting experts: an empirical test,” Proceedings of
the 1990 International Joint Conference on Neural
The experiments illustrate a varying degree of predictability Networks, Vol-I, pp. 491-494, Washington DC, USA.
of the monthly stock returns. For Example based on the 1990.
values of RMS, MAE, RMSE and other statistics. The above [12] Smirlock Michael and Starks, T. Laura, “A Further
comparision of Neural Network and Statistical model clearly Examination of Stock Price Changes and Transactions
shows that the Neural Networks prediction is better than the Volume,” Journal of Financial Research 8, pp. 217-
Statistical technique. 225. 1985.
[13] G.S. SWALES, and Y.YOON, “Applying artificial
neural networks to investment analysis,” Financial
8. Conclusion
Analysts Journal, 48(5). 1997.
In this paper, two techniques for modeling and forecasting [14] Tang, Almeida and Fishwick, Simulation, “Time series
stock market prices have been shown: Neural Network and forecasting using neural networks vs. Box-Jenkins
Statistical Technique. The forecasting ability of models is methodology,” pp. 303-310. November 1991.
accessed on the basis of MSE, MAE and RMSE. This [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.

You might also like