glmbayes: Bayesian Generalized Linear Models (IID Samples)

Provides Bayesian linear and generalized linear model fitting with independent and identically distributed (iid) posterior samples. The main functions mirror R's lm() and glm() interfaces while adding prior family specifications for Gaussian, Poisson, binomial, and Gamma models with log-concave likelihoods. Sampling for supported non-conjugate models uses accept-reject methods based on likelihood subgradients as in Nygren and Nygren (2006) <doi:10.1198/016214506000000357>. The package also includes tools for prior setup, posterior summaries, prediction, diagnostics, simulation, vignettes, and optional 'OpenCL' acceleration for larger models.

Version: 0.9.6
Depends: MASS, R (≥ 3.5.0)
Imports: stats, coda, Rcpp (≥ 1.1.1), RcppParallel, Rdpack (≥ 0.11-0), opencltools (≥ 0.8.1)
LinkingTo: Rcpp, RcppArmadillo, RcppParallel
Suggests: knitr, rmarkdown, ggplot2, bayesrules, bayestestR, LearnBayes, testthat (≥ 3.0.0), spelling
Published: 2026-06-21
DOI: 10.32614/CRAN.package.glmbayes
Author: Kjell Nygren [aut, cre], The R Core Team [ctb, cph] (R Mathlib sources, R stats modeling code, and derived/adapted routines), The R Foundation [cph] (Portions of R Mathlib and R source code), Ross Ihaka [ctb, cph] (R Mathlib and original R modeling infrastructure), Robert Gentleman [ctb, cph] (Portions of R Mathlib), Simon Davies [ctb] (Original R glm implementation), Morten Welinder [ctb, cph] (Portions of R Mathlib), Martin Maechler [ctb] (Portions of R Mathlib)
Maintainer: Kjell Nygren <kjell.a.nygren at gmail.com>
BugReports: https://github.com/knygren/glmbayes/issues
License: GPL-2
Copyright: see file COPYRIGHTS
URL: https://CRAN.R-project.org/package=glmbayes, https://github.com/knygren/glmbayes, https://knygren.r-universe.dev/glmbayes
NeedsCompilation: yes
SystemRequirements: Optional OpenCL support. If available, GPU acceleration will be used; otherwise, computation runs on CPU.
Language: en-US
Citation: glmbayes citation info
Materials: README, NEWS
CRAN checks: glmbayes results

Documentation:

Reference manual: glmbayes.html , glmbayes.pdf
Vignettes: Chapter 00: Introduction (source, R code)
Chapter 01: Getting started with glmbayes (source, R code)
Chapter 02-S01: Conjugate Models — Introduction and Overview (source, R code)
Chapter 02-S02: Normal–Normal Conjugacy for One Mean (source, R code)
Chapter 02-S03: Beta–Binomial Conjugacy for One Proportion (source, R code)
Chapter 02-S04: Gamma–Poisson Conjugacy for One Count Rate (source, R code)
Chapter 02-S05: Gamma–Gamma Conjugacy for One Response Rate (source, R code)
Chapter 03: Estimating Bayesian linear models (source, R code)
Chapter 04: Tailoring priors — leveraging the Prior_Setup function (source, R code)
Chapter 05: Model predictions and posterior predictive checks (+ bayesplot ppc_*) (source, R code)
Chapter 06: Deviance residuals, model statistics and posterior inference (+ bayestestR) (source, R code)
Chapter 07: Foundations of GLMs — families, links, and log-concave likelihoods (source)
Chapter 08: Estimating Bayesian generalized linear models (source, R code)
Chapter 09: Models for the Binomial family (source, R code)
Chapter 10: Models for the Poisson family (source, R code)
Chapter 11: Models for the Gamma family (source, R code)
Chapter 12: Visualizing posteriors with bayesplot (source, R code)
Chapter 13: Bayesian inference and decision making with bayestestR (source, R code)
Chapter 14: Informative priors — centering and differential prior weights (source, R code)
Chapter 15: Estimating models with unknown dispersion parameters (source, R code)
Chapter 16: Large models — GPU acceleration using OpenCL (source, R code)
Chapter 17: Linear mixed-effects models (source, R code)
Chapter 18: Generalized linear mixed-effects models (source, R code)
Chapter A01: A detailed overview of the glmbayes package (source, R code)
Chapter A02: Overview of Estimation Procedures (source, R code)
Chapter A03: Methods available in glmbayes (source, R code)
Chapter A04: Directional Tail Diagnostics for Prior-Posterior Disagreement (source, R code)
Chapter A05: Simulation Methods - Likelihood Subgradient Densities (source, R code)
Chapter A06: Accept–Reject Sampling for Dispersion in Gamma Regression (source, R code)
Chapter A07: Accept–Reject Sampling for gaussian Regression models with independent normal-gamma priors (source, R code)
Chapter A08: Overview of Envelope Related Functions (source, R code)
Chapter A09: Parallel Sampling Implementation using RcppParallel (source, R code)
Chapter A10: Accelerated EnvelopeBuild Implementation using OpenCL (source, R code)
Chapter A11: Implementation Companion for Independent Normal-Gamma (source, R code)
Chapter A12: Technical Derivations for Priors Returned by 'Prior_Setup() (source, R code)

Downloads:

Package source: glmbayes_0.9.6.tar.gz
Windows binaries: r-devel: glmbayes_0.9.5.zip, r-release: glmbayes_0.9.6.zip, r-oldrel: glmbayes_0.9.6.zip
macOS binaries: r-release (arm64): glmbayes_0.9.6.tgz, r-oldrel (arm64): glmbayes_0.9.6.tgz, r-release (x86_64): glmbayes_0.9.6.tgz, r-oldrel (x86_64): glmbayes_0.9.6.tgz
Old sources: glmbayes archive

Reverse dependencies:

Reverse suggests: nmathopencl, opencltools

Linking:

Please use the canonical form https://CRAN.R-project.org/package=glmbayes to link to this page.