Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IN R This question should be answered using the Weekly data set, which is part of the ISLR package (R package) from the book

CODE IN R

This question should be answered using the Weekly data set, which is part of the ISLR package (R package) from the book Introduction to statistical learning with applications in R. This data is similar in nature to the Smarket data from the chapter 4s lab, except that it contains 1,089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010.

FILE IN R: https://github.com/elenawangcap/ml/tree/master/Review

(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 linear discriminant analysis (LDA). This method uses the Bayes classifier with a Gaussian distribution. Even though the discriminant functions are linear functions of the inputs (x), the combination of several classifiers may lead to classification of non-linear problems.

(f) Repeat (d) using KNN with K = 1.

(g) Which of these methods appears to provide the best results on this data?

(h) 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 to Expert-Tailored 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

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago