LeafNode | R Documentation |
An R6 class representing a leaf (terminal) node in a decision tree.
Represents a terminal state in a tree, and is associated with an
incremental utility. Inherits from class Node
.
rdecision::Node
-> LeafNode
new()
Create a new LeafNode
object; synonymous with a
health state.
LeafNode$new( label, utility = 1, interval = as.difftime(365.25, units = "days"), ru = 0 )
label
Character string; a label for the state; must be defined because it is used in tabulations. The label is automatically converted to a syntactically valid (in R) name to ensure it can be used as a column name in a data frame.
utility
The utility that a user associates with being in the
health state for the interval. Can be numeric
or
a type of ModVar
. If the type is numeric
, the allowed
range is -Inf
to 1; if it is of type ModVar
, it is
unchecked.
interval
The time horizon, or duration for which a user is
expected to occupy the health state and experience a health-related
quality of life of utility
, expressed as an R difftime
object; default 1 year.
ru
Annual discount rate for future utility. Note this is a rate, not a probability (i.e., use 0.035 for 3.5%).
A new LeafNode
object
grob()
Creates a grid::grob for a leaf node.
LeafNode$grob(x, y, bb = FALSE)
x
x coordinate of the node, grid::unit object.
y
y coordinate of the node, grid::unit object.
bb
Logical. If TRUE, function returns the bounding box.
A grid::grob containing the symbol and label, or a bounding box as a grid::unit vector with 4 elements: left, right, bottom, top.
modvars()
Find all the model variables of type ModVar
that have
been specified as values associated with this LeafNode
. Includes
operands of these ModVar
s, if they are expressions.
LeafNode$modvars()
A list of ModVar
s.
set_utility()
Set the utility associated with the node.
LeafNode$set_utility(utility)
utility
The utility that a user associates with being in the
health state for the interval. Can be numeric
or
a type of ModVar
. If the type is numeric
, the allowed
range is -Inf
to 1, not NA; if it is of type ModVar
, it is
unchecked.
Updated Leaf
object.
set_interval()
Set the time interval associated with the node.
LeafNode$set_interval(interval)
interval
The time interval over which the utility
parameter applies, expressed as an R difftime
object; default
1 year, not NA.
Updated Leaf
object.
utility()
Return the utility associated with being in the state for the interval.
LeafNode$utility()
Utility (numeric value).
interval()
Return the interval associated with being in the state.
LeafNode$interval()
Interval (as a difftime
).
QALY()
Return the discounted quality adjusted life years associated with being in the state.
LeafNode$QALY()
The present value of utility at future time t
can be expressed as
u_t = u_0 e^{-rt}
, where u_0
is the utility at time
t = 0
and r
is the discount rate for utility
(O'Mahony, 2015), under the assumption of continuous discount. The
quality adjusted life years (QALYs) gained by occupying the state for
time t'
is
\int_{0}^{t'} u_t dt.
For r > 0
, the QALY
gain is equal to
\frac{u_0}{r}(1 - e^{-rt'}),
and for
r=0
, it is u_0 t
'. For example, at a discount rate of 3.5%,
the number of QALYs gained after occupying a state for 1 year with a
present value utility of 0.75 is 0.983 \times
0.75 \approx
0.737 QALYs, and after 2 years the gain is 1.449 QALYs.
QALY.
clone()
The objects of this class are cloneable with this method.
LeafNode$clone(deep = FALSE)
deep
Whether to make a deep clone.
Andrew J. Sims andrew.sims@newcastle.ac.uk
O'Mahony JF, Newall AT, van Rosmalen J. Dealing with time in health economic evaluation: methodological issues and recommendations for practice. PharmacoEconomics 2015;33:1255–1268.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.