An R6 class representing a reaction (chance) edge in a decision tree.
Andrew J. Sims andrew.sims@newcastle.ac.uk
rdecision::Edge
-> rdecision::Arrow
-> Reaction
new()
Create an object of type Reaction
. A probability must be assigned
to the edge. Optionally, a cost and a benefit may be associated
with traversing the edge. A pay-off (benefit-cost) is sometimes
used in edges of decision trees; the parametrization used here is more
general.
Reaction$new(source, target, p, cost = 0, benefit = 0, label = "")
source
Chance node from which the arrow leaves.
target
Node which the arrow enters.
p
Probability
cost
Cost associated with traversal of this edge.
benefit
Benefit associated with traversal of the edge.
label
Character string containing the arrow label.
A new Reaction
object.
modvars()
Find all the model variables of type ModVar
that have been
specified
as values associated with this Action. Includes operands of these
ModVar
s, if they are expressions.
Reaction$modvars()
A list of ModVar
s.
p()
Return the current value of the edge probability, i.e. the conditional probability of traversing the edge.
Reaction$p()
Numeric value in range [0,1].
cost()
Return the cost associated with traversing the edge.
Reaction$cost()
Cost.
benefit()
Return the benefit associated with traversing the edge.
Reaction$benefit()
Benefit.
clone()
The objects of this class are cloneable with this method.
Reaction$clone(deep = FALSE)
deep
Whether to make a deep clone.
A specialism of class Arrow
which is used in a decision tree
to represent edges whose source nodes are ChanceNode
s.