The roaches
example, Poisson Regression · TuringGLM.jl ignores the exposure. In BRMS this is done using a formula term like this " … + offset(log(exposure))` . GLM.jl handles this with an extra argument to the call. Does TuringGLM support offsets in some way that is not obvious?
Based on the code of TuringGLM it might be best to use DynamicPPL directly. I think the model that is created is:
@model function poisson_model(
y, X; predictors=size(X, 2), μ_X=μ_X, σ_X=σ_X, prior=prior
)
α ~ prior.intercept
β ~ filldist(prior.predictors, predictors)
y ~ arraydist(LazyArray(@~ LogPoisson.(α .+ X * β)))
return nothing
end
With default priors from the source, and if I understand the offset correctly (a fixed term directly from the data), the model should be something like:
@model function poisson_model(y, X, offset; n_predictors=size(X, 2))
α ~ TDist(3)
β ~ filldist(2.5*TDist(3), n_predictors)
y ~ arraydist(LogPoisson.(α .+ X*β .+ offset))
return nothing
end
Some details handled by TuringGLM remain like standardizing variables.