| Reaction | R Documentation |
An R6 class representing a reaction (chance) edge in a decision tree.
A specialism of class Arrow which is used in a decision tree
to represent edges whose source nodes are ChanceNodes.
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_node, target_node, p = 0, cost = 0, benefit = 0, label = "" )
source_nodeChance node from which the reaction leaves.
target_nodeNode which the reaction enters.
pConditional probability of traversing the reaction edge. At most one Reaction from each chance node may have this set to 'NA_real_', in which case it will be replaced by one minus the sum of conditional probabilities of the other reaction edges from the node.
costCost associated with traversal of this edge (numeric or
ModVar), not NA.
benefitBenefit associated with traversal of the edge (numeric or
ModVar), not NA.
labelCharacter string containing the reaction label.
A new Reaction object.
grob()Creates a grid::grob for a reaction edge.
Reaction$grob(xs, ys, xt, yt, fs = 0.2)
xsx coordinate of source of edge, grid::unit object.
ysy coordinate of source of edge, grid::unit object.
xtx coordinate of target of edge, grid::unit object.
yty coordinate of target of edge, grid::unit object.
fsFraction of the edge which slopes.
A grid::grob containing the symbol and label.
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.
Reaction$modvars()
A list of ModVars.
set_probability()Set the probability associated with the reaction edge.
Reaction$set_probability(p)
pConditional probability of traversing the reaction edge. Of type
numeric or ModVar. If numeric, p must be in the range
[0,1], or NA_real_. Note that setting p = NA will cause
an error.
Updated Reaction object.
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].
set_cost()Set the cost associated with the reaction edge.
Reaction$set_cost(c = 0)
cCost associated with traversing the reaction edge. Of type
numeric or ModVar.
Updated Reaction object.
cost()Return the cost associated with traversing the edge.
Reaction$cost()
Cost.
set_benefit()Set the benefit associated with the reaction edge.
Reaction$set_benefit(b = 0)
bBenefit associated with traversing the reaction edge. Of type
numeric or ModVar.
Updated Action object.
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)
deepWhether to make a deep clone.
Andrew J. Sims andrew.sims@newcastle.ac.uk
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.