benefit {brisk}R Documentation

Bayesian Benefit Risk

Description

Bayesian Benefit Risk

Usage

benefit(name, fun, weight)

risk(name, fun, weight)

br(...)

mcda(...)

Arguments

name

a string indicating the name of the benefit or risk.

fun

a utility function which maps a parameter value to a utility value.

weight

the weight of the benefit/risk.

...

calls to benefit(), risk(), and br_group() to define the utility functions and treatment groups.

Details

The br() function allows the user to define an arbitrary number of "benefits" and "risks". Each benefit/risk requires a utility function (fun) and a weight. The utility function maps the benefit/risk parameter to a utility score. The br_group() function supplies samples from the posterior distribution for each benefit risk for a specific group (e.g. treatment arm).

The br() function then calculates the posterior distribution of the overall utility for each group. The overall utility is a weighted sum of the utilities for each benefit/risk.

The mcda() function is the same as br(), but has extra checks to ensure that the total weight of all benefits and risks is 1, and that the utility functions produce values between 0 and 1 for all posterior samples.

Value

A named list with posterior summaries of utility for each group and the raw posterior utility scores.

Examples

set.seed(1132)
ilogit <- function(x) 1 / (1 + exp(-x))
out <- mcda(
  benefit("CV", function(x) ilogit(x), weight = .75),
  risk("DVT", function(x) ilogit(- .5 * x), weight = .25),
  br_group(
    label = "PBO",
    CV = rnorm(1e4, .1),
    DVT = rnorm(1e4, .1)
  ),
  br_group(
    label = "TRT",
    CV = rnorm(1e4, 2),
    DVT = rnorm(1e4, 1)
  )
)

out

summary(out, probs = c(.025, .5, .975))
summary(out, reference = "PBO")

plot(out)
plot(out, reference = "PBO")

plot_utility(out)
plot_utility(out, reference = "PBO")
plot_utility(out, stacked = TRUE)

[Package brisk version 0.1.0 Index]