u/Bucksswede

▲ 64 r/RStudio+1 crossposts

glmbayes is now on CRAN — Bayesian GLMs with familiar glm() syntax, no MCMC required

I've just published glmbayes to CRAN. The motivation was simple: I wanted Bayesian inference for standard GLMs without the overhead of learning Stan, JAGS, or brms.

The syntax mirrors base R's glm() almost exactly:

# Frequentist
fit <- glm(counts ~ outcome + treatment, family = poisson())

# Bayesian — iid posterior samples, same formula interface
ps  <- Prior_Setup(counts ~ outcome + treatment)
fit <- glmb(counts ~ outcome + treatment,
            family  = poisson(),
            pfamily = dNormal(mu = ps$mu, Sigma = ps$Sigma))

summary(fit)  # posterior summaries, credible intervals

A few things that might be interesting:

  • Uses iid accept-reject sampling (Nygren & Nygren, 2006) on log-concave likelihoods — no chains, no warmup, no convergence diagnostics. Every draw is independent, so ESS = n.
  • Supports Gaussian, Poisson, Binomial, and Gamma families.
  • S3 interface mirrors glm()summary(), predict(), residuals() all work as expected.
  • Passes checks across all 10 CRAN flavors (Linux/Windows/macOS, devel/release/oldrel).
install.packages("glmbayes")

Feedback very welcome — especially from anyone who has tried to introduce Bayesian methods in a teaching context where MCMC complexity is a barrier.

reddit.com
u/Bucksswede — 7 days ago