Skip to content

hdbayes

Bayesian Analysis of Generalized Linear Models with Historical Data

v0.2.0 · Nov 15, 2025 · MIT + file LICENSE

Description

User-friendly functions for leveraging (multiple) historical data set(s) in Bayesian analysis of generalized linear models (GLMs) and survival models, along with support for Bayesian model averaging (BMA). The package provides functions for sampling from posterior distributions under various informative priors, including the prior induced by the Bayesian hierarchical model, power prior by Ibrahim and Chen (2000) <doi:10.1214/ss/1009212673>, normalized power prior by Duan et al. (2006) <doi:10.1002/env.752>, normalized asymptotic power prior by Ibrahim et al. (2015) <doi:10.1002/sim.6728>, commensurate prior by Hobbs et al. (2011) <doi:10.1111/j.1541-0420.2011.01564.x>, robust meta-analytic-predictive prior by Schmidli et al. (2014) <doi:10.1111/biom.12242>, latent exchangeability prior by Alt et al. (2024) <doi:10.1093/biomtc/ujae083>, and a normal (or half-normal) prior. The package also includes functions for computing model averaging weights, such as BMA, pseudo-BMA, pseudo-BMA with the Bayesian bootstrap, and stacking (Yao et al., 2018 <doi:10.1214/17-BA1091>), as well as for generating posterior samples from the ensemble distributions to reflect model uncertainty. In addition to GLMs, the package supports survival models including: (1) accelerated failure time (AFT) models, (2) piecewise exponential (PWE) models, i.e., proportional hazards models with piecewise constant baseline hazards, and (3) mixture cure rate models that assume a common probability of cure across subjects, paired with a PWE model for the non-cured population. Functions for computing marginal log-likelihoods under each implemented prior are also included. The package compiles all the 'CmdStan' models once during installation using the 'instantiate' package.

Downloads

CRAN

293

Last 30 days

15345th

692

Last 90 days

2.6K

Last year

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

r2u CRAN

24

Last 30 days

116

Last 90 days

433

Last year

Trend: -41.5% (30d vs prior 30d)

autoCRAN

4

Last 7 days

14

Last 30 days

1

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

CRAN Check Status

13 OK
Show all 13 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-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 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 12 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Apr 25, 2026
NOTE 11 OK · 3 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026
NOTE r-oldrel-macos-arm64

package dependencies

Package suggested but not available for checking: ‘cmdstanr’
NOTE r-oldrel-macos-x86_64

package dependencies

Package suggested but not available for checking: ‘cmdstanr’
NOTE r-oldrel-windows-x86_64

package dependencies

Package suggested but not available for checking: 'cmdstanr'

Code

Structure

Lines of code

27,821

Files

259

Compiled share

0%

Has compiled src

No

Language breakdown

R 17,309 (62.2%)Docs 7,501 (27%)Vignettes 3,011 (10.8%)

API

Exported functions

64

Internal functions

78

Recent export changes

v0.2.0+47 aft.bhm, aft.commensurate, aft.leap +44 more
v0.1.1+8 glm.logml.commensurate, glm.logml.leap, glm.logml.map +5 more  −2 glm.rmap.bhm, glm.rmap.bhm.approx

Testing & CI

Has tests

No

Test-to-code ratio

0.00

testthat edition

CI present

No

CI type

[]

PR gated

No

Docs

Return-value doc rate

100%

\dontrun example ratio

14.1%

Roxygen coverage

100%

Has pkgdown

No

NEWS present

Yes

Health & Security signals

Informational signals; not verdicts.

on.exit coverage

Unsafe pattern score

0

Dep constraint coverage

10%

Secret pattern count

0

Bundled 3rd-party code

2 items

Portability & License

Min R version

4.2.0

System requirements

1

C++ standard

License

MIT + file LICENSE

License flags

SPDX valid, OSI approved

History

Versions

3

First release

2024-04-08

Latest release

2025-11-15

Avg cadence

293 days

Cold removal rate

100%

Dep drift

3

LOC over versions

v0.0.3: 3,724 LOCv0.1.1: 8,851 LOCv0.2.0: 27,821 LOC

Per-file churn detail lives in the source pipeline: https://github.com/r-observatory/cran-code-metrics.

Dependency Network

Dependencies Reverse dependencies instantiate callr fs formula.tools posterior enrichwith bridgesampling mvtnorm loo hdbayes

Version History

4 tracked
new 0.2.0 Mar 10, 2026
updated 0.2.0 ← 0.1.1 diff Nov 14, 2025
updated 0.1.1 ← 0.0.3 diff Aug 22, 2024
new 0.0.3 Apr 7, 2024