View source: R/experiment_compose.R
experiment_compose | R Documentation |
This function simulates the data preparation step for an experiment. The function performs coupling between X (population) and Z (experimental_design) datasets.
experiment_compose(population, experimental_design, seed = NULL)
population |
A 'population' object. |
experimental_design |
An 'experimental_desing' object. |
seed |
The desired seed to be set before data generation. No seed is set by default ('seed = NULL'). |
data.frame A complete experimental dataset XZ
# Generate individual profile and population ind3 <- individual$new() ind3$add_characteristics(Age = rnorm(mean = 50, sd = 4), Salary = runif(min = 1, max = 5)) drule <- decision_rule$new() drule$add_noise(rnorm(), rnorm(sd = 2)) drule$add_formulas(Age + 2 * Quality, 1.5 * Age + Quality^2) ind3$add_decision_rule(drule) pop <- population$new(profiles = list(ind3), n = list(5)) # Create alternatives and regroup them into design 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)) edesign <- experimental_design$new(alternatives = list(alt1, alt2), n = 4) # Compose dataset XZ <- experiment_run(pop, edesign, seed = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.