Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

give r code and detail step thx 4. Uee the 'Weckly data wet' in textbook 'An Introduction to Statistical Learning, with Applications in R2 First

image text in transcribedimage text in transcribed
give r code and detail step thx
image text in transcribed
image text in transcribed
4. Uee the 'Weckly data wet' in textbook 'An Introduction to Statistical Learning, with Applications in R2 First Bilition page 171, Question 10 (or equivalently Serond Edition page 193. Question 13) to implement the following. Show the estimated parametern and compare the resuits of different methods through the predicted error: The data set is called - Weekly' in R, and it is in the ISL.R packege. Please fint install the pactoge 'ISLR', and then rum the code 'Lbrary(ISLR)' to lond the data. (a) Logistic Regriession (b) Linear Discriminant Analysis (c) Quadratic Discriminant Analysis (d) K-Necurest Neighbors in the tertbook. If you have your own thoughts and ideas, or explore some new areas about these four methods, you are highly welcomed and encouruged to incluite new analysis! 13. This question should be answered using the Weekly data set, which is part of the ISLR2 package. This data is similar in nature to the Smarket data from this chapter's lab, except that it contains 1, 089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010. (a) Produce some numerical and graphical summaries of the Weekly data. Do there appear to be any patterns? (b) 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? (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 , with Lag2 as 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). (e) Repeat (d) using LDA. (f) Repeat (d) using QDA. (g) Repeat (d) using KNN with K=1. (h) Repeat (d) using naive Bayes. (i) Which of these methods appears to provide the best results on this data? (j) Experiment with different combinations of predictors, including possible transformations and interactions, for each of the methods. Report the variables, method, and associated confusion matrix that appears to provide the best results on the held out data. Note that you should also experiment with values for K in the KNN classifier. 4. Uee the 'Weckly data wet' in textbook 'An Introduction to Statistical Learning, with Applications in R2 First Bilition page 171, Question 10 (or equivalently Serond Edition page 193. Question 13) to implement the following. Show the estimated parametern and compare the resuits of different methods through the predicted error: The data set is called - Weekly' in R, and it is in the ISL.R packege. Please fint install the pactoge 'ISLR', and then rum the code 'Lbrary(ISLR)' to lond the data. (a) Logistic Regriession (b) Linear Discriminant Analysis (c) Quadratic Discriminant Analysis (d) K-Necurest Neighbors in the tertbook. If you have your own thoughts and ideas, or explore some new areas about these four methods, you are highly welcomed and encouruged to incluite new analysis! 13. This question should be answered using the Weekly data set, which is part of the ISLR2 package. This data is similar in nature to the Smarket data from this chapter's lab, except that it contains 1, 089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010. (a) Produce some numerical and graphical summaries of the Weekly data. Do there appear to be any patterns? (b) 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? (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 , with Lag2 as 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). (e) Repeat (d) using LDA. (f) Repeat (d) using QDA. (g) Repeat (d) using KNN with K=1. (h) Repeat (d) using naive Bayes. (i) Which of these methods appears to provide the best results on this data? (j) Experiment with different combinations of predictors, including possible transformations and interactions, for each of the methods. Report the variables, method, and associated confusion matrix that appears to provide the best results on the held out data. Note that you should also experiment with values for K in the KNN classifier

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intermediate Accounting

Authors: David Spiceland

11th Edition

9781264134526

Students also viewed these Accounting questions

Question

Define Scientific Management

Answered: 1 week ago

Question

Explain budgetary Control

Answered: 1 week ago

Question

Solve the integral:

Answered: 1 week ago

Question

What is meant by Non-programmed decision?

Answered: 1 week ago