Skip to content

brisk

Bayesian Benefit Risk Analysis

v0.1.1 · Mar 4, 2026 · MIT + file LICENSE

Description

Quantitative methods for benefit-risk analysis help to condense complex decisions into a univariate metric describing the overall benefit relative to risk. One approach is to use the multi-criteria decision analysis framework (MCDA), as in Mussen, Salek, and Walker (2007) <doi:10.1002/pds.1435>. Bayesian benefit-risk analysis incorporates uncertainty through posterior distributions which are inputs to the benefit-risk framework. The brisk package provides functions to assist with Bayesian benefit-risk analyses, such as MCDA. Users input posterior samples, utility functions, weights, and the package outputs quantitative benefit-risk scores. The posterior of the benefit-risk scores for each group can be compared. Some plotting capabilities are also included.

Downloads

826

Last 30 days

4274th

1.5K

Last 90 days

1.5K

Last year

Trend: +15.4% (30d vs prior 30d)

CRAN Check Status

2 ERROR
12 OK
Show all 14 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-macos-arm64 OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 ERROR
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 ERROR
Check details (16 non-OK)
OK r-devel-linux-x86_64-debian-clang

*


            
OK r-devel-linux-x86_64-debian-gcc

*


            
OK r-devel-linux-x86_64-fedora-clang

*


            
OK r-devel-linux-x86_64-fedora-gcc

*


            
OK r-devel-macos-arm64

*


            
OK r-devel-windows-x86_64

*


            
OK r-oldrel-macos-arm64

*


            
OK r-oldrel-macos-x86_64

*


            
OK r-oldrel-windows-x86_64

*


            
ERROR r-patched-linux-x86_64

examples

Running examples in ‘brisk-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: benefit
> ### Title: Bayesian Benefit Risk
> ### Aliases: benefit risk br mcda
> 
> ### ** 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
# A tibble: 20,000 × 11
       CV CV_weight CV_utility CV_score     DVT DVT_weight DVT_utility DVT_score
    <dbl>     <dbl>      <dbl>    <dbl>   <dbl>      <dbl>       <dbl>     <dbl>
 1  1.47       0.75      0.813    0.610  0.439        0.25       0.445    0.111 
 2  0.239      0.75      0.559    0.420 -2.12         0.25       0.743    0.186 
 3  0.969      0.75      0.725    0.544  0.974        0.25       0.381    0.0951
 4  0.655      0.75      0.658    0.494  0.0771       0.25       0.490    0.123 
 5  1.51       0.75      0.819    0.615 -0.993        0.25       0.622    0.155 
 6 -1.32       0.75      0.210    0.158 -0.874        0.25       0.607    0.152 
 7  0.395      0.75      0.598    0.448  1.03         0.25       0.375    0.0936
 8 -1.43       0.75      0.193    0.145 -0.903        0.25       0.611    0.153 
 9  0.180      0.75      0.545    0.409 -0.685        0.25       0.585    0.146 
