8.5 Market simulation

Say we have created a small number of ice creams and we want to estimate the market share of each of those ice creams. Let’s say we have selected the following four profiles:

# use slice() to select rows
market_profiles <- profiles.all %>% 
  slice(c(4, 16, 23, 38)) # from profiles.all, select rows 4, 16, 23, 38 as the four profiles

market_profiles
##       Flavor       Packaging      Light     Organic
## 1 Strawberry            Cone    Low fat Not organic
## 2  Chocolate            Cone No low fat Not organic
## 3  Raspberry Homemade waffle No low fat Not organic
## 4  Raspberry Homemade waffle    Low fat     Organic

We already know how to estimate which ice cream will be liked the most:

conjoint_allrespondents <- conjoint(icecream, rvar = "rating", evar = c("Flavor","Packaging","Light","Organic"))

predict(conjoint_allrespondents, market_profiles) %>%
  arrange(desc(Prediction))
## Conjoint Analysis
## Data                 : icecream 
## Response variable    : rating 
## Explanatory variables: Flavor, Packaging, Light, Organic 
## Prediction dataset   : market_profiles 
## 
##      Flavor       Packaging      Light     Organic Prediction
##  Strawberry            Cone    Low fat Not organic      5.124
##   Raspberry Homemade waffle No low fat Not organic      5.113
##   Raspberry Homemade waffle    Low fat     Organic      4.942
##   Chocolate            Cone No low fat Not organic      4.836

The low fat, non-organic strawberry ice cream in a cone has the highest predicted rating across all respondents. But this doesn’t tell us what the market share of each of the four profiles will be. For this, we need to know, for each participant, which profile he or she would choose. In other words, we need to predict the ratings for each individual separately:

# same model as before, but now add by = "respondent"
conjoint_perrespondent <- conjoint(icecream, rvar = "rating", evar = c("Flavor","Packaging","Light","Organic"), by = "respondent")

predict(conjoint_perrespondent, market_profiles) %>% 
  arrange(respondent, desc(Prediction)) # sort by respondent and then by predicted rating
## Conjoint Analysis
## Data                 : icecream 
## Response variable    : rating 
## Explanatory variables: Flavor, Packaging, Light, Organic 
## Prediction dataset   : market_profiles 
## Rows shown           : 20 of 60 
## 
##     respondent     Flavor       Packaging      Light     Organic Prediction
##   Individual 1 Strawberry            Cone    Low fat Not organic      8.800
##   Individual 1  Raspberry Homemade waffle    Low fat     Organic      3.700
##   Individual 1  Chocolate            Cone No low fat Not organic      2.800
##   Individual 1  Raspberry Homemade waffle No low fat Not organic      1.300
##  Individual 10  Raspberry Homemade waffle No low fat Not organic      9.950
##  Individual 10  Raspberry Homemade waffle    Low fat     Organic      8.967
##  Individual 10  Chocolate            Cone No low fat Not organic      5.367
##  Individual 10 Strawberry            Cone    Low fat Not organic      2.033
##  Individual 11 Strawberry            Cone    Low fat Not organic      5.800
##  Individual 11  Raspberry Homemade waffle    Low fat     Organic      5.200
##  Individual 11  Chocolate            Cone No low fat Not organic      3.800
##  Individual 11  Raspberry Homemade waffle No low fat Not organic      2.800
##  Individual 12  Raspberry Homemade waffle No low fat Not organic      9.600
##  Individual 12  Raspberry Homemade waffle    Low fat     Organic      7.733
##  Individual 12  Chocolate            Cone No low fat Not organic      5.933
##  Individual 12 Strawberry            Cone    Low fat Not organic      3.267
##  Individual 13  Raspberry Homemade waffle No low fat Not organic      6.550
##  Individual 13  Raspberry Homemade waffle    Low fat     Organic      6.200
##  Individual 13  Chocolate            Cone No low fat Not organic      5.300
##  Individual 13 Strawberry            Cone    Low fat Not organic      1.300

Let’s retain for each individual only his or her highest rated profile. We can do this by grouping per respondent and by adding a variable named ranking that will tell us the ranking of profiles, based on predicted rating, for every respondent:

highest_rated <- predict(conjoint_perrespondent, market_profiles) %>% 
  group_by(respondent) %>% 
  mutate(ranking = rank(Prediction))

