Time Series Analysis With R
Time Series Analysis With R
6, July-August 2015
International Journal of Advanced Research in Computer Science
RESEARCH PAPER
Available Online at www.ijarcs.info
Time Series Data Analysis for Stock Market Prediction using Data Mining Techniques with R
Mahantesh C. Angadi Amogh P. Kulkarni
M.Tech Student, Dept. of ISE, Assistant Professor, Dept. of ISE,
Acharya Institute of Technology, Sai Vidya Institute of Technology,
Bengaluru, Karnataka, India. Bengaluru, Karnataka, India.
Abstract: Nowadays, the stock market is attracting more and more people's notice with its high challenging risks and high return over. A stock
exchange market depicts savings and investments that are advantageous to increase the effectiveness of the national economy. The future stock
returns have some predictive relationships with the publicly available information of present and historical stock market indices. ARIMA is a
statistical model which is known to be efficient for time series forecasting especially for short-term prediction. In this paper, we propose a model
for forecasting the stock market trends based on the technical analysis using historical stock market data and ARIMA model. This model will
automate the process of direction of future stock price indices and provides assistance for financial specialists to choose the better timing for
purchasing and/or selling of stocks. The results are shown in terms of visualizations using R programming language. The obtained results reveal
that the ARIMA model has a strong potential for short-term prediction of stock market trends.
Keywords: Time Series Data, Stock Market, Prediction, Analysis, Data Mining, ARIMA, R.
by number of researchers. These stock trading rules are NSE. Artificial Neural Networks (ANNs) model is very
developed based on the information related to popular due to its ability to learn patterns from data and infer
macroeconomics, ancient data of stock trading. Fundamental solution from unknown data. Hybrid approaches also engaged
analysis techniques assume that the price of a stock depends on to improve stock price predictive models by exploiting the
its intrinsic values and expected return on investment. Majority unique strength of each of them. The results obtained from real-
of the researchers believe that fundamental analysis techniques life data demonstrated the potential strength of ARIMA models
are good methods only on a long-term source. Yet, for short- to provide investors short-term prediction that could aid
term and medium-term speculations technical analysis investment decision making process.
techniques are preferred as fundamental analysis techniques are Stock exchange markets facilitate savings and investment
not appropriate. that are beneficial to increase the effectiveness of national
The most efficient way to forecast the future is to economy. The author [Li Zhe] [7] have used the method of
understand the present scenarios. The author [Banerjee D] [1] technical analysis in which trading rules were established based
tried to develop an appropriate model that helps to forecast the on the ancient data of stock trading price and volume.
unseen values of the Indian stock market, based on the Technical analysis uses various methods that aim to predict
information collected on the monthly closing stock indices. future stock price movements based on the assumption that
Based on the ARIMA model they predict the future stock history repeats itself and future market directions can be
indices which have the strong performance of the Indian determined by examining historical stock prices.
economy. It is very important to understand the present status
III. SYSTEM ANALYSIS
of the market because for many economists, investors and
researchers the Indian stock market is the center of interest. It A. Problem Statement
has been predicted that the performance of the Indian stock
A stock exchange market depicts savings and investments
market presents a suitable time series ARIMA(1,0,1) model
that are advantageous to increase the effectiveness of national
which helps to create the appropriate values of the future
economic. The future stock returns have some predictive
indices.
relationships with the publicly available information of present
The authors [Li Bing] [Chan] [2] have extracted the
and historical stock market indices. The investors decide the
ambiguous text through MLP techniques to get the real stock
better time to sell/buy/hold a share in stock market based on the
price movements and public sentiments. It has been said that
former relationship. Every investor is interested in predicting
public emotions may be co-related that has shown through
the future stock prices, whether the investor may be a long-term
Twitter. The authors have used data mining algorithms to mine
investor or a day-trader. This possesses a major challenge to
Twitter data in order to forecast the stock trends using
design and develop an effective and efficient predictive model
sentimental analysis which comes under fundamental analysis.
that assists the investors to take appropriate decisions.
The estimation of the latest social media analysis works on up-
to date public views mining. Through this methodology for B. Existing Systems
social media data mining, it has fulfilled the recognized One of the significant financial subject that has engrossed
research problems with adequate experimental results. The the researcher’s attention for many years is forecasting the
algorithm has defined the complete relationships surrounded in stock returns. Investors in the stock market have been
social media as a graph with several layers. The top layered attempting to discover an answer to estimate the stock trends in
attributes and intermediate layered attributes have direct order to decide the better timing to buy or sell or hold a share.
relations; and bottom layered attributes and intermediate Forecasting the stock trends have been done both on qualitative
layered attribute have in-direct relations. analysis and quantitative analysis. There are many statistical
To forecast stock price trend the authors [Tao Xing] [Yuan models available for forecasting stock trends and choosing an
Sun] [3] have introduced a method based on Hidden Markov appropriate model for a particular forecasting application
Model. Hidden Markov Model first proposed by Baum and depends on the format of the data.
Egon, which is a kind of Markov Chain and is used for the
pattern recognition technique. This paper finds the hidden C. Proposed Study
relationship existing between the Hidden Markov Model and In this work we propose a prediction model for the time
stock prices. The experimental results show that, this method series stock market data. This model will automate the process
can get attractive accurate result, particularly efficient in short of change of stock price indices based on technical analysis and
period prediction. provides assistance for financial specialists to choose the better
It is tedious task for the stock market financial specialists to timing for purchasing and selling stocks. Data mining
guesstimate the pattern of the stock exchange costs as techniques are used to develop the prediction model and R
effectively as could be allowed to settle on the best exchanging programming language is used for visualization of results.
choices. The authors [Vishwanath R Ha] [Leena Sa] [4] have
proposed a system called APST, which performs the pre- IV. IMPLEMENTATION
processing of verifiable stock time arrangement information to Data mining can be interpreted as a knowledge discovery
produce the grouping of approximated values by utilizing
process. Data mining techniques are devised to address the
multi-scale segment mean methodology. To locate the closest
problems by providing a reliable model with data mining
neighbor objects they utilize the Euclidian separation way to
recognize the comparative arrangement of articles. The features. To construct a model that investigates the stock
experimental results of this system show that the executed patterns by utilizing the past stock exchange trends; we use the
framework has shown 74% of the exactness. auto-regressive integrated moving average (ARIMA) model.
The complete architecture of the system is shown below.
Fig. 5.1 Chart series graph for INFY data - 2007 to 2015
REFERENCES
[1] Banerjee, D., "Forecasting of Indian stock market using time-
series ARIMA model", 2nd IEEE International Conference on
Business and Information Management (ICBIM), January 2014,
pp. 131-135.
[2] Li Bing, Chan, K. C. C., C. Ou, "Public sentiment analysis in
Twitter data for prediction of a company's stock price
movements", 11th IEEE International Conference on e-Business
Engineering (ICEBE), November 2014, pp. 232-239.
[3] Tao Xing, Yuan Sun, Qian Wang, Guo Yu, “The analysis and
prediction of stock prices”, IEEE International Conference on
Granular Computing (GrC), December 2013, pp. 368–373.
Fig. 5.3 Re-chart graph for INFY Data - First 16 Weeks of 2007 [4] Vishwanath R. Ha, Leena Sa, Srikantaiah K. Ca, K. Shreekrishna
Kumar b., P. Deepa Shenoya, Venugopal K. Ra, S. S. Iyengarc,
L. M. Patnaik, "Forecasting stock time-series using data
approximation and pattern sequence similarity", International
Journal of Information Processing (IJIP), September 2013, pp.
90-100.
[5] Ayodele A. Adebiyi, Aderemi O. Adewumi, Charles K. Ayo,
"Stock price prediction using the ARIMA model", 16th IEEE
International Conference on Computer Modelling and
Simulation (UKSim), March 2014, pp. 106 -112.
[6] Qasem A. Al-radaideh, Adel Abu Asaf, Eman Alnagi,
“Predicting stock prices using data mining techniques”, The
International Arab Conference on Information Technology 2013.
[7] Li Zhe; “Research on China's stock exchange markets: problems
Fig. 5.4 Forecasted INFY Trends – Line chart graph 2014 to 2015 and improvements”, International Conference on Education and
Management Technology, 2010. pp 465-469.
[8] Hazem M. El-Bakry, and Wael A. Awad, “Fast forecasting of
stock market prices by using new high speed time delay neural
networks”, International Journal of Computer and Information
Engineering, February 2010, pp. 138-144.
[9] Han, J., Kamber, M., Jian P., “Data mining concepts and
techniques”. San Francisco, CA: Morgan Kaufmann Publishers,
2011.
[10] Wang, Y.F., “Mining stock price using fuzzy rough set system”,
Expert Systems with Applications, 2006, pp. 13-23.
[11] Enke, D., Thawornwong, S., “The use of data mining and neural
networks for forecasting stock market returns”, Expert Systems
with Applications, 2005, pp. 927-940.
Fig. 5.5 Forecasted INFY Trends – Histogram graph 2014 to 2015 [12] A. J. Conejo, M. A. Plazas, R. Espnola and B. Molina. “Day-
ahead electricity price forecasting using the wavelet transform
VI. CONCLUSION and ARIMA models”, IEEE Transactions on Power Systems,
2005, pp. 1035–1042.
In this paper we made an attempt to develop a prediction
model for forecasting the stock market trends based on the
technical analysis using historical time series stock market data SHORT BIO DATA OF AUTHORS
and data mining techniques. The experimental results obtained Mahantesh C. Angadi: He obtained his B.E (Information
demonstrated the potential of ARIMA model to predict the
Science and Engineering) from Visvesvaraya Technological
stock price indices on short-term basis. This could guide the
investors in the stock market to make profitable investment University, Belgaum, Karnataka, India. Currently he is
decisions whether to buy/sell/hold a share. With the results pursuing final year M.Tech (Computer Networking and
obtained ARIMA model can compete reasonably well with Engineering) in Acharya Institute of Technology, Bengaluru,
emerging forecasting techniques in short-term prediction. Karnataka, India. His areas of interest include BigData
analytics using Hadoop and R, Distributed computing, Cloud
computing and Networking.
VII. FUTURE ENHANCEMENTS
Amogh P. Kulkarni: He obtained his M.Tech (Software
The implementation of this paper can be extended by Engineering) from R.V College of Engineering, Visvesvaraya
integrating the technical analysis and fundamental analysis Technological University, Belgaum, Karnataka, India.
techniques. Through the evaluation of social media analysis Currently he is working as an assistant professor in Sai Vidya
particularly on public opinions using fundamental analysis Institute of Technology, Bengaluru, Karnataka, India. His
techniques can be incorporated in order to obtain better results. areas of interest include BigData analytics, Distributed
In this way we can provide the improved results for investors in computing, Cloud computing and Networking.
the stock market to choose the better timing for profitable
investment decisions.