10 -0.960      0.75      0.277    0.208 -1.50         0.25       0.679    0.170 
# ℹ 19,990 more rows
# ℹ 3 more variables: label <chr>, iter <int>, total <dbl>
> 
> summary(out, probs = c(.025, .5, .975))
Error in `dplyr::summarize()`:
ℹ In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.5,
  0.975))`.
ℹ In group 1: `label = "PBO"`.
Caused by error:
! `qtiles` must be size 1, not 3.
ℹ To return more or less than 1 row per group, use `reframe()`.
Backtrace:
     ▆
  1. ├─base::summary(out, probs = c(0.025, 0.5, 0.975))
  2. ├─brisk:::summary.brisk_br(out, probs = c(0.025, 0.5, 0.975))
  3. │ └─scores %>% dplyr::group_by(.data$label) %>% ...
  4. ├─dplyr::summarize(...)
  5. ├─dplyr:::summarise.grouped_df(...)
  6. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
  7. │   └─base::withCallingHandlers(...)
  8. ├─dplyr:::dplyr_internal_error(...)
  9. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
 10. │   └─rlang:::signal_abort(cnd, .file)
 11. │     └─base::signalCondition(cnd)
 12. └─dplyr (local) `<fn>`(`<dpl:::__>`)
 13.   └─dplyr (local) handler(cnd)
 14.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
Execution halted
ERROR r-patched-linux-x86_64

tests

  Running ‘testthat.R’ [7s/8s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > library(brisk)
  > 
  > test_check("brisk")
  Saving _problems/test-plot-26.R
  Saving _problems/test-plot-34.R
  Saving _problems/test-summary-25.R
  [ FAIL 3 | WARN 10 | SKIP 4 | PASS 32 ]
  
  ══ Skipped tests (4) ═══════════════════════════════════════════════════════════
  • On CRAN (4): 'test-plot.R:44:3', 'test-plot.R:52:3', 'test-plot.R:60:3',
    'test-plot.R:68:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-plot.R:26:3'): plot ────────────────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "PBO"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─base::plot(out) at test-plot.R:26:3
    2. ├─brisk:::plot.brisk_br(out)
    3. │ ├─base::summary(x, reference = reference)
    4. │ └─brisk:::summary.brisk_br(x, reference = reference)
    5. │   └─scores %>% dplyr::group_by(.data$label) %>% ...
    6. ├─dplyr::summarize(...)
    7. ├─dplyr:::summarise.grouped_df(...)
    8. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
    9. │   └─base::withCallingHandlers(...)
   10. ├─dplyr:::dplyr_internal_error(...)
   11. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   12. │   └─rlang:::signal_abort(cnd, .file)
   13. │     └─base::signalCondition(cnd)
   14. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   15.   └─dplyr (local) handler(cnd)
   16.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  ── Error ('test-plot.R:34:3'): plot with ref ───────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "TRT"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─base::plot(out, reference = "PBO") at test-plot.R:34:3
    2. ├─brisk:::plot.brisk_br(out, reference = "PBO")
    3. │ ├─base::summary(x, reference = reference)
    4. │ └─brisk:::summary.brisk_br(x, reference = reference)
    5. │   └─scores %>% dplyr::group_by(.data$label) %>% ...
    6. ├─dplyr::summarize(...)
    7. ├─dplyr:::summarise.grouped_df(...)
    8. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
    9. │   └─base::withCallingHandlers(...)
   10. ├─dplyr:::dplyr_internal_error(...)
   11. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   12. │   └─rlang:::signal_abort(cnd, .file)
   13. │     └─base::signalCondition(cnd)
   14. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   15.   └─dplyr (local) handler(cnd)
   16.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  ── Error ('test-summary.R:25:3'): summary() ────────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "PBO"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─testthat::expect_equal(...) at test-summary.R:25:3
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. ├─base::summary(res)
    5. ├─brisk:::summary.brisk_br(res)
    6. │ └─scores %>% dplyr::group_by(.data$label) %>% ...
    7. ├─dplyr::summarize(...)
    8. ├─dplyr:::summarise.grouped_df(...)
    9. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
   10. │   └─base::withCallingHandlers(...)
   11. ├─dplyr:::dplyr_internal_error(...)
   12. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   13. │   └─rlang:::signal_abort(cnd, .file)
   14. │     └─base::signalCondition(cnd)
   15. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   16.   └─dplyr (local) handler(cnd)
   17.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  
  [ FAIL 3 | WARN 10 | SKIP 4 | PASS 32 ]
  Deleting unused snapshots: 'plot/plot-ref.png', 'plot/plot-utility-ref.png',
  'plot/plot-utility-stacked-ref.png', 'plot/plot-utility-stacked.png',
  'plot/plot-utility.png', and 'plot/plot.png'
  Error:
  ! Test failures.
  Execution halted
OK r-release-linux-x86_64

*


            
OK r-release-macos-arm64

*


            
OK r-release-macos-x86_64

*


            
ERROR r-release-windows-x86_64

examples

Running examples in 'brisk-Ex.R' failed
The error most likely occurred in:

> ### Name: benefit
> ### Title: Bayesian Benefit Risk
> ### Aliases: benefit risk br mcda
> 
> ### ** 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
# A tibble: 20,000 × 11
       CV CV_weight CV_utility CV_score     DVT DVT_weight DVT_utility DVT_score
    <dbl>     <dbl>      <dbl>    <dbl>   <dbl>      <dbl>       <dbl>     <dbl>
 1  1.47       0.75      0.813    0.610  0.439        0.25       0.445    0.111 
 2  0.239      0.75      0.559    0.420 -2.12         0.25       0.743    0.186 
 3  0.969      0.75      0.725    0.544  0.974        0.25       0.381    0.0951
 4  0.655      0.75      0.658    0.494  0.0771       0.25       0.490    0.123 
 5  1.51       0.75      0.819    0.615 -0.993        0.25       0.622    0.155 
 6 -1.32       0.75      0.210    0.158 -0.874        0.25       0.607    0.152 
 7  0.395      0.75      0.598    0.448  1.03         0.25       0.375    0.0936
 8 -1.43       0.75      0.193    0.145 -0.903        0.25       0.611    0.153 
 9  0.180      0.75      0.545    0.409 -0.685        0.25       0.585    0.146 
10 -0.960      0.75      0.277    0.208 -1.50         0.25       0.679    0.170 
# ℹ 19,990 more rows
# ℹ 3 more variables: label <chr>, iter <int>, total <dbl>
> 
> summary(out, probs = c(.025, .5, .975))
Error in `dplyr::summarize()`:
ℹ In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.5,
  0.975))`.
