jhelvy / cbcTools

An R package with tools for designing choice based conjoint (cbc) survey experiments and conducting power analyses
https://jhelvy.github.io/cbcTools/
Other
6 stars 5 forks source link

Duplicate profile combinations within a respondent #7

Closed nickbombaij closed 1 year ago

nickbombaij commented 1 year ago

First of all, thanks for the package; it has been very helpful.

In generating designs, I've encounted situations where the same profile combinations are shown within a respondent. This does not seem desirable, as the same respondent will see the exact same question twice (or even more frequently).

See some replicable code below. In this case, obsID 3 and 8 have exactly the same profile combinations. The same with obsID 7 and 10. These are all IDs within the same respondent (respID). Despite generating 12 profile combinations (i.e., questions), only 10 are actually unique.

profiles <- cbc_profiles( a = c(0, 1), b = c("Yes", "No"), c = c("100%", "80%"), d = c("day", "week") )

set.seed(64) design <- cbc_design( profiles = profiles, n_resp = 4, n_alts = 2, n_q = 12, )

jhelvy commented 1 year ago

Thanks for point out this issue - this looks like a bug for sure.

The remove_dups function only checks for duplicate alternatives by observation to ensure that no two same alternatives are shown in any one choice question. But it does not check for duplicate choice sets by individual, which it should. I'll have to add a correction to fix this.

jhelvy commented 1 year ago

I just added some fixes for this issue on this branch. I shipped the fixes to CRAN as v0.3.0. I believe this should fix the issues.

nickbombaij commented 1 year ago

Thanks a lot for the quick adjustment!