This function prints out a summary of the individual and pairwise counts of each level for each attribute across all choice questions in the design.

cbc_balance(design)

Arguments

design

A data frame of a survey design.

Value

Prints the individual and pairwise counts of the number of times each attribute levels in shown in the design.

Examples

library(cbcTools)

# A simple conjoint experiment about apples

# Generate all possible profiles
profiles <- cbc_profiles(
  price     = c(1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5),
  type      = c("Fuji", "Gala", "Honeycrisp"),
  freshness = c('Poor', 'Average', 'Excellent')
)

# Make a survey design from all possible profiles
# (This is the default setting where method = 'full' for "full factorial")
design <- cbc_design(
  profiles = profiles,
  n_resp   = 300, # Number of respondents
  n_alts   = 3,   # Number of alternatives per question
  n_q      = 6    # Number of questions per respondent
)

# Inspect the design balance
cbc_balance(design)
#> =====================================
#> Individual attribute level counts
#> 
#> price:
#> 
#>   1 1.5   2 2.5   3 3.5   4 4.5   5 
#> 612 626 632 574 575 612 555 625 589 
#> 
#> type:
#> 
#>       Fuji       Gala Honeycrisp 
#>       1815       1815       1770 
#> 
#> freshness:
#> 
#>      Poor   Average Excellent 
#>      1761      1828      1811 
#> 
#> =====================================
#> Pairwise attribute level counts
#> 
#> price x type:
#> 
#>         Fuji Gala Honeycrisp
#>      NA 1815 1815       1770
#> 1   612  192  202        218
#> 1.5 626  206  212        208
#> 2   632  213  227        192
#> 2.5 574  176  203        195
#> 3   575  179  192        204
#> 3.5 612  222  210        180
#> 4   555  182  189        184
#> 4.5 625  228  199        198
#> 5   589  217  181        191
#> 
#> price x freshness:
#> 
#>         Poor Average Excellent
#>      NA 1761    1828      1811
#> 1   612  211     197       204
#> 1.5 626  199     204       223
#> 2   632  203     221       208
#> 2.5 574  184     193       197
#> 3   575  193     202       180
#> 3.5 612  193     211       208
#> 4   555  177     188       190
#> 4.5 625  204     217       204
#> 5   589  197     195       197
#> 
#> type x freshness:
#> 
#>                 Poor Average Excellent
#>              NA 1761    1828      1811
#> Fuji       1815  572     601       642
#> Gala       1815  603     620       592
#> Honeycrisp 1770  586     607       577
#> 

# Inspect the design overlap
cbc_overlap(design)
#> ==============================
#> Counts of attribute overlap:
#> (# of questions with N unique levels)
#> 
#> price:
#> 
#>    1    2    3 
#>   12  490 1298 
#> 
#> type:
#> 
#>    1    2    3 
#>  183 1211  406 
#> 
#> freshness:
#> 
#>    1    2    3 
#>  180 1201  419 
#>