I notice that this combines both a sampling statement “~”, which drops constant terms in the log likelihood, and “target +=” which doesn’t, and I’m not sure if mixing the two is an issue or not. Is this a red flag, or should I not worry about it?
Except that the Stan language manual makes clear that’s almost but not quite true. That’s why I was asking about it. I wanted to know if the subtle difference between the two would make a material difference.
(Also, given how V_T is defined, that’s not defining a Gaussian distribution for y[i] twice, but that’s a side note.)
They are equivalent for all of the algorithms currently supported in Stan. Any difference is in the normalizing constants which is superficial.
If you factor the quadratic then one of the three terms you get is the unnormalized version normal_lpdf(y[i] | mu_M[i], uy[i]) so with both lines you are adding that distribution twice, effectively halving the standard deviations.