Question
This question should be answered using theWeeklydata set, which is part of theISLRpackage. This data is similar in nature to theSmarketdata, except that it contains
This question should be answered using theWeeklydata set, which is part of theISLRpackage. This data is similar in nature to theSmarketdata, except that it contains 1,089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010.
(Use R or R studio for this question. Besides answers and steps, please also provide a .R file for R script.)
The dataset named "Weekly dataset" can be found at ISLR package or Mass Library on Google, if cannot find, the dataset is also in the below link)
https://www.dropbox.com/scl/fi/1vaviala3rwku1ajquk37/Weekly-Data-Set.docx?dl=0&rlkey=s8newe8w2ut2flvqe67dgccfi
(a)Produce some numerical and graphical summaries of theWeeklydata. Do there appear to be any patterns?
(b)Use the full data set to perform a logistic regression withDirectionas the response and the five lag variables plusVolumeas predictors. Use the summary function to print the results. Does any of the predictors appear to be statistically significant? If so, which ones?
(c)Compute the confusion matrix and overall fraction of correct predictions. Explain what the confusion matrix is telling you about the types of mistakes made by logistic regression.
(d)Now fit the logistic regression model using a training data period from 1990 to 2008, withLag2as the only predictor. Compute the confusion matrix and the overall fraction of correct predictions for the held out data (that is, the data from 2009 and 2010).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started