setwd("~/Desktop/7.ConsumerChoiceModel")
library(aod)
library(ggplot2)
mydata <- read.csv("ABB Electric Data binary logit (Customer Choice).csv")
## view the first few rows of the data
head(mydata)
## Observations...Choice.data Choice Price Energy.Loss Maintenance Warranty
## 1 Customer 1 0 6 6 7 6
## 2 Customer 2 0 3 4 5 4
## 3 Customer 3 1 6 6 7 7
## 4 Customer 4 0 6 6 5 5
## 5 Customer 5 0 4 4 6 8
## 6 Customer 6 0 5 4 5 4
## Spare.Parts Ease.of.Install Prob.Solver Quality
## 1 6 5 7 5
## 2 4 5 6 4
## 3 6 7 7 6
## 4 4 5 5 5
## 5 7 1 5 4
## 6 6 7 6 5
summary(mydata)
## Observations...Choice.data Choice Price Energy.Loss
## Length:88 Min. :0.0000 Min. :1.000 Min. :3.000
## Class :character 1st Qu.:0.0000 1st Qu.:4.000 1st Qu.:4.000
## Mode :character Median :0.0000 Median :5.000 Median :5.000
## Mean :0.2045 Mean :4.636 Mean :4.886
## 3rd Qu.:0.0000 3rd Qu.:6.000 3rd Qu.:6.000
## Max. :1.0000 Max. :7.000 Max. :7.000
## Maintenance Warranty Spare.Parts Ease.of.Install Prob.Solver
## Min. :3.000 Min. :1.00 Min. :1.000 Min. :1.000 Min. :3.000
## 1st Qu.:5.000 1st Qu.:4.00 1st Qu.:4.000 1st Qu.:4.000 1st Qu.:5.000
## Median :6.000 Median :5.00 Median :5.000 Median :5.000 Median :6.000
## Mean :5.705 Mean :5.25 Mean :5.239 Mean :5.364 Mean :5.898
## 3rd Qu.:6.000 3rd Qu.:7.00 3rd Qu.:6.000 3rd Qu.:7.000 3rd Qu.:7.000
## Max. :8.000 Max. :9.00 Max. :9.000 Max. :9.000 Max. :9.000
## Quality
## Min. :3.000
## 1st Qu.:4.000
## Median :5.000
## Mean :4.841
## 3rd Qu.:6.000
## Max. :7.000
sapply(mydata, sd)
## Warning in var(if (is.vector(x) || is.factor(x)) x else as.double(x), na.rm =
## na.rm): NAs introduced by coercion
## Observations...Choice.data Choice
## NA 0.4056807
## Price Energy.Loss
## 1.2334590 1.0106538
## Maintenance Warranty
## 1.0738168 1.9073361
## Spare.Parts Ease.of.Install
## 1.7286917 1.9662779
## Prob.Solver Quality
## 1.0617679 1.0381943
xtabs(~Choice, data = mydata)
## Choice
## 0 1
## 70 18
xtabs(~Choice + Quality, data = mydata)
## Quality
## Choice 3 4 5 6 7
## 0 10 16 26 16 2
## 1 0 6 5 6 1
mylogit <- glm(Choice ~ Price + Energy.Loss+ Maintenance+Warranty + Spare.Parts + Ease.of.Install + Prob.Solver + Quality, data = mydata, family = "binomial")
summary(mylogit)
##
## Call:
## glm(formula = Choice ~ Price + Energy.Loss + Maintenance + Warranty +
## Spare.Parts + Ease.of.Install + Prob.Solver + Quality, family = "binomial",
## data = mydata)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.4638 -0.6909 -0.4503 -0.1668 2.5243
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -8.26146 2.57843 -3.204 0.00135 **
## Price 0.64432 0.44887 1.435 0.15116
## Energy.Loss 0.12947 0.47179 0.274 0.78376
## Maintenance 0.63138 0.39354 1.604 0.10864
## Warranty 0.15164 0.25315 0.599 0.54917
## Spare.Parts 0.06815 0.20571 0.331 0.74041
## Ease.of.Install -0.06841 0.18225 -0.375 0.70739
## Prob.Solver 0.30174 0.43175 0.699 0.48463
## Quality -0.68642 0.48880 -1.404 0.16022
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 89.169 on 87 degrees of freedom
## Residual deviance: 73.606 on 79 degrees of freedom
## AIC: 91.606
##
## Number of Fisher Scoring iterations: 5
For every one unit change in Price, the log odds of a customer choosing to buy electrical equiment from ABB (versus not buying electrical equipment from ABB) increases by 0.644. The log odds of a customer choosing to buy for every one unit increase in energy loss rating (more energy efficient less energy loss) rating goes up by .129 and the log odds for every one unit change in maintenance rating goes up by .63.
The log odds of a customer choosing to buy increases by .15 when the warranty rating goes up by 1 unit. When the spare parts and ease of install rating goes up by 1, the log odds of a customer buying go up .068 for spare parts and up .3017 for problem solver salesman.
exp(coef(mylogit))
## (Intercept) Price Energy.Loss Maintenance Warranty
## 0.0002582818 1.9046966198 1.1382252785 1.8802083677 1.1637362151
## Spare.Parts Ease.of.Install Prob.Solver Quality
## 1.0705299671 0.9338792341 1.3522075162 0.5033734282
When variable rating increases by 1, the odds of a customer buying an ABB product increase by a factor of 1.904 for Price, 1.13 for energy efficiency rating, 1.88 for maintenance, 1.163 for warranty, 1.07 for spare parts, and 1.3522 for problem solver salesman.
When the rating increases by 1 for ease of install and quality, the odds of a customer buying an ABB product decrease by a factor of .933 for ease of install and .5033 for Quality.
Based off the results, price/maintenance/problem solver supportive salesman variables are the key drivers of choice in this market. The higher the rating by customers in these categories that more likely that they will choose to buy ABB products.