Stocks Prediction - abhi2705/Stock_pred GitHub Wiki

TITLE Analysis and prediction of Stocks data

PURPOSE The purpose of an analysis like this is developing a financial forecasting system which can incorporate the presently happening changes as well. Moreover it also gives a system to perform an in-depth of the stocks downloading/importing data from the various locations and analyzing that data and producing charts to determine statistical trends.

APPLICATION Financial analytics is primarily used by firms to assess the elements like profitability, solvency, liquidity, stability, etc. It also helps in predictive technology, where we can make the predictions about the future statistics of any product on the basis of the past and present statistics. It is also used greatly in stocks and trading companies.

LIBRARY

• quantmod: Specify, build, trade, and analyse quantitative financial trading strategies • limma: Data analysis, linear models and differential expression for microarray data. • multtest: Multiple testing procedures implementation • ggplot2: developing plots • tseries: Time series analysis and computational finance • xts: Extensible Time Series • nnet: Feed-forward Neural Networks and Multinomial Log-Linear Model INPUT

We in particular don’t need to provide any input unless we specifically want. There is always an option to obtain the data from the stock exchanges website or the finance website of google and yahoo. Whichever the format you choose to download, the daily stock quotes data includes information regarding the following properties: • Date of the stock exchange session. • Open price at the beginning of the session. • Highest price during the session. • Lowest price. • Closing price of the session. • Volume of transactions.

IMPLEMENTATION Stocks analysis can be implemented easily using the various packages available in R. R directly downloads the stocks data from the online resources and plots it accordingly as asked by the user. Following snippet shows the stock trends of GOOGLE over past three months.

There on we perform a time series predictive analysis of the stocks data that we have. We use the online data from yahoo finance to plot the various opening and closing prices of the stocks and then convert it to time series data so that we can proceed and perform a time series predictive analysis thereby predicting the h-days closing prices of a certain stock. The type data we have for this case study is usually known as a time series. The main distinguishing feature of this kind of data is the existence of a time tag attached to each observation, meaning that order between cases matters. In the case of our stocks data we have what is usually known as a multivariate time series, because we have several variables being recorded at the same time tags, namely the Open, High, Low, Close and Volume. The usual approach in financial time series analysis is to focus on predicting the closing prices of a stock. We create an R function to obtains the h-days returns of a vector of values, here the closing prices of a stock. To create this function we have used the function diff(). This R function calculates lagged differences of a vector. We will generate a data set using this function, which will then be used to obtain a model to predict the future h-days returns of the closing price of IBM stocks. The model used with the goal of predicting the 6-8-day ahead returns of closing prices will be a neural network. Neural networks are among the most frequently used models in financial predictions experiments because of their ability to deal with highly non-linear problems. The package “nnet” implements feed forward neural nets in R. These types of neural networks are among the most frequently used ones.