The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
This vignette is an example of modelling a decision tree using the
rdecision
package. It is based on the example given by
Briggs1 (Box 2.3) which itself
is based on a decision tree which compared oral Sumatriptan versus oral
caffeine/Ergotamine for migraine2. In this vignette, we consider the
problem from the perspective of a provincial health department.
The following code defines the variables for cost, utility and effect that will be used in the model. There are 14 variables in total; 4 costs, 4 utilities and 6 probabilities.
# Time horizon
<- as.difftime(24L, units = "hours")
th
# model variables for cost
<- 16.10
c_sumatriptan <- 1.32
c_caffeine <- 63.16
c_ed <- 1093.0
c_admission
# model variables for utility
<- 1.0
u_relief_norecurrence <- 0.9
u_relief_recurrence <- -0.30
u_norelief_endures <- 0.1
u_norelief_er
# model variables for effect
<- 0.594
p_sumatriptan_recurrence <- 0.703
p_caffeine_recurrence <- 0.558
p_sumatriptan_relief <- 0.379
p_caffeine_relief <- 0.08
p_er <- 0.002 p_admitted
The following code constructs the decision tree. In the formulation
used by rdecision
, a decision tree is a form of
arborescence, a directed graph of nodes and edges, with a
single root and a unique path from the root to each leaf node. Decision
trees comprise three types of node: decision, chance and leaf nodes and
two types of edge: actions (whose sources are decision nodes) and
reactions (whose sources are chance nodes), see
Figure 1.
# Sumatriptan branch
<- LeafNode$new("A", utility = u_relief_norecurrence, interval = th)
ta <- LeafNode$new("B", utility = u_relief_recurrence, interval = th)
tb <- ChanceNode$new()
c3 <- Reaction$new(
e1 p = p_sumatriptan_recurrence, label = "No recurrence"
c3, ta,
)<- Reaction$new(
e2 p = 1.0 - p_sumatriptan_recurrence, cost = c_sumatriptan,
c3, tb, label = "Relieved 2nd dose"
)<- LeafNode$new("D", utility = u_norelief_er, interval = th)
td <- LeafNode$new("E", utility = u_norelief_endures, interval = th)
te <- ChanceNode$new()
c7 <- Reaction$new(c7, td, p = 1.0 - p_admitted, label = "Relief")
e3 <- Reaction$new(
e4 p = p_admitted, cost = c_admission, label = "Hospitalization"
c7, te,
)
<- LeafNode$new("C", utility = u_norelief_endures, interval = th)
tc <- ChanceNode$new()
c4 <- Reaction$new(c4, tc, p = 1.0 - p_er, label = "Endures attack")
e5 <- Reaction$new(c4, c7, p = p_er, cost = c_ed, label = "ER")
e6
<- ChanceNode$new()
c1 <- Reaction$new(c1, c3, p = p_sumatriptan_relief, label = "Relief")
e7 <- Reaction$new(c1, c4, p = 1.0 - p_sumatriptan_relief, label = "No relief")
e8
# Caffeine/Ergotamine branch
<- LeafNode$new("F", utility = u_relief_norecurrence, interval = th)
tf <- LeafNode$new("G", utility = u_relief_recurrence, interval = th)
tg <- ChanceNode$new()
c5 <- Reaction$new(c5, tf, p = p_caffeine_recurrence, label = "No recurrence")
e9 <- Reaction$new(
e10 p = 1.0 - p_caffeine_recurrence, cost = c_caffeine,
c5, tg, label = "Relieved 2nd dose"
)<- LeafNode$new("I", utility = u_norelief_er, interval = th)
ti <- LeafNode$new("J", utility = u_norelief_endures, interval = th)
tj <- ChanceNode$new()
c8 <- Reaction$new(c8, ti, p = 1.0 - p_admitted, label = "Relief")
e11 <- Reaction$new(
e12 p = p_admitted, cost = c_admission, label = "Hospitalization"
c8, tj,
)
<- LeafNode$new("H", utility = u_norelief_endures, interval = th)
th <- ChanceNode$new()
c6 <- Reaction$new(c6, th, p = 1.0 - p_er, label = "Endures attack")
e13 <- Reaction$new(c6, c8, p = p_er, cost = c_ed, label = "ER")
e14
<- ChanceNode$new()
c2 <- Reaction$new(c2, c5, p = p_caffeine_relief, label = "Relief")
e15 <- Reaction$new(c2, c6, p = 1.0 - p_caffeine_relief, label = "No relief")
e16
# decision node
<- DecisionNode$new("d1")
d1 <- Action$new(d1, c1, cost = c_sumatriptan, label = "Sumatriptan")
e17 <- Action$new(d1, c2, cost = c_caffeine, label = "Caffeine-Ergotamine")
e18
# create lists of nodes and edges
<- list(
V
d1, c1, c2, c3, c4, c5, c6, c7, c8,
ta, tb, tc, td, te, tf, tg, th, ti, tj
)<- list(
E
e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
e17, e18
)
# tree
<- DecisionTree$new(V, E) DT
The method evaluate
of decision tree objects computes
the probability, cost and utility of each strategy for the
model. A strategy is a unanimous prescription of the actions at each
decision node. In this example there is a single decision node with two
actions, and the strategies are simply the two forms of treatment to be
compared. More complex decision trees are also possible.
The paths traversed in each strategy can be evaluated individually
using the method evaluate(by = "path")
. In
rdecision
a strategy is defined as a set of action edges
with one action edge per decision node. It is necessary to use the
option by = "path"
only if information about each pathway
is required; normally it is sufficient to call evaluate
which will automatically aggregate the evaluation by strategy.
The evaluation of each pathway, for each strategy, is done as follows:
<- DT$evaluate(by = "path") ep
and yields the following table:
Leaf | Probability | Cost | Utility |
---|---|---|---|
F | 0.2664 | 0.35 | 0.26644 |
G | 0.1126 | 0.30 | 0.10131 |
H | 0.5713 | 0.75 | -0.17140 |
I | 0.0496 | 3.20 | 0.00496 |
J | 0.0001 | 0.12 | -0.00003 |
A | 0.3315 | 5.34 | 0.33145 |
B | 0.2265 | 7.29 | 0.20389 |
C | 0.4066 | 6.55 | -0.12199 |
D | 0.0353 | 2.80 | 0.00353 |
E | 0.0001 | 0.08 | -0.00002 |
There are, as expected, ten pathways (5 per strategy). The expected
cost, utility and QALY (utility multiplied by the time horizon of the
model) for each choice can be calculated from the table above, or by
invoking the evaluate
method of a decision tree object with
the default parameter by = "strategy"
.
<- DT$evaluate() es
This gives the following result, consistent with that reported by Evans et al2.
d1 | Cost | Utility | QALY |
---|---|---|---|
Caffeine-Ergotamine | 4.71 | 0.2013 | 0.0006 |
Sumatriptan | 22.06 | 0.4169 | 0.0011 |
The incremental cost was $Can 17.34 (22.06 - 4.71) and the incremental utility was 0.22 (0.42 - 0.2). Because the time horizon of the model was 1 day, the incremental QALYs was the incremental annual utility divided by 365, and the ICER was therefore equal to 29,383 $Can/QALY, within 5% of the published estimate (29,366 $Can/QALY).
Evans et al2 reported the ICER for various alternative values of input variables. For example (their Table VIII), they reported that the ICER was 60,839 $Can/QALY for a relative increase in effectiveness of 9.1% (i.e., when the relief from Sumatriptan was 9.1 percentage points greater than that of Caffeine-Ergotamine) and 18,950 $Can/QALY for a relative increase in effectiveness of 26.8% (these being the lower and upper confidence intervals of the estimate of effectiveness from meta-analysis).
To calculate these ICERs, we set the value of the model variable
p_sumatriptan_relief
, and re-evaluate the model. The lower
range of ICER (with the greater relative increase in effectiveness) is
calculated as follows:
<- p_caffeine_relief + 0.268
p_sumatriptan_relief $set_probability(p_sumatriptan_relief)
e7$set_probability(1.0 - p_sumatriptan_relief)
e8<- DT$evaluate() es
This yields the following table, from which the ICER is calculated as 19,632 $Can/QALY, close to the published estimate of 18,950 $Can/QALY.
d1 | Cost | Utility | QALY |
---|---|---|---|
Caffeine-Ergotamine | 4.71 | 0.2013 | 0.0006 |
Sumatriptan | 22.17 | 0.5261 | 0.0014 |
The upper range of ICER (with the smaller relative increase in effectiveness) is calculated as follows:
<- p_caffeine_relief + 0.091
p_sumatriptan_relief $set_probability(p_sumatriptan_relief)
e7$set_probability(1.0 - p_sumatriptan_relief)
e8<- DT$evaluate() es
This yields the following table, from which the ICER is calculated as 58,498 $Can/QALY, close to the published estimate of 60,839 $Can/QALY.
d1 | Cost | Utility | QALY |
---|---|---|---|
Caffeine-Ergotamine | 4.71 | 0.2013 | 0.0006 |
Sumatriptan | 21.94 | 0.3088 | 0.0008 |
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.