experimental_design: Eperimental design class

experimental_designR Documentation

Eperimental design class

Description

The 'experimental_design' R6 class regroups different alternatives. It contains all the essential information of the desired experimental design. It serves as a wrapper for simultaneous interactions with alternative profiiles. The object is used for choice sets generation procedures.

Public fields

alternatives

A list of alternatives to use for experimental design construction.

design

An experimental design specification. This field assumes that a savvy user may desire to extend the number of available experimental designs. In the default configuration available designs are: "random", "factorial" and "mixed".

n

A number of choice sets per individual for "random" design configuration.

resample

Logical. Indicates whether the design part generated from factors should be resampled (shuffled)

identical

Logical. Declares whether the choice sets should be identical across individuals or not.

replace

Logical. States whether the replacement should be performed when sampling from full factorial design. Default to FALSE.

Methods

Public methods


Method new()

Create new experimental design object. It's possible to create the whole object with one command.

Usage
experimental_design$new(
  alternatives = list(NULL),
  design = "random",
  n = NULL,
  resample = NULL,
  replace = FALSE,
  identical = FALSE
)
Arguments
alternatives

A list of alternatives to use for experimental design construction.

design

An experimental design specification. This field assumes that a savvy user may desire to extend the number of available experimental designs. In the default configuration available designs are: "random", "factorial" and "mixed". The preset value is "random".

n

A number of choice sets per individual for "random" design configuration. NULL by deafult.

resample

Declares whether the dataset should be resampled (shuffled) in case of factorial design element presence.

replace

Logical. If resampling strategy is used then this parameter indicates the resampling strategy, see sample() for more details.

identical

Logical. Declares whether the choice sets should be identical across individuals or not. The default value if FALSE.

Returns

An 'experimental_design' object.


Method add_alternative()

Add new alternative to the list of available alternatives.

Usage
experimental_design$add_alternative(alternative, alternative_name = NULL)
Arguments
alternative

An 'alternative' object to be included into experimental design.

alternative_name

An added alternative name, not required. Is NULL by default.


Method set_design()

Set a new 'design' configuration.

Usage
experimental_design$set_design(design = "random")
Arguments
design

Specification of the desired design. The default designs are "random" (default), "factorial" and "mixed".


Method get_attributes()

Get a vector of available attributes' names across all alternatives.

Usage
experimental_design$get_attributes(index = NULL)
Arguments
index

A list of index of attributes to be querried.

Returns

Character list of the attributes by alternative.


Method get_design()

Get specified design.

Usage
experimental_design$get_design()
Returns

Character value of the experimental design.


Method clone()

The objects of this class are cloneable with this method.

Usage
experimental_design$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

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

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