How to specify exposure / offset in a Bambi model?

When fitting a poisson regression in statsmodels I can specify an offset (or exposure) like this:

smf.poissionl(formula='y ~ x',
                             exposure = data["bin_width"],
                             data = data)

Is there a way to do this in Bambi, or do I just need to manually write this in PYMC?

Hi there!

You can do

bmb.Model("y ~ x + offset(log(bin_width))", data, family="poisson", link="log")

Oh, just like in R ! Is this documented somewhere?

1 Like

Unfortunately, nope. It’s just in the tests.

If you have any example you’d like to contribute, it will be very welcomed :slight_smile:

1 Like

My plan is to reproduce Estimating Generalized Linear Models for Count Data with rstanarm • rstanarm (mc-stan.org) for Bambi.

Cheers!

1 Like