Puzzling on a product likelihood using Distributions and Turing

Welcome, @riegel_gestr!

Not sure if I understood your problem correctly but if you just want to model your x’s as iid Poisson draws, then a Turing model could look like this:

using Turing

# simulate fake data
lambda = 3
n = 100
x = rand.(Poisson.(lambda), n)

#define Turing model
@model function mymodel(x)
    # prior
    lambda ~ LogNormal(1.5)
    
    # likelihood
    for i in eachindex(x)
        x[i] ~ Poisson(lambda)
    end
end

# sample from posterior
post = sample(mymodel(x), NUTS(), 2000)

You could of course also specify lambda as some function of additional predictor variables, in which case you get a Poisson regression. Turing internally accumulates the log likelihood so you don’t have to specify the product over the pointwise likelihoods (or rather the sum over the pointwise log likelihoods).