Poisson Distribution always return erros

Hi! :)

This is not allowed in Stan. The tilde ~ doesn’t “sample” from a distribution, but rather adds the data/parameter on the left hand side to the target function with the log distribution function thats on the right hand side (with given parameters). Basically, it is target += lpmf(ku[i], th11), and since ku doesn’t have a value, it throws an error.

Unfortunately, this is not the only problem with the model (at least for Stan): You can not have integer parameters in Stan (or any HMC or gradient based MCMC sample).

You’d have to marginalize over all the discreet parameters in your model, which can be a bit painful to do here… Sorry, for not being very helpful… :/

1 Like