Example - identifying determinates of consumers’ choice of specific brands and types of tea a store should stock

Q1 - Which kind of tea would customers prefer?

Q2 - Which kind of tea should the store stock?

## 
## Call:
## lm(formula = frml)
## 
## Residuals:
##       1       2       3       4       5       6       7       8       9      10 
##  1.1345 -1.4897  0.3103 -0.2655  0.3103  0.1931  1.5931 -1.4310 -1.4310  1.1207 
##      11      12      13 
##  0.3690  1.1931 -1.6069 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)   
## (Intercept)          3.3937     0.5439   6.240  0.00155 **
## factor(x$price)1    -1.5172     0.7944  -1.910  0.11440   
## factor(x$price)2    -1.1414     0.6889  -1.657  0.15844   
## factor(x$variety)1  -0.4747     0.6889  -0.689  0.52141   
## factor(x$variety)2  -0.6747     0.6889  -0.979  0.37234   
## factor(x$kind)1      0.6586     0.6889   0.956  0.38293   
## factor(x$kind)2     -1.5172     0.7944  -1.910  0.11440   
## factor(x$aroma)1     0.6293     0.5093   1.236  0.27150   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.78 on 5 degrees of freedom
## Multiple R-squared:  0.8184, Adjusted R-squared:  0.5642 
## F-statistic:  3.22 on 7 and 5 DF,  p-value: 0.1082
## 
## Call:
## lm(formula = frml)
## 
## Residuals:
##       1       2       3       4       5       6       7       8       9      10 
##  1,1345 -1,4897  0,3103 -0,2655  0,3103  0,1931  1,5931 -1,4310 -1,4310  1,1207 
##      11      12      13 
##  0,3690  1,1931 -1,6069 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)   
## (Intercept)          3,3937     0,5439   6,240  0,00155 **
## factor(x$price)1    -1,5172     0,7944  -1,910  0,11440   
## factor(x$price)2    -1,1414     0,6889  -1,657  0,15844   
## factor(x$variety)1  -0,4747     0,6889  -0,689  0,52141   
## factor(x$variety)2  -0,6747     0,6889  -0,979  0,37234   
## factor(x$kind)1      0,6586     0,6889   0,956  0,38293   
## factor(x$kind)2     -1,5172     0,7944  -1,910  0,11440   
## factor(x$aroma)1     0,6293     0,5093   1,236  0,27150   
## ---
## Signif. codes:  0 '***' 0,001 '**' 0,01 '*' 0,05 '.' 0,1 ' ' 1
## 
## Residual standard error: 1,78 on 5 degrees of freedom
## Multiple R-squared:  0,8184, Adjusted R-squared:  0,5642 
## F-statistic:  3,22 on 7 and 5 DF,  p-value: 0,1082
##  [1]  3.3936782 -1.5172414 -1.1413793  2.6586207 -0.4747126 -0.6747126
##  [7]  1.1494253  0.6586207 -1.5172414  0.8586207  0.6293103 -0.6293103
##      intercept    low medium   high  black  green    red   bags granulated
## [1,]     3.394 -1.517 -1.141  2.659 -0.475 -0.675  1.149  0.659     -1.517
## [2,]     5.049  3.391 -0.695 -2.695 -1.029  0.971  0.057  1.105     -0.609
## [3,]     4.029  2.563 -1.182 -1.382 -0.248  2.352 -2.103 -0.382     -2.437
## [4,]     5.856 -1.149 -0.025  1.175 -0.492  1.308 -0.816 -0.825     -0.149
## [5,]     6.250 -2.333  2.567 -0.233 -0.033 -0.633  0.667 -0.233     -0.333
## [6,]     1.578 -0.713 -0.144  0.856  1.456 -0.744 -0.713  0.656     -0.713
##       leafy    yes     no
## [1,]  0.859  0.629 -0.629
## [2,] -0.495 -0.681  0.681
## [3,]  2.818  0.776 -0.776
## [4,]  0.975  0.121 -0.121
## [5,]  0.567 -1.250  1.250
## [6,]  0.056  1.595 -1.595
## 
## Call:
## lm(formula = frml)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5,1888 -2,3761 -0,7512  2,2128  7,5134 
## 
## Coefficients:
##                    Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         3,55336    0,09068  39,184  < 2e-16 ***
## factor(x$price)1    0,24023    0,13245   1,814    0,070 .  
## factor(x$price)2   -0,14311    0,11485  -1,246    0,213    
## factor(x$variety)1  0,61489    0,11485   5,354 1,02e-07 ***
## factor(x$variety)2  0,03489    0,11485   0,304    0,761    
## factor(x$kind)1     0,13689    0,11485   1,192    0,234    
## factor(x$kind)2    -0,88977    0,13245  -6,718 2,76e-11 ***
## factor(x$aroma)1    0,41078    0,08492   4,837 1,48e-06 ***
## ---
## Signif. codes:  0 '***' 0,001 '**' 0,01 '*' 0,05 '.' 0,1 ' ' 1
## 
## Residual standard error: 2,967 on 1292 degrees of freedom
## Multiple R-squared:  0,09003,    Adjusted R-squared:  0,0851 
## F-statistic: 18,26 on 7 and 1292 DF,  p-value: < 2,2e-16
## [1] "Part worths (utilities) of levels (model parameters for whole sample):"
##        levnms    utls
## 1   intercept  3,5534
## 2         low  0,2402
## 3      medium -0,1431
## 4        high -0,0971
## 5       black  0,6149
## 6       green  0,0349
## 7         red -0,6498
## 8        bags  0,1369
## 9  granulated -0,8898
## 10      leafy  0,7529
## 11        yes  0,4108
## 12         no -0,4108
## [1] "Average importance of factors (attributes):"
## [1] 24,76 32,22 27,15 15,88
## [1] Sum of average importance:  100,01
## [1] "Chart of average factors importance"

