Question
Please use the Weekly data set in ISLR2 package to finish the question. Use the full data set to perform a logistic regression Use the
Please use the Weekly data set in ISLR2 package to finish the question.
Use the full data set to perform a logistic regression
Use the full data set to perform a logistic regression with Direction as the response and the five lag variables plus Volume as predictors. Use the summary function to print the results. Do any of the predictors appear to be statistically significant? If so, which ones?
Compute the confusion matrix and overall fraction of correct predictions. Explain what the confusion matrix is telling you about the two types of mistakes made by logistic regression.
Divide the full data set into training set and test set, then fit logistic regression model.
Divide the full data set into training set and test set. The training set is the first 900 rows, and the rest is the rest.
Fit the logistic regression model using the training data set with Lag2 as the only predictor.
Compute the confusion matrix and the overall fraction of correct predictions for the test data.
Adjust threshold to improve the overall fraction in the training data set. Choose the best threshold from the values, 0.52, 0.53, 0.54.
Compute the confusion matrix and the overall fraction of correct predictions for the test data by using the best threshold. Is the new overall fraction of correct predictions better than that in Question (III)?
Divide the full data set into training set and test set, then fit LDA model.
Fit LDA model using the training data set (obtained in Question 2(I) ) with Lag2 as the only predictor.
Compute the confusion matrix and the overall fraction of correct predictions for the test data. Is the overall fraction of correct predictions for the test data better than that obtained in Question 2(III)?
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