Question
1.This question should be answered using the Weekly data set, which is part of the ISLR package. This data is similar in nature to the
1.This question should be answered using the Weekly data set, which is part of the ISLR package. This data is similar in nature to the Smarket data, except that it contains 1,089 weekly returns for 21 years, from the beginning of 1990 to the end of 2010.
Fit the three Bayes classifiers using a training data period from 1990 to 2008, with Lag1, Lag2, and Lag3 as predictors and Direction as the response. Get the confusion matrix and the overall fraction of correct predictions for the held out data (that is, the data from 2009 and 2010).
(a) Linear Discriminant Analysis,
(b) Quadratic Discriminant Analysis, and
(c) Gaussian Nave Bayes Classifier.
2. Following problem 1, fit decision tree models to address questions below:
(a) With the default configuration, get the confusion matrix and the overall fraction of correct predictions for the held out data.
(b) Try different combinations of mindev and/or minsize (either via loops or manually) and report the best one that you obtain in terms of the forecast accuracy for the held out data.
3. Answer the following questions related to the Bayes classifiers concisely.
(a) What is the main difference between LDA (linear discriminant analysis) and QDA (quadratic discriminant analysis)?
(b) What is the main difference between LDA and Nave Bayes classifier?
In the file, for each problem, please include, if applicable, i) R commands, ii) answers to questions (alternatively, outputs from associated R commands).
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