**glmbayes v 0.9.6 is now on CRAN: multi-response models, additional prior specifications, and companion vignettes based on Bayes Rules! book and the companion bayesrules package datasets**
▲ 82 r/rstats

**glmbayes v 0.9.6 is now on CRAN: multi-response models, additional prior specifications, and companion vignettes based on Bayes Rules! book and the companion bayesrules package datasets**

Hi all, glmbayes v 0.9.6 just hit CRAN last week. For anyone not familiar: it's a package for Bayesian linear and generalized linear models that draws independent, identically distributed samples from the posterior (accept-reject sampling for log-concave likelihoods) instead of relying on MCMC — so no chains, no convergence diagnostics to babysit. Interface mirrors `lm()`/`glm()`. The package includes dNormal() priors for all families and additional priors for the gaussian() family.

A few highlights from 0.9.6:

**New conjugate GLM priors** – Closed-form IID sampling paths for intercept-only Poisson, Binomial, and Gamma models with identity links: Beta–Binomial via `dBeta()`/`rBeta_reg()`, and Gamma–Poisson / Gamma–Gamma via `dGamma(Inv_Dispersion = FALSE)`/`rGamma_Conjugate_reg()`. `Prior_Setup()` can now calibrate hyperparameters for these families directly.

**Multi-response `lmb()`** – `lmb()` now handles `cbind(y1, y2) ~ x`-style multivariate response formulas, fitting a separate Bayesian linear model per column and returning a named `mlmb` list (with its own summary/print/coef methods). Single-response calls are unchanged.

**Bayes Rules! companion vignettes** – If you've worked through *Bayes Rules!* (Johnson, Ott & Dogucu), there are now optional vignette appendices that reproduce several of the book's datasets and published posterior summaries using glmbayes' `lmb()`, `glmb()`, `Prior_Setup()`, and `dNormal()`. Chapter-02 has been expanded to cover Conjugate priors and now includes plots using its companion package. Some of the more advanced/later Vignette Chapters also used examples from Bayes Rules!

CRAN: https://cran.r-project.org/package=glmbayes

Happy to answer questions, especially if you're coming from a `bayesrules`/`rstanarm` workflow and are curious how the IID sampler compares.

u/Bucksswede — 6 days ago
▲ 21 r/RStudio+1 crossposts

nmathopencl + opencltools packages now on CRAN: GPU-accelerated R Mathlib functions via OpenCL for package developer

Happy to share that nmathopencl has just appeared on CRAN, joining opencltools which went live earlier. Both are aimed at R package developers who want to bring OpenCL GPU acceleration into their packages without building the infrastructure from scratch.

What they do

  • opencltools provides the OpenCL scaffolding for R package developers — device detection, kernel compilation, buffer management, and a clean C++ API that other packages can link against via LinkingTo.
  • nmathopencl ports ~137 R Mathlib functions (probability distributions, special functions, etc.) to OpenCL C, so they're callable from GPU kernels. If you're writing statistical or numerical computing packages and want to offload to the GPU without reinventing distribution math, this is the layer that handles it.

Why it might matter

Most GPU-accelerated R work either wraps Python/CUDA tooling or reimplements distribution functions from scratch. This approach keeps things in the R ecosystem natively, uses OpenCL (so it's not NVIDIA-only), and exposes a LinkingTo interface so downstream packages can build on top without vendoring the math.

Accessing

Navigate to CRAN and access the nmathopencl and opencltools packages there. The packages are also available on R universe (with nicely formatted documentations) and on GitHub for source code.

  • Would love feedback from anyone doing numerical computing or building packages that need GPU acceleration. Happy to answer questions about the OpenCL-in-R workflow, which has its quirks.
reddit.com
u/Bucksswede — 13 days ago
▲ 60 r/BayesianProgramming+2 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 — 2 months ago