ℹ In group 1: `label = "PBO"`.
Caused by error:
! `qtiles` must be size 1, not 3.
ℹ To return more or less than 1 row per group, use `reframe()`.
Backtrace:
     ▆
  1. ├─base::summary(out, probs = c(0.025, 0.5, 0.975))
  2. ├─brisk:::summary.brisk_br(out, probs = c(0.025, 0.5, 0.975))
  3. │ └─scores %>% dplyr::group_by(.data$label) %>% ...
  4. ├─dplyr::summarize(...)
  5. ├─dplyr:::summarise.grouped_df(...)
  6. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
  7. │   └─base::withCallingHandlers(...)
  8. ├─dplyr:::dplyr_internal_error(...)
  9. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
 10. │   └─rlang:::signal_abort(cnd, .file)
 11. │     └─base::signalCondition(cnd)
 12. └─dplyr (local) `<fn>`(`<dpl:::__>`)
 13.   └─dplyr (local) handler(cnd)
 14.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
Execution halted
ERROR r-release-windows-x86_64

tests

  Running 'testthat.R' [5s]
Running the tests in 'tests/testthat.R' failed.
Complete output:
  > library(testthat)
  > library(brisk)
  > 
  > test_check("brisk")
  Saving _problems/test-plot-26.R
  Saving _problems/test-plot-34.R
  Saving _problems/test-summary-25.R
  [ FAIL 3 | WARN 10 | SKIP 4 | PASS 32 ]
  
  ══ Skipped tests (4) ═══════════════════════════════════════════════════════════
  • On CRAN (4): 'test-plot.R:44:3', 'test-plot.R:52:3', 'test-plot.R:60:3',
    'test-plot.R:68:3'
  
  ══ Failed tests ════════════════════════════════════════════════════════════════
  ── Error ('test-plot.R:26:3'): plot ────────────────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "PBO"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─base::plot(out) at test-plot.R:26:3
    2. ├─brisk:::plot.brisk_br(out)
    3. │ ├─base::summary(x, reference = reference)
    4. │ └─brisk:::summary.brisk_br(x, reference = reference)
    5. │   └─scores %>% dplyr::group_by(.data$label) %>% ...
    6. ├─dplyr::summarize(...)
    7. ├─dplyr:::summarise.grouped_df(...)
    8. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
    9. │   └─base::withCallingHandlers(...)
   10. ├─dplyr:::dplyr_internal_error(...)
   11. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   12. │   └─rlang:::signal_abort(cnd, .file)
   13. │     └─base::signalCondition(cnd)
   14. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   15.   └─dplyr (local) handler(cnd)
   16.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  ── Error ('test-plot.R:34:3'): plot with ref ───────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "TRT"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─base::plot(out, reference = "PBO") at test-plot.R:34:3
    2. ├─brisk:::plot.brisk_br(out, reference = "PBO")
    3. │ ├─base::summary(x, reference = reference)
    4. │ └─brisk:::summary.brisk_br(x, reference = reference)
    5. │   └─scores %>% dplyr::group_by(.data$label) %>% ...
    6. ├─dplyr::summarize(...)
    7. ├─dplyr:::summarise.grouped_df(...)
    8. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
    9. │   └─base::withCallingHandlers(...)
   10. ├─dplyr:::dplyr_internal_error(...)
   11. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   12. │   └─rlang:::signal_abort(cnd, .file)
   13. │     └─base::signalCondition(cnd)
   14. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   15.   └─dplyr (local) handler(cnd)
   16.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  ── Error ('test-summary.R:25:3'): summary() ────────────────────────────────────
  Error in `dplyr::summarize(., mean = mean(.data$total), qtiles = safe_quantile(.data$total, prob = !!probs))`: i In argument: `qtiles = safe_quantile(.data$total, prob = c(0.025, 0.975))`.
  i In group 1: `label = "PBO"`.
  Caused by error:
  ! `qtiles` must be size 1, not 2.
  i To return more or less than 1 row per group, use `reframe()`.
  Backtrace:
       ▆
    1. ├─testthat::expect_equal(...) at test-summary.R:25:3
    2. │ └─testthat::quasi_label(enquo(object), label)
    3. │   └─rlang::eval_bare(expr, quo_get_env(quo))
    4. ├─base::summary(res)
    5. ├─brisk:::summary.brisk_br(res)
    6. │ └─scores %>% dplyr::group_by(.data$label) %>% ...
    7. ├─dplyr::summarize(...)
    8. ├─dplyr:::summarise.grouped_df(...)
    9. │ └─dplyr:::summarise_cols(.data, dplyr_quosures(...), by, "summarise")
   10. │   └─base::withCallingHandlers(...)
   11. ├─dplyr:::dplyr_internal_error(...)
   12. │ └─rlang::abort(class = c(class, "dplyr:::internal_error"), dplyr_error_data = data)
   13. │   └─rlang:::signal_abort(cnd, .file)
   14. │     └─base::signalCondition(cnd)
   15. └─dplyr (local) `<fn>`(`<dpl:::__>`)
   16.   └─dplyr (local) handler(cnd)
   17.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
  
  [ FAIL 3 | WARN 10 | SKIP 4 | PASS 32 ]
  Deleting unused snapshots: 'plot/plot-ref.png', 'plot/plot-utility-ref.png',
  'plot/plot-utility-stacked-ref.png', 'plot/plot-utility-stacked.png',
  'plot/plot-utility.png', and 'plot/plot.png'
  Error:
  ! Test failures.
  Execution halted

Check History

ERROR 12 OK · 0 NOTE · 0 WARNING · 2 ERROR · 0 FAILURE Mar 9, 2026
ERROR r-patched-linux-x86_64

examples

Running examples in ‘brisk-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: benefit
> ### Title: Bayesian Benefit Risk
> ### Aliases: benefit risk br mcda
> 
> ### ** 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)
ERROR r-release-windows-x86_64

examples

Running examples in 'brisk-Ex.R' failed
The error most likely occurred in:

> ### Name: benefit
> ### Title: Bayesian Benefit Risk
> ### Aliases: benefit risk br mcda
> 
> ### ** 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(
+     la

Dependency Network

Dependencies Reverse dependencies dplyr ggplot2 hitandrun purrr rlang tidyr brisk

Version History

new 0.1.1 Mar 9, 2026