Skip to content

[Feature request] Visualizing (different) priors #1736

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

Open
Temperche opened this issue Feb 4, 2025 · 3 comments
Open

[Feature request] Visualizing (different) priors #1736

Temperche opened this issue Feb 4, 2025 · 3 comments

Comments

@Temperche
Copy link

Hi everyone,

while I'm aware that visualizing different priors is possible with the ggdist/tidybayes package and also with other packages such as standist ( https://github.com/jmgirard/standist ), I'd love for the functionality of visualizing prior distributions within the brms package itself, particularly within get_priors(). Particularly appreciated would be the possibility of comparing different priors visually as possible in the standist package above.

Thanks for your time and effort!
Temperche

@venpopov
Copy link
Contributor

venpopov commented Feb 5, 2025

@paul-buerkner I actually did some work last year on a plot.brmsprior() method that does exactly this: venpopov/bmm#205 (working examples in the link)

It worked and you could even plot priors on the native scale of parameters with links. I got really busy with teaching before I was able to finish it, but I think it's really close to done and there's no reason to keep it in bmm rather than brms.

If you want I can put together a PR. The issues I ran into were related with transoforming distributions to the native scale (and worked together with the author of 'distributional' to solve some of them). But if we ignore that feature, the actual plotting of just the priors as they are is pretty much done, so it should take me just a couple of hours to clean it up. Let me know if that's of interest :)

@paul-buerkner
Copy link
Owner

paul-buerkner commented Feb 5, 2025

I think this sounds pretty cool! The transformations are in any case hard to get to work correctly in all the different kinds of models that brms supports. So I would prefer just the "direct" prior plotting feature even if the transformation would somehow work already.

I am more than happy and excited to review a PR :-)

@venpopov
Copy link
Contributor

venpopov commented Feb 5, 2025

I agree. Initially I thought it was a good idea, but the trouble is not so much getting transformations to work, but that they become uninterpretable in many but the simplest cases. From my notes last year for just 2 very common cases:

  • for intercepts or ~0+factor coding the transformation is meaningful. But when we have an intercept + effects, the prior for the effects coefficients could be confusing on the native scale, because this is now (in the log-link case), a prior on the multiplicative coefficient. So I see two options - not to display priors for coefficients on the transformed scale, or to give a warning that these should be interpreted carefully.
  • a similar problem is for the sd of the random effects. For those I'm not even sure how to interpret them on the native scale. So maybe skip those completely if plotted on the transformed scale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants