1

I'm Valentina and it's the first time i write here and I apologize in advance for my English.

I'm using the software R. I have to create a choice experiment.

I know that to determinate the maximum number of combination it's used: (Level)^Factor. In general attributes have the same number of level. For example, if there are 3 attributes and every one has 2 level, the total number of combination is: 3^2=9.

I have 4 attributes with a different number of level:

Attribute A: 100%, 75%, 50%, 25%;
Attribute B: yes, no;
Attribute C: yes, no;
Attribute D: 5, 10, 15, 20.

in addiction, there is an option of status quo.

How I can determinate the maximum number of combination? And after i will create a fractional design.

I've tried in this way, but I'm not sure that is correct:

> library(DoE.base) 
> oa.design(nlevels=c(4,2,2,4))

I tried also to create the experimental design in this way:

> d.object <- rotation.design(  
           attribute.names = list(A= c("100%", "75%", "50%", "25%"), B=c  ("yes", "no"), C=c("yes" , "no"), D = c("5", "10", "15", "20")),  
nalternatives = 2,  nblocks = 1,  row.renames = FALSE,  randomize = TRUE,  
seed = 987) 



>status.quo <- c(A= "0", B= "no", C= "no", D= "0") 
   >questionnaire(choice.experiment.design = d.object, common = status.quo) 

and I obtain the questionnaire.

Is this procedure correct, in case of attributes with different number of levels?

  • this link may answer some of your questions: https://math.stackexchange.com/questions/1159085/how-to-calculate-combinations-of-multiple-variables-which-can-assume-multiple-va – Shirin Yavari Oct 09 '18 at 18:25

1 Answers1

2

The number of combinations will be the product of the number of levels of each variable:

Attribute_A = c('100%', '75%', '50%', '25%')
Attribute_B = c('yes', 'no')
Attribute_C = c('yes', 'no')
Attribute_D = c(5, 10, 15, 20)

N = prod(length(Attribute_A), length(Attribute_B), length(Attribute_C), length(Attribute_D))
# [1] 64

You can generate the combinations using expand.grid

combinations = expand.grid(Attribute_A = Attribute_A, 
                           Attribute_B = Attribute_B, 
                           Attribute_C = Attribute_C, 
                           Attribute_D = Attribute_D,
                           stringsAsFactors = FALSE)

head(combinations)
#   Attribute_A Attribute_B Attribute_C Attribute_D
# 1        100%         yes         yes           5
# 2         75%         yes         yes           5
# 3         50%         yes         yes           5
# 4         25%         yes         yes           5
# 5        100%          no         yes           5
# 6         75%          no         yes           5
#...  

You can use rbind to add the "status_quo" option (usually named the "control" in English)

status_quo = c(Attribute_A= "0", Attribute_B= "no", Attribute_C= "no", Attribute_D= "0") 
combinations = rbind(status_quo, combinations)

head(combinations)
#   Attribute_A Attribute_B Attribute_C Attribute_D
# 1           0          no          no           0
# 2        100%         yes         yes           5
# 3         75%         yes         yes           5
# 4         50%         yes         yes           5
# 5         25%         yes         yes           5
# 6        100%          no         yes           5
dww
  • 30,425
  • 5
  • 68
  • 111
  • thank you for the advise. So I can handle attributes like vectors or factors in this way? is it not a forced way to create a choice experiment? I need to create a choice set with 3 alternatives (one is the status quo). Usually it's used the mix and match method, and the comand: rotation.design. Now, I know to have 64 combinantions + status quo, so I can proceed with the command that i write in the question (d.object <- rotation.design)? but if i use it, i obtain 16 questions and not 64. – Valentina Comastri Oct 09 '18 at 20:32
  • Sorry, I don't really understand your comment. If you need full factorial design from DoE.base, you can use `fac.design(nlevels=c(4,2,2,4))`. I don't know the function `rotation.design` - I don't think it is in DoE.base. At least not in the version I have. `oa.design` produces only 16 levels because it creates fracional factorial, not full factorial – dww Oct 10 '18 at 18:40