Homework-5 - Homework 5 - Stats 202 Page 1 of 2 Homework 5...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Homework 5 1) Read Chapter 5 (Sections 5.2, 5.3, 5.5 and 5.6). 2) This question deals with In Class Exercise #34. a) Repeat In Class Exercise #34 for the k-nearest neighbor classifier for k=1,2,. ..,10. (We did k=1 in class which is the default). Use R to produce a single plot showing both the training error and the test error as functions of the value of k. Provide your R code. Remember that the 61st column is the response and the other 60 columns are the predictors. Provide a legend on your plot and label the axes. Include your name in the title of the plot. What value of k does your plot suggest is optimal with regard to the test error? b) Repeat part a using the exact same R code. Explain why both the training errors and the test errors change for even values of k but not for odd values of k. Hint: Read the help on the knn function if you do not know. 3) This question deals with In Class Exercise #36. a) Using the abline() function, add some lines to the plot from In Class
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

Homework-5 - Homework 5 - Stats 202 Page 1 of 2 Homework 5...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online