Action {rdecision}R Documentation

An action in a decision tree

Description

R6 class representing an action (choice) edge.

Details

A specialism of class Arrow which is used in a decision tree to represent an edge whose source node is a DecisionNode.

Super classes

rdecision::Edge -> rdecision::Arrow -> Action

Methods

Public methods

Inherited methods

Method new()

Create an object of type Action. Optionally, a cost and a benefit may be associated with traversing the edge. A pay-off (benefit minus cost) is sometimes used in edges of decision trees; the parametrization used here is more general.

Usage
Action$new(source_node, target_node, label, cost = 0, benefit = 0)
Arguments
source_node

Decision node from which the arrow leaves.

target_node

Node to which the arrow points.

label

Character string containing the arrow label. This must be defined for an action because the label is used in tabulation of strategies. It is recommended to choose labels that are brief and not punctuated with spaces, dots or underscores.

cost

Cost associated with traversal of this edge (numeric or ModVar).

benefit

Benefit associated with traversal of the edge.

Returns

A new Action object.


Method modvars()

Find all the model variables of type ModVar that have been specified as values associated with this Action. Includes operands of these ModVars, if they are expressions.

Usage
Action$modvars()
Returns

A list of ModVars.


Method p()

Return the current value of the edge probability, i.e. the conditional probability of traversing the edge.

Usage
Action$p()
Returns

Numeric value equal to 1.


Method set_cost()

Set the cost associated with the action edge.

Usage
Action$set_cost(c = 0)
Arguments
c

Cost associated with traversing the action edge. Of type numeric or ModVar.

Returns

Updated Action object.


Method cost()

Return the cost associated with traversing the edge.

Usage
Action$cost()
Returns

Cost.


Method set_benefit()

Set the benefit associated with the action edge.

Usage
Action$set_benefit(b = 0)
Arguments
b

Benefit associated with traversing the action edge. Of type numeric or ModVar.

Returns

Updated Action object.


Method benefit()

Return the benefit associated with traversing the edge.

Usage
Action$benefit()
Returns

Benefit.


Method clone()

The objects of this class are cloneable with this method.

Usage
Action$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Andrew J. Sims andrew.sims@newcastle.ac.uk


[Package rdecision version 1.2.0 Index]