I am trying to fit a sum over several functions with Stan and was wondering if the vectorized approach would be more efficient.
In practice this would come down to the following models:
1.)
Model="""
...
model {
...
// likelihood
sum_observables ~ normal(function_1(...)
+ function_2(...)
+ function_3(...)
..., covariance_matrix);
}
"""
Here sum_observable is simply the sum over observable_1, observable_2 …
And covariance matrix is simply the corresponding covariance_like standard deviation matrix.
2.)
Model="""
...
model {
...
// likelihood
observable_1 ~ normal(function_1(...), sigma_observable_1);
observable_2 ~ normal(function_2(...), sigma_observable_2);
observable_3 ~ normal(function_3(...), sigma_observable_3);
...
}