experiment: Experiment execution

View source: R/experiment.R

experimentR Documentation

Experiment execution

Description

This function simulates the experimental procedure. The function calls on 'experiment_run' procedure at the first step. Then the decision procedure is carried out. The transformation functions are applied to TU (functions output) and then the choice criteria is applied over the results.

Usage

experiment(population, experimental_design, seed = NULL, XZ = NULL)

Arguments

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').

XZ

The experimental data.frame to be used instead of generated one

Value

data.frame A complete experimental dataset XZ

Examples

# 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))

# Full experiment
XZ <- experiment(pop, edesign, seed = 10)

nikitagusarov/dcesimulatr documentation built on Jan. 7, 2023, 4:27 p.m.