** Predicting Tire Purchase Probability

Project Objective

To predict the probability of tire repurchase based on Wet and Noise performance ratings. 

Question 1 & 2: Develop the logistic regression model & Assess the overall model significance

Step 1: Install and load required libraries

```{r} install.packages(Hmisc) # allows us to call correlation function install.packages(pcsl) # allows us call the pseudo R-square packages to evaluate our model install.packages(pROC)

load packages

library(readxl) # allows us to import excel files library(Hmisc) # allows to call the correlation fucntion library(pscl) # allows to call the pseudo R-suqare package to evaluate our model library(pROC) # allows to eun the (area under the curve) AUC packages to het the plot and AUC score


### import the data
```{r}
tire_data <- read_excel(file.choose())

Summarize the data

```{r} head(tire_data)

summary(tire_data)



### Fit the logistic regression model
```{r}
model <- glm(Purchase ~ Wet + Noise, data = tire_data, family = binomial)
summary(model)

Question 3: Evaluate model fit

{r} pR2(model)

## we found out that the Mcfadden R-square is 0.71. which means this model is not fit. 

Question 4 & 5: Predicting with new information.

`{r} new_data <- data.frame(Wet = 8, Noise = 8)

preditc the probability

{r} prob1 <- predict(model, new_data, type = "response") prob1 * 100 new_data1 <- data.frame(Wet = 7, Noise = 7) prob2 <- predict(model,new_data1, type = "response") prob2 * 100

``` Interpretations:(1) There is a 88.37% chance of repurchase, indicating strong customer satisfaction with high performance. (2). There is a 4.06% chance of repurchase, showing that lower performance significantly reduces the likelihood of repurchase.