Learn R Programming

hdbayes (version 0.2.0)

Bayesian Analysis of Generalized Linear Models with Historical Data

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) , normalized power prior by Duan et al. (2006) , normalized asymptotic power prior by Ibrahim et al. (2015) , commensurate prior by Hobbs et al. (2011) , robust meta-analytic-predictive prior by Schmidli et al. (2014) , latent exchangeability prior by Alt et al. (2024) , 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 ), 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.

Copy Link

Version

Install

install.packages('hdbayes')

Monthly Downloads

185

Version

0.2.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Ethan Alt

Last Published

November 15th, 2025

Functions in hdbayes (0.2.0)

aft.logml.map

Log marginal likelihood of an accelerated failure time (AFT) model under the meta-analytic predictive (MAP) prior
aft.npp

Posterior of normalized power prior (NPP)
aft.logml.npp

Log marginal likelihood of an accelerated failure time (AFT) model under normalized power prior (NPP)
aft.logml.stratified.pp

Log marginal likelihood of an accelerated failure time (AFT) model under the stratified power prior (PP)
aft.logml.post

Log marginal likelihood of an accelerated failure time (AFT) model under a normal/half-normal prior
aft.logml.commensurate

Log marginal likelihood of an accelerated failure time (AFT) model under the commensurate prior (CP)
aft.npp.lognc

Estimate the logarithm of the normalizing constant for normalized power prior (NPP) for one data set
curepwe.bhm

Posterior of Bayesian hierarchical model (BHM)
curepwe.logml.leap

Log marginal likelihood of a mixture cure rate (CurePWE) model under latent exchangeability prior (LEAP)
aft.stratified.pp

Posterior of stratified power prior (PP) with fixed \(a_0\)
aft.post

Posterior of a normal/half-normal prior
curepwe.logml.commensurate

Log marginal likelihood of a mixture cure rate (CurePWE) under the commensurate prior (CP)
curepwe.leap

Posterior of latent exchangeability prior (LEAP)
curepwe.commensurate

Posterior of commensurate prior (CP)
compute.ensemble.weights

Compute model averaging weights
aft.pp

Posterior of power prior (PP) with fixed \(a_0\)
curepwe.logml.map

Log marginal likelihood of a mixture cure rate (CurePWE) model under the meta-analytic predictive (MAP) prior
curepwe.logml.pp

Log marginal likelihood of a standard cure rate (CurePWE) model under the power prior (PP)
curepwe.logml.post

Log marginal likelihood of a mixture cure rate (CurePWE) model under a normal/half-normal prior
curepwe.pp

Posterior of power prior (PP) with fixed \(a_0\)
curepwe.npp

Posterior of normalized power prior (NPP)
curepwe.post

Posterior of a normal/half-normal prior
curepwe.stratified.pp

Posterior of stratified power prior (PP) with fixed \(a_0\)
curepwe.logml.npp

Log marginal likelihood of a mixture cure rate (CurePWE) model under normalized power prior (NPP)
curepwe.npp.lognc

Estimate the logarithm of the normalizing constant for normalized power prior (NPP) for one data set
curepwe.logml.stratified.pp

Log marginal likelihood of a mixture cure rate (CurePWE) model under the stratified power prior (PP)
glm.bhm

Posterior of Bayesian hierarchical model (BHM)
glm.napp

Posterior of normalized asymptotic power prior (NAPP)
glm.logml.pp

Log marginal likelihood of a GLM under power prior (PP)
glm.logml.map

Log marginal likelihood of a GLM under meta-analytic predictive (MAP) prior
glm.logml.npp

Log marginal likelihood of a GLM under normalized power prior (NPP)
glm.commensurate

Posterior of commensurate prior (CP)
glm.logml.leap

Log marginal likelihood of a GLM under latent exchangeability prior (LEAP)
glm.logml.commensurate

Log marginal likelihood of a GLM under commensurate prior (CP)
glm.logml.napp

Log marginal likelihood of a GLM under normalized asymptotic power prior (NAPP)
glm.leap

Posterior of latent exchangeability prior (LEAP)
glm.logml.post

Log marginal likelihood of a GLM under a normal/half-normal prior
glm.npp

Posterior of normalized power prior (NPP)
glm.rmap

Posterior of robust meta-analytic predictive prior (RMAP)
glm.pp

Posterior of power prior (PP) with fixed \(a_0\)
glm.post

Posterior of a normal/half-normal prior
lm.npp

Posterior of normalized power prior (NPP) for normal linear models
glm.npp.lognc

Estimate the logarithm of the normalizing constant for normalized power prior (NPP) for one data set
hdbayes-package

hdbayes: Bayesian Analysis of Generalized Linear Models with Historical Data
pwe.commensurate

Posterior of commensurate prior (CP)
pwe.leap

Posterior of latent exchangeability prior (LEAP)
pwe.bhm

Posterior of Bayesian hierarchical model (BHM)
pwe.logml.commensurate

Log marginal likelihood of a piecewise exponential (PWE) model under the commensurate prior (CP)
pwe.logml.post

Log marginal likelihood of a piecewise exponential (PWE) model under a normal/half-normal prior
pwe.logml.stratified.pp

Log marginal likelihood of a piecewise exponential (PWE) model under the stratified power prior (PP)
pwe.post

Posterior of a normal/half-normal prior
pwe.logml.leap

Log marginal likelihood of a piecewise exponential (PWE) model under latent exchangeability prior (LEAP)
pwe.npp.lognc

Estimate the logarithm of the normalizing constant for normalized power prior (NPP) for one data set
pwe.logml.pp

Log marginal likelihood of a piecewise exponential (PWE) model under the power prior (PP)
pwe.npp

Posterior of normalized power prior (NPP)
pwe.logml.npp

Log marginal likelihood of a piecewise exponential (PWE) model under normalized power prior (NPP)
pwe.logml.map

Log marginal likelihood of a piecewise exponential (PWE) model under the meta-analytic predictive (MAP) prior
pwe.pp

Posterior of power prior (PP) with fixed \(a_0\)
pwe.stratified.pp

Posterior of stratified power prior (PP) with fixed \(a_0\)
sample.ensemble

Sample from the ensemble posterior distribution
aft.bhm

Posterior of Bayesian hierarchical model (BHM)
actg036

AIDS Clinical Trial ACTG036
E1694

ECOG E1694 Trial
actg019

AIDS Clinical Trial ACTG019
E1690

ECOG E1690 Trial
E1684

ECOG E1684 Trial
aft.commensurate

Posterior of commensurate prior (CP)
E2696

ECOG E2696 Trial
IBCSG_curr

International Breast Cancer Study Group (IBCSG) Trial VI Data
IBCSG_hist

International Breast Cancer Study Group (IBCSG) Trial VI Data
aft.leap

Posterior of latent exchangeability prior (LEAP)
aft.logml.pp

Log marginal likelihood of an accelerated failure time (AFT) model under the power prior (PP)
aft.logml.leap

Log marginal likelihood of an accelerated failure time (AFT) model under latent exchangeability prior (LEAP)