R Observatory
Search
install.packages("bayprior")
CRAN 30-day downloads, method
449+9.5% up on the 30 days before, the better direction
Test coverage, method
34%of lines run by tests

A toolkit for constructing, validating, and justifying Bayesian priors in clinical trial settings. Implements expert elicitation via quantile matching, the roulette method, and moment matching across six distribution families, linear and logarithmic expert pooling, meta-analytic-predictive (MAP) ...

Full description

A toolkit for constructing, validating, and justifying Bayesian priors in clinical trial settings. Implements expert elicitation via quantile matching, the roulette method, and moment matching across six distribution families, linear and logarithmic expert pooling, meta-analytic-predictive (MAP) priors derived from historical trials, prior-data conflict diagnostics including the Box p-value (computed from the exact prior predictive distribution where one has a closed form), an exploratory surprisal (S-value) companion to it, surprise index, information divergence, and Mahalanobis distance, sensitivity analyses with tornado and influence heatmap plots, sceptical, robust, and power priors, and automated prior justification reports. Includes a fully modular 'Shiny' application for interactive use. Methods based on O'Hagan et al. (2006, ISBN:9780470029886), Box (1980) <doi:10.2307/2982063>, Greenland (2023) <doi:10.1111/sjos.12625>, Oakley and O'Hagan (2010) <https://tonyohagan.co.uk/shelf/>, Schmidli et al. (2014) <doi:10.1111/biom.12242>, Neuenschwander et al. (2010) <doi:10.1177/1740774509356002>, Roever et al. (2021) <doi:10.1002/jrsm.1475>, Ibrahim and Chen (2000) <doi:10.1214/ss/1009212673>, Spiegelhalter et al. (1994) <doi:10.2307/2983527>.

Maintainer
Ndoh Penn
Licence
GPL-3
Latest release
20 Oct 2026
First release
3 Jun 2026

Compare with another package

