steve-the-bayesian / BOOM

A C++ library for Bayesian modeling, mainly through Markov chain Monte Carlo, but with a few other methods supported. BOOM = "Bayesian Object Oriented Modeling". It is also the sound your computer makes when it crashes.
GNU Lesser General Public License v2.1
35 stars 14 forks source link

Support offsets for all models in `BoomSpikeSlab` ? #62

Open Martin-Jung opened 2 years ago

Martin-Jung commented 2 years ago

I really like using the BoomSpikeSlab package in R due to its speed. I wonder though whether there are any plans to support offsets (or alternatively weights) in other model families? So far only poisson.spike allows the specification of an offset to the regression for poisson processes. Offsets in the regression formula for logit.spike are ignored.

So these two models are close to identical even though in one the bmi is set as an offset.

library(BoomSpikeSlab)

data(Pima.tr, package = "MASS")
data(Pima.te, package = "MASS")
pima <- rbind(Pima.tr, Pima.te)
model1 <- logit.spike(type == "Yes" ~ npreg + glu + bp + skin, data = pima, niter = 500)
model2 <- logit.spike(type == "Yes" ~ npreg + glu + bp + skin + offset(log(bmi)), data = pima, niter = 500)

# ~ Identical
posterior::summarise_draws(model1$beta)
posterior::summarise_draws(model2$beta)

Or am I missing an option to specify this correctly somewhere?