You are on page 1of 2

4/9/2017 CSCI E­63C Week 9 assignment

CSCI E­63C Week 9 assignment
Preface
Problem 1 (10 points): logistic regression
Problem 2 (10 points): LDA and QDA
Problem 3 (10 points): KNN
Problem 4 (30 points): compare test errors of logistic regression, LDA, QDA and KNN
Extra 10 points problem: naive Bayes classifier

Preface
For this assignment we will use banknote authentication data (the one we worked with in week 2 assignment) to
fit logistics regression model and evaluate performance of LDA, QDA and KNN classifiers. As we have seen
earlier this dataset should allow to predict which banknotes are authentic and which ones are forged fairly well,
so we should expect to see low error rates for our classifiers. Let’s see whether some of those tools perform
better than others on this data.

Problem 1 (10 points): logistic regression
Fit logistic regression model of the class attribute using remaining four attributes as predictors in the model.
Produce summary of the model, describe which attributes appear to be significantly associated with the
categorical outcome in this model. Use this model to make predictions on the entire dataset and compare these
predictions and corresponding true values of the class attribute using confusion matrix (i.e. contingency table).
Calculate error rate (would this be training or test error in this case?), sensitivity and specificity (assuming that
we are predicting class “1”). Describe the results.

Problem 2 (10 points): LDA and QDA
Using LDA and QDA implementations available in the package  MASS , calculate confusion matrix, (training) error
rate, sensitivity and specificity for each of them. Compare them to those of logistic regression. Describe the
results.

Problem 3 (10 points): KNN
Using  knn  from library  class , calculate confusion matrix, (training) error rate, sensitivity/specificity for one and
ten nearest neighbors models. Compare them to corresponding results from LDA, QDA and logistic regression.
Describe results of this comparison – discuss whether it is surprising to see low training error for KNN classifier
with k = 1.

Problem 4 (30 points): compare test errors of
logistic regression, LDA, QDA and KNN

file:///C:/Users/anand/Desktop/hw9­wo­solution.html#preface 1/2
4/9/2017 CSCI E­63C Week 9 assignment

Using resampling approach of your choice (e.g. cross­validation, bootstrap, etc.) obtain test error as well as
sensitivity and specificity for each of these methods (logistic regression, LDA, QDA, KNN with 
k = 1, 2, 5, 10, 20, 50, 100). Present results in the form of boxplots, compare test error/sensitivity/specificity

across these methods and discuss their relative performance.

Extra 10 points problem: naive Bayes classifier
Fit naive Bayes classifier (see lecture slides for examples of using  naiveBayes  function from package  e1071 )
on banknote authentication dataset and assess its performance on test data by resampling along with logistic
regression, LDA, QDA and KNN in Problem 4 above. In other words, add naive Bayes to the rest of the methods
evaluated above.

file:///C:/Users/anand/Desktop/hw9­wo­solution.html#preface 2/2

You might also like