# have a look
highest_rated %>% 
  arrange(respondent, ranking)
## # A tibble: 60 x 7
## # Groups:   respondent [15]
##    respondent    Flavor     Packaging     Light    Organic    Prediction ranking
##    <chr>         <fct>      <fct>         <fct>    <fct>           <dbl>   <dbl>
##  1 Individual 1  Raspberry  Homemade waf~ No low ~ Not organ~       1.3        1
##  2 Individual 1  Chocolate  Cone          No low ~ Not organ~       2.80       2
##  3 Individual 1  Raspberry  Homemade waf~ Low fat  Organic          3.7        3
##  4 Individual 1  Strawberry Cone          Low fat  Not organ~       8.8        4
##  5 Individual 10 Strawberry Cone          Low fat  Not organ~       2.03       1
##  6 Individual 10 Chocolate  Cone          No low ~ Not organ~       5.37       2
##  7 Individual 10 Raspberry  Homemade waf~ Low fat  Organic          8.97       3
##  8 Individual 10 Raspberry  Homemade waf~ No low ~ Not organ~       9.95       4
##  9 Individual 11 Raspberry  Homemade waf~ No low ~ Not organ~       2.8        1
## 10 Individual 11 Chocolate  Cone          No low ~ Not organ~       3.80       2
## # ... with 50 more rows
# we need to retain only the highest ranked ice cream
highest_rated <- highest_rated %>% 
  arrange(respondent, ranking) %>% 
  filter(ranking == 4)

highest_rated
## # A tibble: 15 x 7
## # Groups:   respondent [15]
##    respondent    Flavor     Packaging     Light    Organic    Prediction ranking
##    <chr>         <fct>      <fct>         <fct>    <fct>           <dbl>   <dbl>
##  1 Individual 1  Strawberry Cone          Low fat  Not organ~       8.8        4
##  2 Individual 10 Raspberry  Homemade waf~ No low ~ Not organ~       9.95       4
##  3 Individual 11 Strawberry Cone          Low fat  Not organ~       5.80       4
##  4 Individual 12 Raspberry  Homemade waf~ No low ~ Not organ~       9.60       4
##  5 Individual 13 Raspberry  Homemade waf~ No low ~ Not organ~       6.55       4
##  6 Individual 14 Raspberry  Homemade waf~ No low ~ Not organ~       9.8        4
##  7 Individual 15 Strawberry Cone          Low fat  Not organ~       8.53       4
##  8 Individual 2  Strawberry Cone          Low fat  Not organ~       9.63       4
##  9 Individual 3  Chocolate  Cone          No low ~ Not organ~       5.57       4
## 10 Individual 4  Raspberry  Homemade waf~ Low fat  Organic          4.2        4
## 11 Individual 5  Strawberry Cone          Low fat  Not organ~       4.93       4
## 12 Individual 6  Raspberry  Homemade waf~ Low fat  Organic          9.40       4
## 13 Individual 7  Strawberry Cone          Low fat  Not organ~       9.17       4
## 14 Individual 8  Chocolate  Cone          No low ~ Not organ~       4.93       4
## 15 Individual 9  Strawberry Cone          Low fat  Not organ~       7.87       4

We can now estimate the market share:

market_share <- highest_rated %>% 
  group_by(Flavor, Packaging, Light, Organic) %>% 
  summarize(count = n()) %>% 
  arrange(desc(count))
## `summarise()` regrouping output by 'Flavor', 'Packaging', 'Light' (override with `.groups` argument)
market_share
## # A tibble: 4 x 5
## # Groups:   Flavor, Packaging, Light [4]
##   Flavor     Packaging       Light      Organic     count
##   <fct>      <fct>           <fct>      <fct>       <int>
## 1 Strawberry Cone            Low fat    Not organic     7
## 2 Raspberry  Homemade waffle No low fat Not organic     4
## 3 Chocolate  Cone            No low fat Not organic     2
## 4 Raspberry  Homemade waffle Low fat    Organic         2

We see that the strawberry, cone, low fat, not organic ice cream is favored by 7 out of 15 respondents, the raspberry, homemade waffle, no low fat, not organic ice cream is favored by 4 out of 15 respondents, and so on.