More details
Releases
5
Needs compilation
No
Needs R
>= 4.1.0
Config/Needs/vignettes
knitr, rmarkdown, rstanarm, brms
Config/testthat/edition
3
Language
en-GB
RoxygenNote
7.3.3
SystemRequirements
Quarto CLI (>= 1.5, https://quarto.org)
Subjects (1) Method, Subjects
Cite

Package

Run in R for the authors' preferred citation:

citation("bayprior")

The package provides a citation file that builds its entry when R runs it. Run citation() to see it.

R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA
Balamuta, J. J. (2026). R Observatory: Metrics for bayprior version 0.5.0 [Data set]. HJJB, LLC. Data release v2026-10-28. https://doi.org/10.5281/zenodo.21843040
About

From data release v2026-10-28, which the citation names so these numbers can be found later.

All 13 check platforms pass.

  • r-devel-linux-x86_64-debian-clang

    The unreleased R on Linux, x86_64, debian-clang

    OK

    Version checked
    0.5.0
    Time taken
    308 s
  • r-devel-linux-x86_64-debian-gcc

    The unreleased R on Linux, x86_64, debian-gcc

    OK

    Version checked
    0.5.0
    Time taken
    268 s
  • r-devel-linux-x86_64-fedora-clang

    The unreleased R on Linux, x86_64, fedora-clang

    OK

    Version checked
    0.5.0
    Time taken
    181 s
  • r-devel-linux-x86_64-fedora-gcc

    The unreleased R on Linux, x86_64, fedora-gcc

    OK

    Version checked
    0.5.0
    Time taken
    226 s
  • r-devel-windows-x86_64

    The unreleased R on Windows, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    318 s
  • r-oldrel-macos-arm64

    The previous release of R on macOS, arm64

    OK

    Version checked
    0.5.0
    Time taken
    100 s
  • r-oldrel-macos-x86_64

    The previous release of R on macOS, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    460 s
  • r-oldrel-windows-x86_64

    The previous release of R on Windows, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    404 s
  • r-patched-linux-x86_64

    The patched release of R on Linux, x86_64

    OK

    Version checked
    0.4.0
    Time taken
    313 s
  • r-release-linux-x86_64

    The current release of R on Linux, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    327 s
  • r-release-macos-arm64

    The current release of R on macOS, arm64

    OK

    Version checked
    0.5.0
    Time taken
    71 s
  • r-release-macos-x86_64

    The current release of R on macOS, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    524 s
  • r-release-windows-x86_64

    The current release of R on Windows, x86_64

    OK

    Version checked
    0.5.0
    Time taken
    318 s
  • 13 OK

Over time

No change since 5 Aug 2026

As a list (5)
ChangedWorst statusOKNotesWarningsErrors
5 Aug 2026OK13000
1 Aug 2026Note12100
9 Jun 2026OK12000
8 Jun 2026Error11001
4 Jun 2026OK6000

Since March 2026

Check results on CRAN

Total downloads in the last 30 days
488+3.6% up on the 30 days before, the better directionIt is the sum of 3 channels: CRAN, r2u and autoCRAN.

CRAN rank

7,131 of 26,530

CRAN

449 downloads in the last 30 days

Rank
7,131 of 26,530
Change
+9.5% up on the 30 days before, the better direction

It is in the total. Take it out

r2u

11 downloads in the last 30 days

Rank
6,263 of 30,526
Change
−54.2% down on the 30 days before, the worse direction

It is in the total. Take it out

autoCRAN

28 downloads in the last 30 days

Rank
1,469 of 29,212
Change
−24.3% down on the 30 days before, the worse direction

It is in the total. Take it out

Over time

Compare downloads

Needs
16
Dependent packages
0
Suggested by
0
Needs (16)
Installing it adds
77 packages, 73.8 MB of source
Of those, need compilation
38
Optional extras (13)
Functions
124
Public exports
26
Lines of R code
9,330
Median complexity
3
Functions (124)
Size and composition

Lines by kind (18,062)

KindLinesShare
R code9,33052%
Tests4,05922%
Documentation2,05411%
Guides2,61915%

Lines by language

LanguageLinesShare
R13,38974%
Vignettes2,61915%
Rd2,05411%

Languages are counted from file extensions.

Files
138
R functions
124
Object systems
S3: 8 methods
Complexity
Median
3
Mean
5.77
Highest
36
Median lines per function
29
About complexity

Cyclomatic complexity counts the independent paths through a function: 1 is a straight line, higher is harder to test. R functions only.

Call graph figures
R functions
124
Calls
172
Unconnected
9
Groups
4
Growth (5 releases)
Total lines by release
13,112 on 3 Jun 202618,062 on 20 Oct 2026
Release changes

The tests ran and coverage was measured.

Lines run by tests
34.2%
Expressions run by tests
55%
Test cases
330
Exports named in tests
96.2%
Coverage by file (24)
Coverage run
Lines counted
5,945
Lines the tests ran
2,035
Tests passed
Yes
Measured with
covr 3.6.5 on R 4.6.1
Test suite
Has tests
Yes
Test frameworks
testthat
Test cases
330
Snapshot tests
11
Lines of tests
4,059
Test lines per line of code
0.52
Exports documented
100%
Arguments documented
98.7%
Return value documented
100%
Help pages with examples
61.1%
Examples run in checks
100%
Guides (7)
Other documentation
README
Yes, 1,597 words
Release notes file
Yes
Help pages
36
Lines of documentation
2,054
  • Ndoh Penn

    Maintainer since 0.2.12 (2026), author

ndohpenngit / bayprior on github.com

Stars
2no change on 30 days ago
Forks
0
Open issues
3
Last commit
24 Oct 2026
Activity
Commits
303
Open pull requests
0
Tagged releases
16
Latest tagged release
v0.5.0, 21 Oct 2026
In development
Default branch at 0.5.0.9000, ahead of CRAN 0.5.0 (checked 2026-10-25)
Issues closed in
1 day (median)
Pull requests closed in
0 days (median)
Pull requests merged
98%
Created
24 Apr 2026
Licence file reads as
–
Development practices (11)
KindFound
Continuous integrationGitHub Actions, R CMD check workflow
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Governance and communityCode of conduct, Issue templates, PR template
Docs sourceQuarto project
GitHub Pages site last deployed 2026-10-24
The repository has a site deploy workflow
CoverageCoverage reporting (Codecov)
CRAN release processcran-comments.md
Lint, format, editorRStudio project

Method, repository practices

Across ndohpenngit

R releases
  • On CRAN
  • Release
VersionReleasedR
0.5.0 current20 Oct 20264.6.1
0.4.010 Oct 20264.6.1
0.3.219 Aug 20264.6.1
0.3.030 Jul 20264.6.1
0.2.123 Jun 20264.6.0
Release notes (0.5.0)

Changes to default behaviour

  • prior_conflict() now computes box_pvalue (and the s_value derived from it) from the exact prior predictive distribution by default wherever a closed form exists: Beta-Binomial (Beta prior, type = "binary") and Gamma-Poisson / Negative Binomial (Gamma prior, type = "poisson" or "survival"). The exact argument now defaults to NULL (exact where available, silent fallback to the Normal approximation otherwise); exact = TRUE additionally messages on fallback and exact = FALSE reproduces the Normal-approximation results of 0.4.0 and earlier. The exact check requires whole-number counts (and, for binary data, a whole-number sample size); otherwise the Normal approximation is used. $box_pvalue_method reports which was used. Reason: a simulation study (see validation/) found that the Normal approximation, whose standard error is estimated from the observed proportion or count, can reject far more often than its nominal level when there is no prior-data conflict, for informative priors and small samples. For example, for a Beta(5, 45) prior with n = 10 and no conflict, the approximation flagged conflict in about 39% of simulated datasets at the 5% level, because zero observed events (probable under the prior) yield a zero standard error and a small approximate p-value. The exact version's rejection rate stayed at or below the nominal level in all simulated settings. Results for moderate samples and weakly informative priors are essentially unchanged.
  • The prior predictive p-value now also covers mixture priors (e.g. robust_prior(), and linear pooling from aggregate_experts()): the predictive is the weighted mixture of the component predictives, exact for Beta (binary) or Gamma (Poisson/survival) components. Other proper priors (Normal, lognormal, Weibull, exponential, or a Normal vague component) are handled by equal-probability quadrature over the prior, truncated to the parameter space; $box_pvalue_method is then "numerical". The definition of the p-value is the same throughout (total predictive probability of outcomes no more probable than the observed one). In the simulation (validation/sim_mixture.R), pooled-consensus mixtures with the Normal approximation rejected up to 43% of the time at the 5% level under no conflict; the prior predictive version never exceeded 5%. For lognormal, Weibull and exponential priors on a rate (validation/ sim_numerical.R, 84 cells) the numerical p-value never exceeded the nominal level either (the approximation reached 63%). At equal size, the prior predictive p-value has the same average power as the old approximation, but less power against downward shifts for skewed priors (validation/sim_power.R; see REPORT_boxp.md for the full comparison).
  • New field $box_pvalue_caution on prior_conflict() results: set when the Normal approximation produced the p-value for discrete data with zero or all events, or fewer than 10 events or non-events. Shown in print() and in the app.
  • conflict_severity is now classified on the reported box_pvalue: "severe" below 2 * pnorm(-3) (about 0.0027), "mild" below alpha. This equals the earlier rule (surprise_index >= 3) whenever the Normal approximation is used, and avoids mixing an exact p-value with an approximate distance otherwise.
  • Shiny app (Conflict module): the "exact prior predictive" option is now on by default; unchecking it uses the Normal approximation throughout.

New features

  • plot_sensitivity() and plot_tornado() gain an interactive argument. The default (FALSE) returns a ggplot object exactly as before; interactive = TRUE returns a plotly object with readable tooltips (rounded values and parameter labels instead of raw column names) and, for the tornado plot, an explicit title and subtitle.

Shiny app

  • Sensitivity module: plots are interactive with formatted tooltips, the range sliders no longer show tick marks, a note is shown when the prior is a mixture (the analysis uses a moment-matched working prior), and the "Analysis type" and outcome buttons clearly distinguish the selected option.
  • Dark mode: plotly plots are now recoloured natively instead of through a CSS colour-inversion filter, so plot colours and hover labels are correct and plots no longer flash light after an analysis is run.