Question
Problem 1: Use LDA with One Predictor In this problem, you will use Linear Discriminant Analysis to predict Domestic by mpg in the analysis of
Problem 1: Use LDA with One Predictor
In this problem, you will use Linear Discriminant Analysis to predict Domestic by mpg in the analysis of cars.
Data: Use the Auto data set from the ISLR package. We will use several of the continuous variables to classify vehicles into levels of origin, as well as into levels of a new variable Domestic.
Question 1
Define a new variable called Domestic to have the value 1 when the car is domestic (origin = 1, for American) and the value 0 when the car is foreign (origin = 2 or 3, for European or Japanese, respectively). Tabulate the results, and report the count of domestic (Domestic=1) vehicles.
Total number of domestic vehicles =
Question 2
Make side-by-side boxplots of the mpg, split into two groups by Domestic.
insert r code here:
Question 3
Fit the linear discriminant analysis, using the predictor mpg to predict the response Domestic. Report the mean mpg for each group.
Mean mpg for domestic vehicles =
Question 4
Mean mpg for foreign vehicles =
Question 5
Normal probability plots of mpg for the two groups are shown in the image, for each level of Domestic. Using these, along with the boxplot you produced earlier, discuss whether the two assumptions for running an LDA are reasonably met.
Question 6
Predict the classifications from the LDA fit. Tabulate the variable Domestic with the LDA classification, and report the number of correctly classified domestic vehicles.
Number of domestic vehicles that are correctly classified =
Report the sensitivity and specificity of this LDA classification of Domestic.
Question 7
sensitivity (as a percentage) =
Question 8
specificity (as a percentage) =
Question 9
There are six other possible predictors of Domestic: variables cylinders, displacement, horsepower, weight, acceleration, year. Use plots to explore how these variables are related to Domestic, and state the name of one variable that appears more discriminating between foreign and domestic vehicles.
Question 10
Would you prefer to use LDA or QDA when using the variable selected in the previous question to predict Domestic? Explain your reasoning.
Question 11
Produce a ROC curve for using the variable you selected (among cylinders, displacement, horsepower, weight, acceleration, year) for predicting Domestic.
insert r code here
Question 12
The ROC curve and R output for using mpg to predict Domestic is shown in the image. Discuss whether you would use mpg or the variable you selected previously (among cylinders, displacement, horsepower, weight, acceleration, year) to predict Domestic.
Theoretical Quantiles Theoretical Quantiles -2 -1 0 2 -3 -2 -1 0 1 2 3 15 0 0 10 0000 20 OXUNDO CHIED 15 T Sample Quantiles, Domestic=0 25 20 30 L T 35 Sample Quantiles, Domestic 1 25 T Book 0o 40 L 30 00 XXXX 00000 35 T 0000 45 T O 40 Normal Q-Q Plot Normal Q-Q Plot
Step by Step Solution
3.48 Rating (164 Votes )
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