Title: | Design of Discrete Choice and Conjoint Analysis |
---|---|
Description: | Supports designing efficient discrete choice experiments (DCEs). Experimental designs can be formed on the basis of orthogonal arrays or search methods for optimal designs (Federov or mixed integer programs). Various methods for converting these experimental designs into a discrete choice experiment. Many efficiency measures! Draws from literature of Kuhfeld (2010) and Street et. al (2005) <doi:10.1016/j.ijresmar.2005.09.003>. |
Authors: | Jed Stephens [aut, cre] |
Maintainer: | Jed Stephens <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.1 |
Built: | 2024-11-08 03:12:02 UTC |
Source: | https://github.com/jedstephens/expertchoice |
Augments the full factorial design with a column summarising the levels of that design. Importantly, it also adds the B-matrix as an attribute.
augment_levels(full_factorial)
augment_levels(full_factorial)
full_factorial |
a 'data.table' generated from the 'full_factorial' function. |
a 'data.frame' with an additional column identifying the level and the B-matrix attribute.
Street, D. J.; Burgess, L. & Louviere, J. J. Quick and easy choice sets: Constructing optimal and nearly optimal stated choice experiments International Journal of Research in Marketing, 2005 , 22 , 459 - 470
# See Practical Introduction to ExpertChoice Vignette. Step 2. #Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2! - the augment_levels function #' # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" af # Compare ff and af. - do not confuse them. They serve different purposes.
# See Practical Introduction to ExpertChoice Vignette. Step 2. #Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2! - the augment_levels function #' # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" af # Compare ff and af. - do not confuse them. They serve different purposes.
Check Overshadow - Pareto Dominate Solutions
check_overshadow(choice_sets)
check_overshadow(choice_sets)
choice_sets |
An object of the choiceset class made by one of the DCE methods. |
A matrix of logicals indicating which if any card for a given row is Pareto dominate.
#See Step 7 of the Practical Introduction to ExpertChoice Vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 #' # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 - Skipped, but important, see vignette. # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7! -- Check for Pareto dominate solutions check_overshadow(dce_modulo)
#See Step 7 of the Practical Introduction to ExpertChoice Vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 #' # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 - Skipped, but important, see vignette. # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7! -- Check for Pareto dominate solutions check_overshadow(dce_modulo)
Convert from choice_sets to a question data
construct_question_frame( augmented_full_factorial, choice_sets, randomise_choice_sets = TRUE )
construct_question_frame( augmented_full_factorial, choice_sets, randomise_choice_sets = TRUE )
augmented_full_factorial |
The augmented full factorial object. |
choice_sets |
The choice sets list generated from one of the methods. (See Step 6 of the tutorial) |
randomise_choice_sets |
A binary variable indicating if the order of the choice sets should be randomised. Some methods create choice sets which have a systematic order. Randomising the order of the choice sets does not change the alternatives within the choice sets. It simply rearranges the choice_set object in a random manner. |
a data.frame object
#See Step 9 of Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 (skipped, but important, see vignette) # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7 and Step 8 are very important for the design, but skipped here. # Step 9! -- Construct a question frame to use with your study. # Note the use of af here. questions <- construct_question_frame(af, dce_modulo) levels(questions$condition) <- c("bad", "good", "excellent") levels(questions$technical) <- c("poor", "fair", "skilled") levels(questions$provenance) <- c("none", "present") questions
#See Step 9 of Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 (skipped, but important, see vignette) # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7 and Step 8 are very important for the design, but skipped here. # Step 9! -- Construct a question frame to use with your study. # Note the use of af here. questions <- construct_question_frame(af, dce_modulo) levels(questions$condition) <- c("bad", "good", "excellent") levels(questions$technical) <- c("poor", "fair", "skilled") levels(questions$provenance) <- c("none", "present") questions
Efficiency Measures for Discrete Choice Experiments
dce_efficiency(augmented_full_factorial, choice_sets)
dce_efficiency(augmented_full_factorial, choice_sets)
augmented_full_factorial |
The level augmented full factorial. See tutorial step 2. |
choice_sets |
A list of choice sets generated by one of the methods used to convert from fractional factorial designs. |
a list of named output.
Street, D.J., Burgess, L. and Louviere, J.J., 2005. Quick and easy choice sets: constructing optimal and nearly optimal stated choice experiments. International Journal of Research in Marketing, 22(4), pp.459-470.
# See Step 8 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 (skipped, but important, see vignette) # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7 (skipped) # Step 8! -- Inspect the D-efficiency using the Street et. al method of the DCE design. # NOTE: the af is used at this stage not the ff. dce_efficiency(af, dce_modulo)
# See Step 8 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 & 5 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 (skipped, but important, see vignette) # Step 6 # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) # Step 7 (skipped) # Step 8! -- Inspect the D-efficiency using the Street et. al method of the DCE design. # NOTE: the af is used at this stage not the ff. dce_efficiency(af, dce_modulo)
Fractional Factorial Design Efficiency
fractional_factorial_efficiency(formula, searched_fractional_factorial)
fractional_factorial_efficiency(formula, searched_fractional_factorial)
formula |
A specification, in formula form, of the desired effects sought to be estimated. |
searched_fractional_factorial |
a fractional factorial generated as the result of a 'search_design'. |
a list with the following objects: 1. X - This is the formula expanded version of the fractional factorial which was passed to the function. 2. information_mat - This is the information matrix described by the associated note. Note: it is rounded to three decimal places to ease reading. 3. inv_information_mat - This is the inverse of the information matrix. Note: it is rounded to three decimal places to ease reading. 4. lamda_mat - This is the diagonal elements of the Lamda Matrix described by Kuhfeld (pg. 62). The elements are the eigen values of the inv_information_mat. 5. inv_diag - This is the diagonal elements of the inv_information_mat. (May be of use to some researchers...) 6. GWLP - This is the generalised world lengths for the searched design. (Note: this would not change depending on what is in the formula expansion.) 7. A_eff - This is the A-efficiency of the design given the particular formula expansion. 8. D_eff - This is the D-efficiency of the design given the particular formula expansion.
Kuhfeld, W. F. Marketing Research Methods in SAS Experimental Design, Choice, Conjoint, and Graphical Techniques 2010.
# See step 5 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5! - The fractional_factorial_efficiency function # The formula requires reference to the original attributes of the design. # Check for the main effects. fractional_factorial_efficiency(~ condition + technical + provenance, fractional) # Check for the main effects with some interaction. fractional_factorial_efficiency(~ condition + technical * provenance, fractional)
# See step 5 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5! - The fractional_factorial_efficiency function # The formula requires reference to the original attributes of the design. # Check for the main effects. fractional_factorial_efficiency(~ condition + technical + provenance, fractional) # Check for the main effects with some interaction. fractional_factorial_efficiency(~ condition + technical * provenance, fractional)
Generates the full factorial design with all the factors coded using standardised orthogonal contrast coding.
full_factorial(attributes_list)
full_factorial(attributes_list)
attributes_list |
A named list: giving the variable name and the levels as characters. The levels should start from the base of either "0" or "1" and go up in integer values. |
a 'data.frame' with the full factorial design and factors coded using standardised orthogonal contrast coding.
Kuhfeld, W. F. Marketing Research Methods in SAS Experimental Design, Choice, Conjoint, and Graphical Techniques 2010.
Jörg Suckut (https://stats.stackexchange.com/users/237455/j
# See step 1 of the Practical Introduction to ExpertChoice vignette. attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) full_factorial(attrshort)
# See step 1 of the Practical Introduction to ExpertChoice vignette. attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) full_factorial(attrshort)
Modulo Method - Described by Street et al.
modulo_method(fractional_fatorial, generators)
modulo_method(fractional_fatorial, generators)
fractional_fatorial |
The usual. |
generators |
a list of generators |
a choiceset list.
# See step 6 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 - Skipped, but important, see vignette. # Step 6! -- The modulo_method function # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) dce_modulo
# See step 6 of the Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4 # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial) # Step 5 - Skipped, but important, see vignette. # Step 6! -- The modulo_method function # Two modulators c(1,1,1) and c(0,1,1) are specified. dce_modulo <- modulo_method( fractional, list(c(1,1,1),c(0,1,1)) ) dce_modulo
Returns a consistent fractional factorial design from the input fractional factorial design. The key advantage of this function is that it ensures factors are coded and enchances the attributes of the output.
search_design(full_factorial, fractional_factorial_design)
search_design(full_factorial, fractional_factorial_design)
full_factorial |
a 'data.table' generated by the 'full_factorial' function |
fractional_factorial_design |
a means of creating a fractional design using either orthogonal arrays or Federov. See the tutorial for examples. |
a 'data.frame' with only the rows of your chosen fractional factorial design.
# The use of this function depends on what the input to the argument fractional_factorial_design # will be. See Step 4 of Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4! - The search_design function. # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial)
# The use of this function depends on what the input to the argument fractional_factorial_design # will be. See Step 4 of Practical Introduction to ExpertChoice vignette. # Step 1 attrshort = list(condition = c("0", "1", "2"), technical =c("0", "1", "2"), provenance = c("0", "1")) #Step 2 # ff stands for "full fatorial" ff <- full_factorial(attrshort) af <- augment_levels(ff) # af stands for "augmented factorial" # Step 3 # Choose a design type: Federov or Orthogonal. Here an Orthogonal one is used. nlevels <- unlist(purrr::map(ff, function(x){length(levels(x))})) fractional_factorial <- DoE.base::oa.design(nlevels = nlevels, columns = "min34") # Step 4! - The search_design function. # The functional draws out the rows from the original augmented full factorial design. colnames(fractional_factorial) <- colnames(ff) fractional <- search_design(ff, fractional_factorial)