Problem 2

In this problem, you will develop a model to predict whether a given car gets high or low gas mileage based on the Auto data set. (a) Create a binary variable, mpg01, that contains a 1 if mpg contains a value above its median, and a 0 if mpg contains a value below its median. You can compute the median using the median( ) function. Note that you may find it helpful to use the data.frame( ) function to create a single data set containing both mpg01 and the other Auto variables. (b) Explore the data graphically in order to investigate the association between mpg01 and the other features. Which of the other features seem most likely to be useful in predicting mpg01? Scatterplots and Boxplots may be useful tools to answer this question. Describe your findings. (c) Split the data into a training set and a test set. (d) Perform logistic regression on the training data in order to predict mpg01 using the variables that seemed most associated with mpg01 in (b). What is the test error of the model obtained? (e) Repeat 2.d for KNN. Use different values for K and analyze the results. (f) Develop QDA based classifier for 2.d. Compute the confusion matrix. (g) Determine the sensitivity, specificity, accuracy, error rate, and false positive rates for classifier in Problem 2 Use: (i) Threshold of 0.5 for high mileage cars (ii) Threshold of 0.4 for high mileage cars (iii) Interpret the results in (i) and (ii) (h) Generate the ROC curve and determine the AUC for classifier in Problem 2