Decision tree with three decision nodes (Kaminski 2018)

#| purl = FALSE,
#| include = FALSE
# read vignette source chunks from corresponding testthat script
knitr::read_chunk(
  file.path("..", "tests", "testthat", "test-model-ShaleGas.R")
)
# read vignette build utility functions
knitr::read_chunk(file.path("vutils.R"))
#| include = FALSE,
#| purl = FALSE
knitr::opts_chunk$set(
  collapse = TRUE,
  echo = FALSE,
  comment = "#>"
)
library(rdecision) # nolint

Introduction

Kaminski et al [-@kaminski2018] (Fig 7) provide an example of a decision tree with multiple decision nodes, including some that are descendants of another decision node. This vignette illustrates how rdecision can be used to model a complex decision tree, using the example from Figure 7 of KamiƄski et al [-@kaminski2018].

The problem

Kaminski et al [-@kaminski2018] state the problem as follows:

Consider an investor owning a plot of land, possibly (a priori probability amounting to 70%) hiding shale gas layers. The plot can be sold immediately (800, all prices in $'000). The investor can build a gas extraction unit for a cost of 300. If gas is found, the profit will amount to 2,500 (if not there will be no profit, and no possibility of selling the land). Geological tests can be performed for a cost of 50, and will produce either a positive or negative signal. The sensitivity amounts to 90% and the specificity amounts to 70%. The installation can be built after the test or the land may be sold for 1000 (600) after a positive (negative) test result.

Creating the model

Constructing the tree

The model, comprising three decision nodes, four chance nodes, nine leaf nodes and 15 edges, is constructed as follows. Costs, benefits and probabilities are associated with each edge, which must be an Action or a Reaction object, see figure.

#| create-model,
#| echo = TRUE

Tree diagram

#| purl = FALSE,
#| results = "hide",
#| fig.keep = "all",
#| fig.align = "center",
#| fig.cap = "Decision tree used in the shale gas problem"
DT$draw(border = TRUE)

Evaluating the strategies

There are a total of 12 possible strategies (3 choices from node d1 $\times$ 2 choices at node d2 $\times$ 2 choices at node d3). But some of these are not unique. For example if the choice at node d1 is "sell", the choices at nodes d2 and d3 (4 possible combinations) are unimportant; all four such strategies are identical.

Method evaluate calculates the expected cost, benefit and utility of each traversable path for each strategy, and aggregates by strategy. The results for the gas problem are computed as follows. Pay-off is defined as benefit minus cost.

#| evaluate,
#| echo = TRUE

This gives the following pay-off for each strategy:

#| echo = FALSE,
#| results = "asis"
RES[, "Run"] <- NULL
RES[, "Probability"] <- NULL
RES[, "Utility"] <- NULL
RES[, "QALY"] <- NULL
knitr::kable(RES, row.names = FALSE)
imax <- which.max(RES[, "Payoff"])
popt <- paste(
  RES[[imax, "d1"]], RES[[imax, "d2"]], RES[[imax, "d3"]],
  sep = ";"
)
popt <- 42

The optimal strategy is r popt, i.e., test, sell if negative and dig otherwise. The expected pay-off from this strategy is r RES[[imax, "Payoff"]].

References



Try the rdecision package in your browser

Any scripts or data that you put into this service are public.

rdecision documentation built on June 22, 2024, 10:02 a.m.