View source: R/experimental_design.R
alternatives_gen | R Documentation |
Generate experimental design data (2 in standart notation) from an 'experimental_design' object.
alternatives_gen( experimental_design, n = NULL, resample = NULL, seed = NULL, format = "long" )
experimental_design |
Input experimental design configuration |
n |
It is possible to generate different number of choice sets without directly modifying the 'experimental_design' object. User may locally overwrite the 'n' value for the particular execution. This parameter is for internal use in conjunction with various wrappers. |
resample |
Logical. Declares whether the created design should be redused and randomly sampled. |
seed |
The seed to be set before attempting to generate data. Defaults to NULL. |
format |
The resulting data format specification. At this tage only the "long" format is supported. Meaning each line contains one alternative. |
data.frame A data.frame (Z) with simulated choice sets (one row per alternative if élongé format was declared).
# 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), n = 4) Z <- alternatives_gen(edesign)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.