Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SOLVE USING RSTUDIO - DATASET IS CSV FILE: DATASET - CSV FILE: Tire Wet Noise Bu

ID: 3369214 • Letter: S

Question

SOLVE USING RSTUDIO - DATASET IS CSV FILE:

DATASET - CSV FILE:

Tire Wet Noise BuyAgain BFGoodrich g-Force Super Sport A/S 8 7.2 6.1 BFGoodrich g-Force Super Sport A/S H&V 8 7.2 6.6 BFGoodrich g-Force T/A KDWS 7.6 7.5 6.9 Bridgestone B381 6.6 5.4 6.6 Bridgestone Insignia SE200 5.8 6.3 4 Bridgestone Insignia SE200-02 6.3 5.7 4.5 Bridgestone Potenza G 019 Grid 7.7 5.2 5 Bridgestone Potenza RE92 5 6.2 2.5 Bridgestone Potenza RE92A 5.6 6.4 2.7 Bridgestone Potenza RE960AS Pole Position 8.8 8.5 8.1 Bridgestone Potenza RE970AS Pole Position 9.2 8.9 8.5 Continental ContiEcoContact EP 8.1 8.2 8 Continental ExtremeContact DWS 9 8.5 8 Dunlop SP Sport 01 A/S 6 5.2 2.7 Dunlop SP Sport 5000 Asymmetrical 8 7.8 7.6 Dunlop SP Sport 5000 M 6 6.5 3.6 Dunlop SP Sport 5000 Symmetrical 6.9 5.7 4.3 Dunlop SP Sport 7000 A/S 6.6 5.6 3.7 Dunlop SP Sport Maxx A1 A/S 7.3 7.9 4.2 Dunlop SP Sport Signature (H&V) 8 7.6 6.9 Dunlop SP Sport Signature (W&Y) 8 7.3 6.3 Dunlop SP20 FE 4.8 5.7 3.4 Dunlop SP31 A/S 5.2 4.8 1.8 Dunlop SP50 5.9 3.6 2.8 Firestone Firehawk GT 7.6 5.7 5.4 Firestone Firehawk GTA 02 5.3 5.3 3.3 Firestone Firehawk GTA-03 5.5 3.8 2.3 Firestone FR710 7.4 7 5.8 Firestone Precision Sport 8.4 6.4 7.2 General G-MAX AS-03 9.1 8.3 8.5 Goodyear Assurance ComforTred 8.1 8.6 6.8 Goodyear Assurance Fuel Max 7.2 7.3 5.5 Goodyear Assurance TripleTred 8.9 7.4 7.3 Goodyear Assurance TripleTred All-Season 9.1 7.5 6.9 Goodyear Eagle F1 A/S-C 8.1 6.6 7.2 Goodyear Eagle F1 All Season 8.2 5.2 4.9 Goodyear Eagle GT (V) 8.2 7 6.6 Goodyear Eagle GT (W) 8.1 6.9 6 Goodyear Eagle RS-A 5.6 6 3.5 Goodyear Integrity 4.9 6 3 Hankook Ventus V4 ES H105 7.5 7.5 6.1 Kumho 722 5.9 6.7 4.8 Kumho Ecsta 4X 8.5 8.3 8.5 Kumho Ecsta AST 7.1 7.2 6.4 Kumho Ecsta ASX 7.8 7.9 7.4 Michelin Energy LX4 6.5 6.9 4.5 Michelin Energy Saver A/S 8.4 8 7.5 Michelin Harmony 8.4 8.3 8.2 Michelin HydroEdge with Green X 9 7.7 7.8 Michelin MX4 6.6 7 5.3 Michelin Pilot Exalto A/S 8.7 8.4 8.1 Michelin Pilot Sport A/S Plus 8.9 8.2 8 Michelin Symmetry 6.5 6.6 4.4 Pirelli P6 allroad 6.5 5 3 Pirelli PZero Nero All Season 8.4 8 7.6 Pirelli PZero Nero M&S 8.3 8.2 7.7 Sumitomo HTR A/S P01 (H&V) 8.1 8.2 7.4 Sumitomo HTR A/S P01 (W) 7.9 7.4 6.6 Yokohama ADVAN A82A 6.8 6.4 3.9 Yokohama ADVAN S.4. 8.6 8.4 7.8 Yokohama AVID ENVigor (H&V) 8.6 8.3 7.1 Yokohama AVID ENVigor (W) 8.1 7.6 6.2 Yokohama AVID S33 5 6.3 2.6 Yokohama AVID S34B 7.1 7.6 3.7 Yokohama AVID S34D 4.3 4.6 1.4 Yokohama AVID W4S 7.8 6.9 6.2 Yokohama S32A 5.8 5.5 2.6 Yokohama Y372 8.2 8.4 8.9 The data set TireRatings contains consumer survey results for 68 all-season tires. Performance traits are rated using the following 10-point scale: SuperiorExcellent 10 9 8 7 6 5 4 32 Fair Unacceptable The values for the variable Wet in the data set give the average ratings for each tire's wet traction performance, and the values for Noise are the average ratings for the noise level generated by each tire Respondents were also asked whether they would buy the tire again using the following 10-point scale Definitely Probably Possibly Probably Not Definitely Not 10 9 876 54 The values for the variable BuyAgain are the average of the buy-again responses. (a) Create a binary variable Purchase that codes whether or not a respondent would buy the tire again with the following coding 1, if BuyAgain7 Purchase-. otherwise (b) Fit a logistic regression model that predicts whether a respondent would buy a tire again (i.e., y = Purchase), with Wet and Noise as predictors. (c) Compare the deviance of the full model fit in (b) with the single predictor models, i.e, the model that only includes the variable Wet as a predictor and the model that only includes Noise. Com- ment on the difference between the deviance for these models and the differences when compared to the null model. (d) Split the data into a training set and a test set. Use set.seed (6182018) (e) Using both Wet and Noise as predictors, fit a logistic regression model to the training set and estimate the test error of the model using the test set. (f) Again using both Wet and Noise as predictors, perform LDA on the training data to predict Purchase and estimate the test error of the model using the test set. (g) One more time using both Wet and Noise as predictors, perform QDA on the training data to predict Purchase and estimate the test error of the model using the test set. (h) Which of these methods, logistic regression, LDA, or QDA, provides the best model for predicting whether a tire would be purchased again. Compare the performance of that model to that of the null model. (i) Summarize your findings regarding predicting whether a tire would be purchased again. What advice, based on these findings, would you give to a CEO of a tire company? Use appropriate visualizations to support your summary and advice

