individual: Individual class

individualR Documentation

Individual class

Description

The ‘individual' R6 class serves to define individuals’ profiles to be included into population. The object stores information about the individuals' characteristics, as well as the decision rules. The values may be specified as random declaration using statistical functions of 'r' type. The object is initialized without attributes and should be later populated with them.

Public fields

characteristics

A list of characteristics' definitions

decision_rule

A decision rule object

Methods

Public methods


Method add_characteristics()

Append a list of 'call' attributes definitions to the attributes.

Usage
individual$add_characteristics(...)
Arguments
...

The attributes should have a name and generation procedure defined (ex: 'Age = rnorm(mean = 40, sd = 10)')


Method add_decision_rule()

Create or replace an existing decision rule

Usage
individual$add_decision_rule(decision_rule)
Arguments
decision_rule

A decision rule to be assigned to individual profile


Method get_chars()

Get a vector of available characteristics' names

Usage
individual$get_chars()
Returns

Character vector with unique characteristics names.


Method get_laws()

Get a list of alternatives' generation rules

Usage
individual$get_laws()
Returns

Get a list of laws associated to individual's characteristics.


Method get_rule()

Extract 'decision_rule' object

Usage
individual$get_rule()
Returns

A 'decisio_rule' object of the given individual profile.


Method clone()

The objects of this class are cloneable with this method.

Usage
individual$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

ind <- individual$new()
ind$add_characteristics(Age = rnorm(mean = 40, sd = 10))
ind$add_decision_rule(drule <- decision_rule$new())
ind$get_chars()
ind$get_laws()
ind$get_rule()

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