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 
#> 678 600 594 572 613 589 608 569 577 
#> 
#> type:
#> 
#>       Fuji       Gala Honeycrisp 
#>       1814       1806       1780 
#> 
#> freshness:
#> 
#>      Poor   Average Excellent 
#>      1810      1771      1819 
#> 
#> =====================================
#> Pairwise attribute level counts
#> 
#> price x type:
#> 
#>         Fuji Gala Honeycrisp
#>      NA 1814 1806       1780
#> 1   678  228  220        230
#> 1.5 600  198  228        174
#> 2   594  193  206        195
#> 2.5 572  200  169        203
#> 3   613  201  191        221
#> 3.5 589  200  213        176
#> 4   608  212  204        192
#> 4.5 569  190  184        195
#> 5   577  192  191        194
#> 
#> price x freshness:
#> 
#>         Poor Average Excellent
#>      NA 1810    1771      1819
#> 1   678  219     216       243
#> 1.5 600  206     188       206
#> 2   594  217     192       185
#> 2.5 572  185     192       195
#> 3   613  210     199       204
#> 3.5 589  193     209       187
#> 4   608  202     211       195
#> 4.5 569  184     179       206
#> 5   577  194     185       198
#> 
#> type x freshness:
#> 
#>                 Poor Average Excellent
#>              NA 1810    1771      1819
#> Fuji       1814  595     620       599
#> Gala       1806  624     570       612
#> Honeycrisp 1780  591     581       608
#> 

# Inspect the design overlap
cbc_overlap(design)
#> ==============================
#> Counts of attribute overlap:
#> (# of questions with N unique levels)
#> 
#> price:
#> 
#>    1    2    3 
#>   14  498 1288 
#> 
#> type:
#> 
#>    1    2    3 
#>  201 1170  429 
#> 
#> freshness:
#> 
#>    1    2    3 
#>  187 1208  405 
#>