# How to specify offset in poisson regression?

Hi,

Using the glm module, how can I build a poisson regression model that features an offset variable with a parameter estimate constrained to 1? In R, one would use the `offset` function:

`glm(y ~ offset(log(exposure)) + x, family=poisson(link=log) )`

Thanks,
Fabian

The glm-module uses patsy for the formulas, and as far as I know that doesn’t have support for offsets. You’ll have to set up the model manually without the glm module:

``````with pm.Model() as model:
...
beta = pm.Flat('beta')  # Or whatever is appropriate for your model
predictor = tt.log(exposure) + beta * x
pm.Poisson('y', mu=tt.log(predictor), observed=data)
``````

OK - thanks. I assume you mean to use the `exp` function when specifying `mu`, i.e.:

``````with pm.Model() as model:
...
beta = pm.Flat('beta')  # Or whatever is appropriate for your model
predictor = beta * x
pm.Poisson('y', mu=exposure * tt.exp(predictor), observed=data)`````````

You are right of course, it is `tt.exp`.