alternatives_gen: Generate experimental design (choice sets)

View source: R/experimental_design.R

alternatives_genR Documentation

Generate experimental design (choice sets)

Description

Generate experimental design data (2 in standart notation) from an 'experimental_design' object.

Usage

alternatives_gen(
  experimental_design,
  n = NULL,
  resample = NULL,
  seed = NULL,
  format = "long"
)

Arguments

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.

Value

data.frame A data.frame (Z) with simulated choice sets (one row per alternative if élongé format was declared).

Examples

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

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