Hi there, I have a hierarchy of Beta distribution and my model is sooo slow. I am looking for a way to improve the run-time. By removing all the fluffs, I have the following model (assume that L is a large value and in the model I need to access l_sens[a, b] where 1<= a <= L and 1 <= b <= n_sens_buckets ):
parameters {
vector<lower=0, upper=1>[n_sens_buckets] sensitivity;
vector<lower=0, upper=1>[n_sens_buckets] l_sens[L];
}
model {
sensitivity ~ beta(9.0, 1.0);
for (i in 1:L) {
l_sens[i] ~ beta(10 * sensitivity, 10 * (1 - sensitivity));
}
I tried to vectorize the model section as follow to replicate the above for loop:
Thanks @FJCC for looking into that. remember that it is just a small part of of model and not the full one and observations will play a role somewhere else but I just added part of the code I need vectorization because it made my model so slow.
Please see that l_sens has the shape of L * n_sens_buckets and L is a big value. It means that for each 1 <= i <= L we need to sample from Beta which is also a vector of size n_sens_buckets.
Thanks! I was confused because I thought I was looking at the entire model { } code. I did a poor job of expressing myself but I looking for data somewhere in the model.