Predicting Tire Satisfaction In Different Tire Types

Project Objective

To investigate the relationship between Wet performance and Noise performance to identify perfered tire purchases.

Question 1: Develop Logistic Performance Model

Step 1: Install and load required packages and libraries

#install.packages("Hmisc")
#install.packages("pscl")
#if(!require(pROC)) install.packages("pROC")

library("readxl")
library(Hmisc)
## Warning: package 'Hmisc' was built under R version 4.4.2
## 
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:base':
## 
##     format.pval, units
library(pscl)
## Warning: package 'pscl' was built under R version 4.4.2
## Classes and Methods for R originally developed in the
## Political Science Computational Laboratory
## Department of Political Science
## Stanford University (2002-2015),
## by and under the direction of Simon Jackman.
## hurdle and zeroinfl functions by Achim Zeileis.
library(pROC)
## Warning: package 'pROC' was built under R version 4.4.2
## Type 'citation("pROC")' for a citation.
## 
## Attaching package: 'pROC'
## The following objects are masked from 'package:stats':
## 
##     cov, smooth, var

Step 2: Read our data file and clean the data

data <- read_excel(file.choose())
tire_data <- subset(data, select = -c(Buy_Again, Tire))

Step 3: Summarize the data

head(tire_data)
## # A tibble: 6 × 3
##     Wet Noise Purchase
##   <dbl> <dbl>    <dbl>
## 1   8     7.2        0
## 2   8     7.2        1
## 3   7.6   7.5        1
## 4   6.6   5.4        0
## 5   5.8   6.3        0
## 6   6.3   5.7        0
summary(tire_data)
##       Wet            Noise          Purchase     
##  Min.   :4.300   Min.   :3.600   Min.   :0.0000  
##  1st Qu.:6.450   1st Qu.:6.000   1st Qu.:0.0000  
##  Median :7.750   Median :7.100   Median :0.0000  
##  Mean   :7.315   Mean   :6.903   Mean   :0.4412  
##  3rd Qu.:8.225   3rd Qu.:7.925   3rd Qu.:1.0000  
##  Max.   :9.200   Max.   :8.900   Max.   :1.0000

Step 4: Build the logistic regression model

model <- glm(Purchase ~ Wet + Noise, data = tire_data, family = binomial)
Our Logistic Regression Model looks something like this:

y/hat = e^-39.50 + (3.37*Wet) + (1.82*Noise) / 1 + e^-39.50 + (3.37*Wet) + (1.82*Noise)

Question 2: Are the independent variables significant based on the z-test? (Use alpha = 0.05)

Step 1: Summarize the model

summary(model)
## 
## Call:
## glm(formula = Purchase ~ Wet + Noise, family = binomial, data = tire_data)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)   
## (Intercept) -39.4982    12.4779  -3.165  0.00155 **
## Wet           3.3745     1.2641   2.670  0.00760 **
## Noise         1.8163     0.8312   2.185  0.02887 * 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 93.325  on 67  degrees of freedom
## Residual deviance: 27.530  on 65  degrees of freedom
## AIC: 33.53
## 
## Number of Fisher Scoring iterations: 8
Are answer is Yes.  All the p-values for each category of data are less than or equal to 0.05.

Qestion 3:Assess the overall model significance using the: McFadden R-Squared

Step 1: Develop Overall Model of Significance

null_model <- glm(Purchase ~ 1, data = tire_data, family = binomial)

Step 2: Perform the likelihood test

pR2(model)
## fitting null model for pseudo-r2
##         llh     llhNull          G2    McFadden        r2ML        r2CU 
## -13.7649516 -46.6623284  65.7947536   0.7050093   0.6199946   0.8305269
Our overall model significance using the: McFadden R-Squared method gives us a value of 0.71 identifying a high correllation.

Qestion 4: Use the estimated logit to compute an estimate of the probability that a customer will probably or definitely purchase a particular tire again with a Wet performance rating of 8 and a Noise performance rating of 8

After inputing the value 8 in for both Wet and Noise into our equation (y/hat = e^-39.50 + (3.37*Wet) + (1.82*Noise) / 1 + e^-39.50 + (3.37*Wet) + (1.82*Noise)) the equation preduces and estimate of %88.29.

Question 5: Suppose that the Wet and Noise performance ratings were 7. How does that affect the probability that a customer will probably or definitely purchase a particular tire again with these performance ratings?

After inputing the value 7 in for both Wet and Noise into our equation (y/hat = e^-39.50 + (3.37*Wet) + (1.82*Noise) / 1 + e^-39.50 + (3.37*Wet) + (1.82*Noise)) the equation preduces and estimate of %4.03.