> On Jan 28, 2017, at 3:18 PM, Dr. Hans Hansen <
drhans...@gmail.com> wrote:
>
> Hi,
>
> is there a reason that row vectors do not work in multi_normal_rng()?
Just for consistency. The multivariate types pin down particular forms
of arguments, which can then be vectorized by putting them into
arrays.
> I have this sampling statement:
>
> for (i in 1:N){
> dat[i,] ~ multi_normal(pred[i,], sigma);
> }
The declarations should look like this:
vector[K] dat[N];
vector[K] pred[N];
and then the sampling statement can be vectorized as
dat ~ multi_normal(pred, sigma);
This will be more efficient and stable if sigma is a cholesky
factor and you use multi_normal_cholesky(...).
> and like to simulate data for posterior predictive checking:
>
> for (i in 1:N){
> pred_dat[i,] ~ multi_normal_rng(pred[i,], sigma);
> }
Here you need to use the loop, but you can use the same
types.
- Bob