How to get lp__ including constant terms?

For the purpose of helping to determine whether I am fitting the same model as I specified in jags, is it possible to obtain lp__ including the constant terms?

Only if you specify all your densities using target += ... rather than the tilde, or if you are working at the C++ level. I think you could hack the generated .hpp file prior to compilation to set propto to false everywhere but not sure about that.

@sakrejda’s first solution is by far the most robust. In general,

target += foo_lpdf(y | ...)

includes all the constant terms, whereas

y ~ foo(...)

drops terms that don’t involve at least one term dependent on a parameter.

You could edit the .hpp file as @sakrejda suggested. That’d work fine in CmdStan as long as you don’t change the .stan file before recompiling. I don’t know if the same trick’s possible in RStan or PyStan.