Example 2 - In this example, we will help an automotive company determine what type of engine the car should have. The questions include:

1) Do customers like or dislike hybrid engines?

2) If they like them, how much more they are willing to pay?

3) Are there segments of customers who like hybrid engines more than other customers?

##     resp.id            ques         alt    carpool    seat     cargo     
##  Min.   :  1.00   Min.   : 1   Min.   :1   no :6345   6:3024   2ft:4501  
##  1st Qu.: 50.75   1st Qu.: 4   1st Qu.:1   yes:2655   7:2993   3ft:4499  
##  Median :100.50   Median : 8   Median :2              8:2983             
##  Mean   :100.50   Mean   : 8   Mean   :2                                 
##  3rd Qu.:150.25   3rd Qu.:12   3rd Qu.:3                                 
##  Max.   :200.00   Max.   :15   Max.   :3                                 
##    eng       price         choice      
##  elec:3010   30:2998   Min.   :0.0000  
##  gas :3005   35:2997   1st Qu.:0.0000  
##  hyb :2985   40:3005   Median :0.0000  
##                        Mean   :0.3333  
##                        3rd Qu.:1.0000  
##                        Max.   :1.0000
## carpool
##   no  yes 
## 2115  885
## Loading required package: Formula
## Loading required package: zoo
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
## Loading required package: lmtest
## 
## Call:
## mlogit(formula = choice ~ 0 + seat + cargo + eng + price, data = cbc.mlogit, 
##     method = "nr")
## 
## Frequencies of alternatives:
##   pos 1   pos 2   pos 3 
## 0.32700 0.33467 0.33833 
## 
## nr method
## 5 iterations, 0h:0m:0s 
## g'(-H)^-1g = 7.84E-05 
## successive function values within tolerance limits 
## 
## Coefficients :
##         Estimate Std. Error  z-value  Pr(>|z|)    
## seat1   0.280374   0.035394   7.9214 2.442e-15 ***
## seat2  -0.254907   0.036505  -6.9829 2.892e-12 ***
## cargo1 -0.238724   0.025444  -9.3824 < 2.2e-16 ***
## eng1   -0.750080   0.039543 -18.9685 < 2.2e-16 ***
## eng2    0.780681   0.036573  21.3461 < 2.2e-16 ***
## price1  0.879836   0.037413  23.5166 < 2.2e-16 ***
## price2 -0.033821   0.035567  -0.9509    0.3417    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Log-Likelihood: -2581.6
## 
## Call:
## mlogit(formula = choice ~ 0 + seat + cargo + eng + as.numeric(as.character(price)), 
##     data = cbc.mlogit, method = "nr")
## 
## Frequencies of alternatives:
##   pos 1   pos 2   pos 3 
## 0.32700 0.33467 0.33833 
## 
## nr method
## 5 iterations, 0h:0m:0s 
## g'(-H)^-1g = 8E-05 
## successive function values within tolerance limits 
## 
## Coefficients :
##                                   Estimate Std. Error  z-value  Pr(>|z|)    
## seat1                            0.2802156  0.0353913   7.9176 2.442e-15 ***
## seat2                           -0.2543237  0.0364952  -6.9687 3.199e-12 ***
## cargo1                          -0.2383468  0.0254316  -9.3721 < 2.2e-16 ***
## eng1                            -0.7491718  0.0395120 -18.9606 < 2.2e-16 ***
## eng2                             0.7799528  0.0365496  21.3396 < 2.2e-16 ***
## as.numeric(as.character(price)) -0.1733053  0.0069398 -24.9726 < 2.2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Log-Likelihood: -2582.1
## <NA> 
##   NA

#References: R for Marketing Research & Analytics by Chris Chapman & Elea McDonnel Feit.