Stock Market Data - Introduction to Statistical Learning Applications in R by G. James Et. - Business Assignment Help

Download Solution Order New Solution
Assignment Task:

Assessment

This lab is from the text “An Introduction to Statistical Learning with Applications in R by G. James et al. 

First, install the package ISLR. install.packages("ISLR")

The Stock Market Data

We will begin by examining some numerical and graphical summaries of the Smarket data, which is part of the ISLR library. This data set consists of percentage returns for the S&P 500 stock index over 1,250 days, from the beginning of 2001 until the end of 2005. For each date, we have recorded the percentage returns for each of the five previous trading days, Lag1 through Lag5. We have also recorded Volume (the number of shares traded on the previous day, in billions), Today (the percentage return on the date in question) and Direction (whether the market was Up or Down on this date). 

a. Load the package ISLR. Give the structure of the Smarket data frame and provide summaries for each variable. 

b. Produce a matrix that contains all of the pairwise correlations among the predictors, except for the qualitative variable Direction. What can you infer from the correlations between the lag variables and today’s returns? 

The correlations between the lag variables and today’s returns are close to zero. In other words, there appears to be little correlation between today’s returns and previous days’ returns. 

c. Plot the Volume variable over time. What can you see? 

Logistic Regression 

d. Fit a logistic regression model in order to predict Direction using Lag1 through Lag5 and Volume. 

e. Use the summary() function to obtain information about the fitted model. 

f. Is there any significant association between any of the predictors and Direction? If so, which ones? 

g. Give the predicted probabilities that the market goes up. Display the results for the first 10 days. 

h. Create a vector that assigns for each of the 1250 days the label Up if the predicted probability is greater than 0.5, and Down otherwise. 

i. Build a contingency table of the counts of your predictions and Direction. Compute the fraction of days for which the prediction was correct. 

j. In order to better assess the accuracy of the logistic regression model, we can fit the model using part of the data, and then examine how well it predicts the held-out data. This will yield a more realistic error rate, in the sense that in practice we will be interested in our model’s performance not on the data that we used to fit the model, but rather on days in the future for which the market’s movements are unknown. 

Fit a logistic regression model using only the subset of the observations from 2001 through 2004, using the subset argument. 

k. Compute the predictions for 2005 using the fitted model and compute the fraction of days for which the prediction was correct over that time period. 

l. Repeat j. and k. using just Lag1 and Lag2 as predictors.

 

This Business Assignment has been solved by our Business Experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Get It Done! Today

Country
Applicable Time Zone is AEST [Sydney, NSW] (GMT+11)
+

Every Assignment. Every Solution. Instantly. Deadline Ahead? Grab Your Sample Now.