Sorry--- missed this before. YOU want to avoid recomputing
shared subexpressions (such as log(Mu), log(Theta), log(Mu)
to be saved in log_Mu, log_Theta, and log_Mu and then be
used in vectorized form in the expressions).
For example,
> for (k in 1:K)
> gamma1[k] = log(Theta[word_doc[n],s,k]) + log(PHi[k,w[n]]);
can be
gamma1 = log_Theta[word_doc, s] + log_Phi[ , w];
And vectorize the densities wherever you can.
Otherwise, Stan's not going to be fast at these kinds
of models, and to boot, you won't be able to do full Bayes
on them anyway because they're combinatorially intractable.
- 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.
> To post to this group, send email to
stan-...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.