benefit | R Documentation |
Bayesian Benefit Risk
benefit(name, fun, weight) risk(name, fun, weight) br(...) mcda(...)
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 |
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.
A named list with posterior summaries of utility for each group and the raw posterior utility scores.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.