Chapter 00: Introduction

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(glmbayes)

Chapter 00: Introduction

This vignette introduces glmbayes, a package for fitting Bayesian generalized linear models via efficient envelope-based sampling. The vignette series is organized into five main parts and a set of technical appendices. You will move from basic installation and first models, through linear and generalized linear models (with optional bayestestR summaries and external bayesplot graphics), to advanced prior structures, dispersion modeling, and GPU-accelerated computation. The appendices document the underlying simulation methods and implementation details. The envelope sampling methodology builds on the likelihood subgradient framework of [@Nygren2006].

Part 1: An Introduction

These chapters provide a high-level overview of the package, its design philosophy, conjugate Bayesian building blocks for single parameters, and the basic workflow for fitting Bayesian linear and generalized linear models.

Part 2: Bayesian regression models

This part focuses on Bayesian linear regression (Gaussian family, identity link): model fitting with lmb(), tailoring priors via Prior_Setup(), and tools for predictions, posterior predictive checks (optional bayesplot; see legacy_code/), deviance residuals, and model comparison.

Part 3: Generalized Linear Models

This part presents Bayesian GLMs across the major likelihood families, including Binomial, quasi-Binomial, Poisson, quasi-Poisson, and Gamma models. It emphasizes link functions, log-concavity, and practical posterior interpretation, then shows how to summarize posterior distributions with bayestestR and optionally visualize fits with bayesplot (install separately; Chapter 12 code is commented out).

Part 4: Advanced Topics

These chapters explore more complex modeling scenarios and computational strategies, including informative priors, unknown dispersion parameters, linear and generalized linear mixed-effects (hierarchical) models, and GPU-accelerated envelope construction.

Part 5: Simulation Methods and Technical Implementation

The appendices document the mathematical and algorithmic foundations of the samplers used in glmbayes, including likelihood subgradient methods, envelope construction, and accept-reject schemes for both regression and dispersion parameters.

Companion textbooks

Several vignettes include optional appendices that reproduce examples from [@JohnsonLauEtAl2022] using glmbayes syntax (lmb(), glmb(), Prior_Setup(), dNormal()). Those appendices require the suggested package bayesrules (for data only); the main chapter body knits without it. Posterior comparison tables use coefficient summaries printed in the book (not live rstanarm fits).

| glmbayes vignette | Main teaching example | Bayes Rules! book | Appendix | |-------------------|----------------------|-------------------|----------| | Chapter 02-S04 | Gamma–Poisson conjugacy (daily counts) | Ch. 12 (conjugate illustration) | Appendix A — Albert / LearnBayes heart transplants | | Chapter 03 | Dobson plant weight (lmb) | Ch. 9 — bikes, rides ~ temp_feel | Appendix A | | Chapter 08 | Menarche (glmb, prior construction) | Ch. 13 — weather_perth, logistic priors | Appendix A | | Chapter 09 | Menarche (logit / probit / cloglog) | Ch. 13 — weather_perth, raintomorrow ~ humidity9am | Appendix A | | Chapter 10 | Dobson randomized controlled trial (RCT) Poisson counts | Ch. 12 — equality_index, laws ~ percent_urban + historical | Appendix A | | Chapter 11 | carinsca Gamma regression | (no full Gamma-regression chapter) | Appendix A — scope note + Ch. 02-S05 pointer |

Priors. Use informative Bayes Rules! priors only where the book is fully informative on the coefficients you fit (e.g. Ch. 9 bike ridership, Ch. 13 Perth rain). Where the book is only partially informative (e.g. Ch. 12 Poisson intercept informative, slopes weak / autoscale), the appendix uses Prior_Setup() defaults for glmb() / lmb(). Encode fully informative book beliefs on the link scale as dNormal(mu, Sigma); fixed dispersion at the MLE where the main chapter does (see Chapters 03, 08, 11).

Other texts. Chapter 01 and Chapter 03 §6.1 map sections to @Agresti2015. Chapter 02-S04 Appendix A maps to @Albert2009 / LearnBayes. Additional textbook appendices may be added in the same pattern.


Together, these chapters and appendices form a coherent progression: from basic usage and model specification, through applied Bayesian GLMs, to the mathematical and computational details that underlie the envelope-based samplers and GPU-accelerated implementations in glmbayes.



Try the glmbayes package in your browser

Any scripts or data that you put into this service are public.

glmbayes documentation built on Aug. 5, 2026, 1:07 a.m.