Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vector-output log density functions #1697

Open
bob-carpenter opened this issue Nov 19, 2015 · 4 comments · May be fixed by stan-dev/math#2751
Open

vector-output log density functions #1697

bob-carpenter opened this issue Nov 19, 2015 · 4 comments · May be fixed by stan-dev/math#2751
Assignees
Labels
Milestone

Comments

@bob-carpenter
Copy link
Contributor

Idea from Aki Vehtari on stan-dev:

In Stan 2.8, log density functions like normal_log() output the sum of the densities of their components (with appropriate broadcasting of scalars).

It would be nice to allow them to be specified to return a vector, for instance for WAIC or LOO calculations. Aki suggests somethign roughly like

log_lik <- normal_ld<norm=true, sum=false>(y | X * b, sigma);

or maybe with vec=true instead of sum=false.

The result of #1683 will help with implementation.

@danielinteractive
Copy link

Just found this, this would be really useful in many situations.

@bob-carpenter
Copy link
Contributor Author

+1. There have been more and more cases where I've wanted to do this. It shouldn't be too hard by decorating the log density functions with one more layer of suffix.

@SteveBronder
Copy link
Collaborator

Yes I think it's very doable as laid out above, mostly need to find time do it. There's a few places we need to be careful but for the most part a couple template tricks should handle everything

@WardBrian
Copy link
Member

For me I think my question is whether the <> syntax is the right choice for this? The alternative that comes to my mind is if we add a keyword argument syntax

@WardBrian WardBrian linked a pull request Feb 17, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants