TutorTeddy.com, Tutoring, Dallas, TX
Like us for free help*

Predicting Stock Market Returns Using R



Ask any Statistics/Probability/Math Question

What is Stock Market Return?

Returns that are generated by the investors from the stock market are termed as Stock Market Returns. One of the sources of such return is the dividends of the companies. It is by means of trading in secondary market that one can generate stock market returns. Moreover, returns can be positive or negative and they vary and are subjected to market risks. Such return may change from one investor to another and this change depends on the quality of stock market analysis and also on the risk taken by the investor. Thus stock market returns are not homogeneous.


Stock Market Analysis

How do You Predict Stock Market Returns in R?

The most exciting thing in R is that it contains updated and extended libraries of scripts. The stats library is one such library that is present in R. The following is the statement which will help you to import the stats library:


library(stats)

help(stats)

After you are done with this, you need to import data in R. Consider an example: You may be interested to predict a 5 day forecast based on autoregressive integrated moving average model.


The Steps are As Follows:

>mydata<-read.table( file.choose(), sep=",")

There are both linear and non linear models of different levels in time series analysis. Box Jenkins is linear model and the simplest one. Now , following is the non seasonal autoregressive moving average model with order p and q:


Y[t] = α[1]Y[t-1] + ... + α[p]Y[t-p] + e[t] + β[1]£[t-1] + ... + β[q]£[t-q]


Where Y denotes the time series of stock price.


t denotes time index.


α denotes the parameters of AR(p).


β denotes the parameter of MA(q.


£ denotes random error ~iid N(Ó,?^2)


Autoregressive Moving Average Models do not possess long term trend and are stationary. You need to choose appropriate p and q for making the model stationary. You can run a simulation for ARMA model and this is optional.


Research Based Application

Step 2:

>Model1 <-arima(mdata1, order=c(1,1,2))


Predictions:

>predict(Model1,5)


5 denotes the number of trading days.


You can now obtain the results or the output of 5 day predictions. So with the help of R language you can predict stock market returns.

Stock Market Returns Using The R-Language

TutorTeddy.com & Boston Predictive Analytics

[ Email your Statistics or Math problems to tutor@aafter.com (camera phone photos are OK) ]


Boston Office (Near MIT/Kendall 'T'):
Cambridge Innovation Center,
One Broadway, 14th Floor,
Cambridge, MA 02142,
Phone: 617-395-8864


Dallas Office (Near Galleria):
15950 Dallas Parkway,
Suite 400,
Dallas, TX 75248,
Phone: 866-930-6363

Copyright © 2011 tutorteddy.com. All Rights Reserved. | By using our site, you agree to our TOS.