Thanks for sharing this. You really want to take this
loop:
for (i in 1:n) {
y[i, ] ~ multi_normal_cholesky(zeros, L_Sigma);
}
and replace it with the much faster vectorized form:
y ~ multi_normal_cholesky(zeros, L_Sigma);
And you don't want to do this:
Sigma = diag_matrix(sigma_y) + multiply_lower_tri_self_transpose(L);
as it adds a bunch of unnecessary zeroes in that diag_matrix() call;
instead, you're better off with the loop:
Sigma = multiply_lower_tri_self_transpose(L);
for (m in 1:M)
Sigma[m, m] = Sigma[m, m] + sigma_y;
We really need an add_diag(matrix, vector):matrix function that does
this in one line, but we don't have it yet and using diag_matrix is
inefficient.
- Bob
> --
> You received this message because you are subscribed to the Google Groups "Stan users mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
stan-users+...@googlegroups.com.