Analyzing Level Summaries in Choice-Based Conjoint Models
Source:vignettes/04_level_summaries.Rmd
04_level_summaries.RmdIntroduction
In choice-based conjoint analysis, understanding how respondents
perceive different attribute levels can provide valuable insights. The
g6tr.conjoint package facilitates this by offering tools to
generate level summaries using the
cjt_level_summary() function. This vignette demonstrates
how to create and interpret these summaries for categorical
predictors.
Note:
cjt_level_summary()can also work withcohortandcohort_setobjects fromg6tr.cohorts, but we won’t cover cohort creation here. Please refer to the Using g6tr.cohorts with Choice-Based Conjoint Models vignette for that workflow.
Preparing the Environment
First, load the necessary libraries. We’ll use the
example_cjt_fp_drn_flat_data dataset that comes with the
package.
glimpse(example_cjt_fp_drn_flat_data)
#> Rows: 30,348
#> Columns: 11
#> $ id <chr> "R_0001", "R_0001", "R_0001", "R_0001", "R_0001", "…
#> $ weight <dbl> 0.951736, 0.951736, 0.951736, 0.951736, 0.951736, 0…
#> $ country <fct> Italy, Italy, Italy, Italy, Italy, Italy, Italy, It…
#> $ m3_customer <fct> Non-Customer, Non-Customer, Non-Customer, Non-Custo…
#> $ m3_sub_interest <fct> Swing, Swing, Swing, Swing, Swing, Swing, Swing, Sw…
#> $ task <dbl> 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, …
#> $ service <fct> No Service, AppleTV+ and Apple Arcade, Apple One Pr…
#> $ scenario <fct> Scenario 3, Scenario 2, Scenario 1, Scenario 1, Sce…
#> $ nn_choice <lgl> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE…
#> $ drn_sub_buy_choice <lgl> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE…
#> $ drn_2nd_dev_choice <lgl> TRUE, FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, FALSE…Generating Level Summaries
We’ll begin by fitting a model without interactions, where both
predictors (service and scenario) are
categorical.
levels(example_cjt_fp_drn_flat_data$scenario)
#> [1] "Scenario 1" "Scenario 2" "Scenario 3" "Scenario 4" "Scenario 5"
#> [6] "Scenario 6"
levels(example_cjt_fp_drn_flat_data$service)
#> [1] "No Service" "Apple Music"
#> [3] "AppleCare+ and iCloud+ 200GB" "AppleTV+ and Apple Arcade"
#> [5] "iCloud+ 2TB" "Standard Accessory Package"
#> [7] "Apple One Premier" "Premium Accessory Package"
#> [9] "Apple One Family and AppleCare+"
mod_no_interactions <- cjt_model(
nn_choice + allows_none(drn_sub_buy_choice) ~ service + scenario,
data = example_cjt_fp_drn_flat_data,
id_col = id,
task_col = task,
mcmc = list(R = 200, use = 200)
)Now, generate level summaries for the overall population:
level_summary_no_interactions <- cjt_level_summary(mod_no_interactions)
#> ℹ No weights provided. Using equal weights of 1.
level_summary_no_interactions
#> # A tibble: 2 × 6
#> term level_summaries importance attr_pval_vs_below attr_pval_vs_median
#> <chr> <list> <dbl> <dbl> <dbl>
#> 1 service <tibble [9 × 5]> 0.750 3.43e-304 3.43e-304
#> 2 scenario <tibble [6 × 5]> 0.250 NA 3.43e-304
#> # ℹ 1 more variable: indiv_importance <named list>The output is a tibble with one row per predictor.
Each row corresponds to a categorical predictor used in the model.
The term column names the predictor, and the
level_summaries column contains a tibble with summaries for
each level of that predictor.
Let’s examine the level summaries for the scenario
predictor:
scenario_summary <- level_summary_no_interactions$level_summaries[[2]]
scenario_summary
#> # A tibble: 6 × 5
#> level probs mean level_pval_vs_below level_pval_vs_median
#> <chr> <named list> <dbl> <dbl> <dbl>
#> 1 Scenario 1 <dbl [843]> 0.198 1.17e- 2 8.72e-33
#> 2 Scenario 2 <dbl [843]> 0.191 1.19e- 7 8.52e-21
#> 3 Scenario 3 <dbl [843]> 0.178 1.02e-17 1.02e-17
#> 4 Scenario 4 <dbl [843]> 0.159 1.75e-18 1.02e-17
#> 5 Scenario 5 <dbl [843]> 0.140 9.01e- 2 2.39e-50
#> 6 Scenario 6 <dbl [843]> 0.135 NA 1.14e-22For each respondent, we consider a hypothetical task where they are presented with options corresponding to each level of the current predictor, while keeping other predictors fixed. Since the other predictors are fixed, they don’t affect the relative probabilities among the levels of the current predictor.
By computing the probabilities of choosing each level for each respondent, we can aggregate and compare these probabilities across the population. Specifically:
- The probs column contains vectors of probabilities for each respondent.
- The mean column displays the average probability across all respondents, calculated from the probs vectors. Levels are ordered by descending mean probability.
- The level_pval_vs_below column provides the p-value for the statistical test comparing the mean probability of a level with the level immediately below it.
- The level_pval_vs_median column shows the p-value for the test comparing each level to the median level. If the number of levels is odd, the comparison is made against the middle level. If even, it is made against the average of the two middle levels.
Limitations
Level summaries in the g6tr.conjoint package are
implemented only for independent categorical predictors and are not
available for continuous terms or interactions. When a predictor appears
both independently and within an interaction, the level summaries for
that predictor may not be representative because interaction effects are
not accounted for.