Explanation / Answer

########## Header ################

# Title: TireRatings question for CHEGG

#  

# Description:

# The data set TireRatings contains consumer survey results for 68 all-season tires.

# Performance traits are rated using the following 10-point scale.

# The values for the variable Wet in the data set give the average ratings for each tire's wet traction performance, and the values for Noise are the average ratings for the noise level generated by each tire.

# Respondents were also asked whether they would buy the tire again using the following 10-point scale.

# The values for the variable BuyAgain are the average of the buy-again responses.

# Author: <Chegg Tutor>

# Date: <23-06-2018>

########## End of header ###################

# Set working directory using setwd() function

setwd("C:/_chegg") # Create A directory < C:_chegg > and save the file ,"02_Tirerating_R.csv" in it

# Clear all variables in R memory

rm(list=ls())

# Reading *.csv file in R

Tirerating_Data = read.csv("02_Tirerating_R.csv")

############################ Part (a) #######################################################

# (a) Create a binary variable Purchase that codes whether or not a respondent would

# buy the tire again with the following coding

# Creating Purchase Column

BuyAgain <- Tirerating_Data[["BuyAgain"]] # Obtaining Values of"BuyAgain" by Column Name

count_num <- 0 # Initilizing a Counter variable "count"

Purchase <- 0 # Initilizing the "Purchase" variable

# Creating Purchase Data Column

for(i in 1 : length(BuyAgain)){

if(BuyAgain[i]>=7){

count_num <- count_num + 1

Purchase[i] <- 1

}else{

Purchase[i] <- 0

}

}

Tirerating_Data$Purchase = Purchase # Append "Purchase" data column to main DataFrame

Tirerating_Data # Display the new DataFrame

############################ ################################################################

############################ Part (b) ##############################################

# Fit a logistic regression model that predicts whether a respondent would buy a tire

# again (i.e., y=Purchase, with Wet and Noise as predictors

LogitReg_WetNoise <- glm(Tirerating_Data$Purchase ~ Tirerating_Data$Wet + Tirerating_Data$Noise)

LogitReg_WetNoise

############################ Part (c) ##############################################

#Compare the deviance of the full model fit in (b) with the single predictor models.

#i.e. the model that only includes the variable Wet as a predictor and the model that only includes Noise.

#Comment on the difference between the deviance for these models and the differences when compared to the null model.(1)

LogitReg_Wet <- glm(Tirerating_Data$Purchase ~ Tirerating_Data$Wet)   

LogitReg_Wet

LogitReg_Noise <- glm(Tirerating_Data$Purchase ~ Tirerating_Data$Noise)

LogitReg_Noise

############################ Part (d) ##############################################

# Split the data into a training set and a test set. Use set seed (6182018)

Sample_Size <- floor(0.75 * nrow(mtcars)) # Creating Training Sample 75% of DataSet

set.seed(6182018) # Set up Seed

Tirerating_Data_Sample <- sample(seq_len(nrow(Tirerating_Data)), size = Sample_Size) # sampling dataSet 75% of DataSet

Tirerating_Data_Train <- Tirerating_Data[Tirerating_Data_Sample, ] # Training Set

Tirerating_Data_Test <- Tirerating_Data[-Tirerating_Data_Sample, ] # Testing Set

############################ Part (e) ##############################################

# (e) Using both Wet and Noise as predictors, fit a logistic regression model to the training set

#and estimate the test error of the model using the test set

LogitReg_Train_WetNoise <- glm(Tirerating_Data_Train$Purchase ~ Tirerating_Data_Train$Wet + Tirerating_Data_Train$Noise) # LOgistic Regression on Training Set

LogitReg_Train_WetNoise

Predict_Test_WetNoise <- predict(LogitReg_Train_WetNoise, Tirerating_Data_Test, type="response") # Prediction on Testing Set

Predict_Test_WetNoise