---
title: "One-way sensitivity analyses (tornado diagrams)"
format: html
aliases:
- tornado.html
---
```{r}
#| label: read-tornado
#| include: false
tornado <- read.csv("../output/tornado_results.csv")
base <- read.csv("../output/base_case_results.csv")
money <- function(x, accuracy = 0.01) {
paste0(if (x < 0) "\u2212" else "", "$", formatC(abs(x), format = "f", digits = max(0, -log10(accuracy)), big.mark = ","))
}
qaly <- function(x, digits = 4) paste0(if (x < 0) "\u2212" else "", formatC(abs(x), format = "f", digits = digits))
varied <- tornado[tornado$range_nmb > 0, ]
varied <- varied[order(-varied$range_nmb), ]
top <- head(varied, 6)
input_value <- function(p, x) if (startsWith(p, "cost_")) money(x, 1) else format(signif(x, 3), scientific = FALSE, big.mark = ",")
crosses <- varied$parameter[(varied$nmb_difference_low > 0) != (varied$nmb_difference_high > 0)]
best <- varied[which.max(pmax(varied$nmb_difference_low, varied$nmb_difference_high)), ]
qaly_order <- tornado$parameter[order(-tornado$range_qaly)]
qaly_rank <- match("q_nocryptococcus", qaly_order)
qaly_rank_text <- if (qaly_rank == 1) "the largest driver of QALYs" else paste0(c("", "the second-largest", "the third-largest")[min(qaly_rank, 3)], if (qaly_rank > 3) paste0("ranked ", qaly_rank, " of the drivers") else " driver of QALYs")
```
The code behind these results is on the [Sensitivity analyses](sensitivity_analyses.qmd) page. [Sensitivity analyses explained](uncertainty_methods.qmd#one-way-sensitivity-analysis-and-tornado-diagrams) describes how to read a tornado diagram. All numbers are per potential donor and are read from the output of the most recent model run.
## Parameters of the model
The parameters are the same as for the [probabilistic sensitivity analysis](model_inputs.qmd#parameters-of-the-model). We utilize the means, and vary the parameters according to the 95% intervals in the appropriate tables.
## Tornado diagrams
### Tornado diagram for costs

We see that costs are most sensitive to assumptions regarding the cost of an episode of cryptococcal disease post-transplant, `cost_disease`, and the probability that a donor has cryptococcus, `p_donor_cryptococcus`.
The expected cost savings from screening, as predicted, increase (become more negative) if those parameters lie at the higher end of the 95% interval.
### Tornado diagram for QALYs

We see that QALYs are most sensitive to assumptions regarding the specificity of cryptococcal screening, `p_specificity`, because each false-positive screen in a donor without cryptococcus can lead to a cancelled transplant.
As predicted, higher values of specificity will lead to less QALY loss from screening. Probability of donor cryptococcus, `p_donor_cryptococcus` has surprisingly little effect on QALYs.
The QALY gain from a transplant, `q_nocryptococcus`, is `r qaly_rank_text`. Its range, from `r input_value("q_nocryptococcus", tornado$lb_95[tornado$parameter == "q_nocryptococcus"])` to `r input_value("q_nocryptococcus", tornado$ub_95[tornado$parameter == "q_nocryptococcus"])` QALYs, comes from the shared gamma shape parameter rather than from evidence, and its upper end is likely to be implausibly high for the gain from a single transplant; the [evidence review](../references/literature-review.md) discusses plausible values.
## Which inputs change the decision?
The decision depends on net monetary benefit, which combines cost and QALYs. The table ranks the inputs by how much net monetary benefit changes across each input's range (base case: `r money(base$nmb)` per potential donor).
| Input | Low value | High value | NMB at low value | NMB at high value |
|---|---|---|---|---|
| `r paste0("\x60", top$parameter[1], "\x60")` | `r input_value(top$parameter[1], top$lb_95[1])` | `r input_value(top$parameter[1], top$ub_95[1])` | `r money(top$nmb_difference_low[1])` | `r money(top$nmb_difference_high[1])` |
| `r paste0("\x60", top$parameter[2], "\x60")` | `r input_value(top$parameter[2], top$lb_95[2])` | `r input_value(top$parameter[2], top$ub_95[2])` | `r money(top$nmb_difference_low[2])` | `r money(top$nmb_difference_high[2])` |
| `r paste0("\x60", top$parameter[3], "\x60")` | `r input_value(top$parameter[3], top$lb_95[3])` | `r input_value(top$parameter[3], top$ub_95[3])` | `r money(top$nmb_difference_low[3])` | `r money(top$nmb_difference_high[3])` |
| `r paste0("\x60", top$parameter[4], "\x60")` | `r input_value(top$parameter[4], top$lb_95[4])` | `r input_value(top$parameter[4], top$ub_95[4])` | `r money(top$nmb_difference_low[4])` | `r money(top$nmb_difference_high[4])` |
| `r paste0("\x60", top$parameter[5], "\x60")` | `r input_value(top$parameter[5], top$lb_95[5])` | `r input_value(top$parameter[5], top$ub_95[5])` | `r money(top$nmb_difference_low[5])` | `r money(top$nmb_difference_high[5])` |
| `r paste0("\x60", top$parameter[6], "\x60")` | `r input_value(top$parameter[6], top$lb_95[6])` | `r input_value(top$parameter[6], top$ub_95[6])` | `r money(top$nmb_difference_low[6])` | `r money(top$nmb_difference_high[6])` |
`r if (length(crosses) == 0) paste0("**No single input changes the conclusion across its range.** Net monetary benefit stays negative at both ends of every input's range. The closest is ", paste0("\x60", best$parameter, "\x60"), ", where it reaches ", money(max(best$nmb_difference_low, best$nmb_difference_high)), " at one end.") else paste0("**Screening becomes cost-effective at one end of the range for: ", paste0("\x60", crosses, "\x60", collapse = ", "), ".** For every other input, the conclusion is the same across its range.")`
Two cautions apply. Each input is varied alone, so inputs that are uncertain together can move the result further than any one bar; the [probabilistic sensitivity analysis](results_psa.qmd) varies them all at once. And the width of each range comes from shared shape parameters, not from the evidence for that input, as explained on [How the inputs are chosen](model_inputs.qmd).
## Other results
- [**Base case analysis**](results_base_case.qmd): primary results and interpretation\
- [**Additional tree analyses**](results_scenarios.qmd): alternative clinical assumptions\
- [**Probabilistic sensitivity analyses**](results_psa.qmd): uncertainty and robustness\
- [**About**](about.qmd): methods, assumptions, and disclosures