## ----setup, include = FALSE---------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
library(dceasimR)

## ----inputs-------------------------------------------------------------------
icer            <- 28000   # £/QALY
inc_qaly        <- 0.45    # incremental QALYs per patient
inc_cost        <- 12600   # incremental cost per patient (£)
population_size <- 12000   # eligible patients in England
wtp             <- 20000   # NICE standard WTP (£/QALY)
occ_threshold   <- 13000   # opportunity cost threshold (£/QALY)

## ----baseline-----------------------------------------------------------------
baseline <- get_baseline_health("england", "imd_quintile")
baseline

## ----run-dcea-----------------------------------------------------------------
result <- run_aggregate_dcea(
  icer                       = icer,
  inc_qaly                   = inc_qaly,
  inc_cost                   = inc_cost,
  population_size            = population_size,
  disease_icd                = "C34",
  wtp                        = wtp,
  opportunity_cost_threshold = occ_threshold
)

## ----summary------------------------------------------------------------------
summary(result)

## ----by-group-----------------------------------------------------------------
result$by_group

## ----inequality---------------------------------------------------------------
result$inequality_impact

## ----plane, fig.width = 6, fig.height = 5-------------------------------------
plot_equity_impact_plane(result)

## ----ede, fig.width = 6, fig.height = 4---------------------------------------
plot_ede_profile(result, eta_range = seq(0, 10, 0.2))

## ----nice-table---------------------------------------------------------------
generate_nice_table(result, format = "tibble")

