--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/auSQF5xMjyc/unsubscribe.
To unsubscribe from this group and all its topics, 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.
One way to get around that is to use a function to generate everything you need before computing the log-likelihood (e.g. the linear predictor) and then use it with the vectorized densities in the model block and loop over it in generated quantities.
On Wednesday, February 3, 2016, Andrew Gelman <gel...@stat.columbia.edu> wrote:
Yes, but this doesn’t always make sense because it can give up the efficiency that would be gained by vectorization. In my examples I found it made more sense to just use near-duplicate code, ugly as that is, with vectorized computation in the model block and point-by-point computation in the generated quantities block. We discuss this in our paper.
A
> On Feb 3, 2016, at 11:57 AM, Jonah Gabry <jga...@gmail.com> wrote:
>
> Hi Jacquie,
>
> I suggest creating a user-defined function in the functions block that computes the log-likelihood. Then you can use it in the model block and generated quantities. The "User Defined Functions" section of manual goes through how to do this, but if you run into any trouble let us know.
>
> Jonah
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/auSQF5xMjyc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stan-users+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Stan users mailing list" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stan-users/auSQF5xMjyc/unsubscribe.
To unsubscribe from this group and all its topics, 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.
Jacqueline Scholl
D.Phil Candidate, Department of Psychiatry, University of Oxford, OX3 7JX
How cool it would be, if in the future we could use a vector argument both in the model block and in the generated quantities block and have an option to get output as sum of log densities or vector of log densities..?
actually, using the function block as you advised solves this - only the 'returned' variable from the function is stored. thank you again for the tip!
:-) Should've read Jonah's response first!
- Bob