decision_rule: Decision rule class

decision_ruleR Documentation

Decision rule class

Description

The ‘decision_rule' R6 class serves to define individuals’decision rules. The object stores information about the decision rule: a list of formulas to be applied on the data; the associated random noise terms, transformation rules and choice selection pattern.

Public fields

formula

A list of formulas associated with respective alternatives.

noise

A list of noise specifications on per alternative basis.

transformation

The desired transformation to be applied. The transformation should be a function of Total Utility (TU). The default transforamtion is 'expr(exp(TU) / sum(exp(TU)))'

choice

The desired criteria should be declared as function.

Methods

Public methods


Method add_noise()

Append a list of 'call' noise definitions to the noise field.

Usage
decision_rule$add_noise(...)
Arguments
...

The noise is declared as randomisation function (ex: 'evd::rgumbel(loc = 0, scale = 1)')


Method add_formulas()

Append a list of 'call' formula definitions to the formula field.

Usage
decision_rule$add_formulas(...)
Arguments
...

The formulas should be defined in the same order as alternatives the individual will face (ex: 'Age + 2*Quality, 1.5*Age + Quality^2')


Method modify_transformation()

Specify transformation to applied on Total Utility for individual within each choice set.

Usage
decision_rule$modify_transformation(transformation)
Arguments
transformation

The desired transformation to be applied. The transformation should be a function of Total Utility (TU). The default transforamtion is 'expr(exp(TU) / sum(exp(TU)))'


Method modify_choice()

The choice rule represents the criteria of individual's final choice.

Usage
decision_rule$modify_choice(choice)
Arguments
choice

The desired criteria should be declared as function. The default value is 'max()' (assuming the individual chooses the alternative with higher associated probability).


Method clone()

The objects of this class are cloneable with this method.

Usage
decision_rule$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

drule <- decision_rule$new()
drule$add_noise(rnorm(), rnorm(sd = 2))
drule$add_formulas(Age + 2 * Quality, 1.5 * Age + Quality^2)
drule$modify_transformation(TU)
drule$modify_choice(min())

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