# Elementary decision tree (Evans 1997)

### Sumatriptan versus caffeine for migraine

#### Andrew J. Sims

#### April 2020

# Introduction

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.

# Creating the model

## Model variables

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
    th <- as.difftime(24L, units = "hours")

    # model variables for cost
    c_sumatriptan <- 16.10
    c_caffeine <- 1.32
    c_ed <- 63.16
    c_admission <- 1093.0

    # model variables for utility
    u_relief_norecurrence <- 1.0
    u_relief_recurrence <- 0.9
    u_norelief_endures <- -0.30
    u_norelief_er <- 0.1

    # model variables for effect
    p_sumatriptan_recurrence <- 0.594
    p_caffeine_recurrence <- 0.703
    p_sumatriptan_relief <- 0.558
    p_caffeine_relief <- 0.379
    p_er <- 0.08
    p_admitted <- 0.002

## Constructing the tree

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. If the probability of traversing one reaction edge from any chance node is set to `NA_real_`, it will be calculated as 1 minus the sum of probabilities of the other reaction edges from that node when the tree is evaluated.

    # Sumatriptan branch
    ta <- LeafNode$new("A", utility = u_relief_norecurrence, interval = th)
    tb <- LeafNode$new("B", utility = u_relief_recurrence, interval = th)
    c3 <- ChanceNode$new()
    e1 <- Reaction$new(
      c3, ta, p = p_sumatriptan_recurrence, label = "No recurrence"
    )
    e2 <- Reaction$new(
      c3, tb, p = NA_real_, cost = c_sumatriptan, label = "Relieved 2nd dose"
    )
    td <- LeafNode$new("D", utility = u_norelief_er, interval = th)
    te <- LeafNode$new("E", utility = u_norelief_endures, interval = th)
    c7 <- ChanceNode$new()
    e3 <- Reaction$new(c7, td, p = NA_real_, label = "Relief")
    e4 <- Reaction$new(
      c7, te, p = p_admitted, cost = c_admission, label = "Hospitalization"
    )

    tc <- LeafNode$new("C", utility = u_norelief_endures, interval = th)
    c4 <- ChanceNode$new()
    e5 <- Reaction$new(c4, tc, p = NA_real_, label = "Endures attack")
    e6 <- Reaction$new(c4, c7, p = p_er, cost = c_ed, label = "ER")

    c1 <- ChanceNode$new()
    e7 <- Reaction$new(c1, c3, p = p_sumatriptan_relief, label = "Relief")
    e8 <- Reaction$new(c1, c4, p = NA_real_, label = "No relief")

    # Caffeine/Ergotamine branch
    tf <- LeafNode$new("F", utility = u_relief_norecurrence, interval = th)
    tg <- LeafNode$new("G", utility = u_relief_recurrence, interval = th)
    c5 <- ChanceNode$new()
    e9 <- Reaction$new(c5, tf, p = p_caffeine_recurrence, label = "No recurrence")
    e10 <- Reaction$new(
      c5, tg, p = NA_real_, cost = c_caffeine, label = "Relieved 2nd dose"
    )
    ti <- LeafNode$new("I", utility = u_norelief_er, interval = th)
    tj <- LeafNode$new("J", utility = u_norelief_endures, interval = th)
    c8 <- ChanceNode$new()
    e11 <- Reaction$new(c8, ti, p = NA_real_, label = "Relief")
    e12 <- Reaction$new(
      c8, tj, p = p_admitted, cost = c_admission, label = "Hospitalization"
    )

    th <- LeafNode$new("H", utility = u_norelief_endures, interval = th)
    c6 <- ChanceNode$new()
    e13 <- Reaction$new(c6, th, p = NA_real_, label = "Endures attack")
    e14 <- Reaction$new(c6, c8, p = p_er, cost = c_ed, label = "ER")

    c2 <- ChanceNode$new()
    e15 <- Reaction$new(c2, c5, p = p_caffeine_relief, label = "Relief")
    e16 <- Reaction$new(c2, c6, p = NA_real_, label = "No relief")

    # decision node
    d1 <- DecisionNode$new("d1")
    e17 <- Action$new(d1, c1, cost = c_sumatriptan, label = "Sumatriptan")
    e18 <- Action$new(d1, c2, cost = c_caffeine, label = "Caffeine-Ergotamine")

    # create lists of nodes and edges
    V <- list(
      d1, c1, c2, c3, c4, c5, c6, c7, c8,
      ta, tb, tc, td, te, tf, tg, th, ti, tj
    )
    E <- list(
      e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16,
      e17, e18
    )

    # tree
    dt <- DecisionTree$new(V, E)

Figure 1. Decision tree for the Sumatriptan model

# Running the model

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.

# Model results

## Base case

The evaluation of each pathway, for each strategy, is done as follows:

    ep <- dt$evaluate(by = "path")

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"`.

    es <- dt$evaluate()

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).

## Univariate sensitivity analysis

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_sumatriptan_relief <- p_caffeine_relief + 0.268
    e7$set_probability(p_sumatriptan_relief)
    es <- dt$evaluate()

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_sumatriptan_relief <- p_caffeine_relief + 0.091
    e7$set_probability(p_sumatriptan_relief)
    es <- dt$evaluate()

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 | 6e-04
Sumatriptan | 21.94 | 0.3088 | 8e-04

# References

1.
Briggs, A., Claxton, K. & Sculpher, M. Decision modelling for health economic evaluation. (Oxford University Press, 2006).
2.
Evans, K. W., Boan, J. A., Evans, J. L. & Shuaib, A. Economic evaluation of oral Sumatriptan compared with oral Caffeine/Ergotamine for migraine. Pharmacoeconomics 12, 565–577 (1997).