experimental_design | R Documentation |
The 'experimental_design' R6 class regroups different alternatives. It contains all the essential information of the desired experimental design. It serves as a wrapper for simultaneous interactions with alternative profiiles. The object is used for choice sets generation procedures.
alternatives
A list of alternatives to use for experimental design construction.
design
An experimental design specification. This field assumes that a savvy user may desire to extend the number of available experimental designs. In the default configuration available designs are: "random", "factorial" and "mixed".
n
A number of choice sets per individual for "random" design configuration.
resample
Logical. Indicates whether the design part generated from factors should be resampled (shuffled)
identical
Logical. Declares whether the choice sets should be identical across individuals or not.
replace
Logical. States whether the replacement should be performed when sampling from full factorial design. Default to FALSE.
new()
Create new experimental design object. It's possible to create the whole object with one command.
experimental_design$new( alternatives = list(NULL), design = "random", n = NULL, resample = NULL, replace = FALSE, identical = FALSE )
alternatives
A list of alternatives to use for experimental design construction.
design
An experimental design specification. This field assumes that a savvy user may desire to extend the number of available experimental designs. In the default configuration available designs are: "random", "factorial" and "mixed". The preset value is "random".
n
A number of choice sets per individual for "random" design configuration. NULL by deafult.
resample
Declares whether the dataset should be resampled (shuffled) in case of factorial design element presence.
replace
Logical. If resampling strategy is used then this parameter indicates the resampling strategy, see sample() for more details.
identical
Logical. Declares whether the choice sets should be identical across individuals or not. The default value if FALSE.
An 'experimental_design' object.
add_alternative()
Add new alternative to the list of available alternatives.
experimental_design$add_alternative(alternative, alternative_name = NULL)
alternative
An 'alternative' object to be included into experimental design.
alternative_name
An added alternative name, not required. Is NULL by default.
set_design()
Set a new 'design' configuration.
experimental_design$set_design(design = "random")
design
Specification of the desired design. The default designs are "random" (default), "factorial" and "mixed".
get_attributes()
Get a vector of available attributes' names across all alternatives.
experimental_design$get_attributes(index = NULL)
index
A list of index of attributes to be querried.
Character list of the attributes by alternative.
get_design()
Get specified design.
experimental_design$get_design()
Character value of the experimental design.
clone()
The objects of this class are cloneable with this method.
experimental_design$clone(deep = FALSE)
deep
Whether to make a deep clone.
# Create alternatives alt1 <- alternative$new() alt1$add_attributes(Quality = runif(min = 0, max = 1), Price = rnorm(mean = 5)) alt2 <- alternative$new() alt2$add_attributes(Size = runif(min = 0, max = 1), Price = rnorm(mean = 6)) # Regroup alternatives into design edesign <- experimental_design$new(alternatives = list(alt1, alt2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.