This is an old version, view current version.
10.3 Sampling Notation
The notation
y ~ normal(mu, sigma);
provides the same (proportional) contribution to the model log density as the explicit target density increment,
target += normal_lpdf(y | mu, sigma);
In both cases, the effect is to add terms to the target log density. The only difference is that the example with the sampling (~
) notation drops all additive constants in the log density; the constants are not necessary for any of Stan’s sampling, approximation, or optimization algorithms.