In ‘Stan Functions Reference’ manual, version 2.29, section 6.8, it is stated that:
Although the
diag_matrixfunction is available, it is unlikely to ever show up in an efficient Stan program. For example, rather than converting a diagonal to a full matrix for use as a covariance matrix,y ~ multi_normal(mu, diag_matrix(square(sigma)));it is much more efficient to just use a univariate normal, which produces the same density,
y ~ normal(mu, sigma);
However, the function signature in section 18.1.3 for the normal distribution, only considers reals as a possible type for the variance:
18.1.3 Stan functions
realnormal_lpdf(reals y | reals mu, reals sigma)
The log of the normal density of y given location mu and scale sigma
Then, how can both functions result in “the same density”, if multi_normal allows for a vector of differing variance values for each y, while normal just accepts a single scalar?
Thanks for your help!
P.S.: Is there a proper tag for documentation or manual questions? Or a platform to submit errata?