I am building a model and i need to multiply a beta \times X but i an not sure how to do it.
data {
matrix[N, K] y; // observations
matrix[N, P] X[K]; // input variables
}
parameters {
matrix[P, K] beta; // X's coefficients
}
model {
// sigma_obs was defined before..
//here is my problem
y ~ multi_normal_lpmf( beta*X, sigma_obs);
}
you should calculate the cholesky factorisation of sigma_obs once and then use it with multi_normal_cholesky_lpdf. This avoids the huge overhead to recompute that over and over.