experiment_run: Run experiment

View source: R/experiment_run.R

experiment_runR Documentation

Run experiment

Description

This function simulates running of an experiment. First, the 'experiment_compose' is executed to obtain a coupling between X and Z matrices. Then Deterministic Utilities (DU) and Total Utilities (TU) are calculated using the specified formulas. Note, that even the TU abbreviation is used this still makes possible to recalibrate the generation functions, tranforms and decision tules to create a Regret Minimisation (RM) framework i.e.

Usage

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

Arguments

population

A 'population' object.

experimental_design

An 'experimental_desing' object.

seed

The seed to be preset for data simulation purposes. The default is NULL to use system defined or random seed.

XZ

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

Value

data.frame A complete experimental dataset with associated utilities.

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), n = 4)

# Run experiment
res <- experiment_run(pop, edesign)

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