How to specify exposure / offset in a Bambi model? (original) (raw)

January 23, 2024, 8:27pm 1

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?

tcapretto January 23, 2024, 10:20pm 2

Hi there!

You can do

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

DrEntropy January 23, 2024, 10:42pm 3

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

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:

DrEntropy January 30, 2024, 11:27pm 5