Reaction {rdecision} | R Documentation |
A reaction (chance) edge in a decision tree
Description
An R6 class representing a reaction (chance) edge in a decision tree.
Details
A specialism of class Arrow
which is used in a decision tree
to represent edges whose source nodes are ChanceNode
s.
Super classes
rdecision::Edge
-> rdecision::Arrow
-> Reaction
Methods
Public methods
Inherited methods
Method 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.
Usage
Reaction$new( source_node, target_node, p = 0, cost = 0, benefit = 0, label = "" )
Arguments
source_node
Chance node from which the reaction leaves.
target_node
Node which the reaction enters.
p
Conditional probability of traversing the reaction edge.
cost
Cost associated with traversal of this edge (numeric or
ModVar
), not NA.benefit
Benefit associated with traversal of the edge (numeric or
ModVar
), not NA.label
Character string containing the reaction label.
Returns
A new Reaction
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 ModVar
s, if they are expressions.
Usage
Reaction$modvars()
Returns
A list of ModVar
s.
Method set_probability()
Set the probability associated with the reaction edge.
Usage
Reaction$set_probability(p)
Arguments
p
Conditional probability of traversing the reaction edge. Of type numeric or
ModVar
. If numeric,p
must be in the range [0,1].
Returns
Updated Reaction
object.
Method p()
Return the current value of the edge probability, i.e., the conditional probability of traversing the edge.
Usage
Reaction$p()
Returns
Numeric value in range [0,1].
Method set_cost()
Set the cost associated with the reaction edge.
Usage
Reaction$set_cost(c = 0)
Arguments
c
Cost associated with traversing the reaction edge. Of type numeric or
ModVar
.
Returns
Updated Reaction
object.
Method cost()
Return the cost associated with traversing the edge.
Usage
Reaction$cost()
Returns
Cost.
Method set_benefit()
Set the benefit associated with the reaction edge.
Usage
Reaction$set_benefit(b = 0)
Arguments
b
Benefit associated with traversing the reaction edge. Of type numeric or
ModVar
.
Returns
Updated Action
object.
Method benefit()
Return the benefit associated with traversing the edge.
Usage
Reaction$benefit()
Returns
Benefit.
Method clone()
The objects of this class are cloneable with this method.
Usage
Reaction$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Author(s)
Andrew J. Sims andrew.sims@newcastle.ac.uk