-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add plot
method for default_priors
#194
Add plot
method for default_priors
#194
Comments
When I was thinking about this some time ago, I thought that this package will be very useful: https://pkg.mitchelloharawild.com/distributional/index.html |
Yes, I think that package will be super useful. Here's a super basic example of how we could use it for this: library(distributional)
library(ggdist)
library(ggplot2)
library(brms)
# basic functionality with distributional explicit functions
dist <- dist_normal()
dist2 <- exp(dist). # you can apply transformations!
# visualize both distributions
ggplot() +
stat_slabinterval(aes(dist = dist), orientation = "horizontal")
ggplot() +
stat_slabinterval(aes(dist = dist2), orientation = "horizontal")
# can extract the distribution from the prior and do the same
prior <- set_prior("normal(2, 1)", class = "Intercept")
dprior <- prior$prior
dprior <- paste0("distributional::dist_", dprior)
dist_prior <- eval(parse(text = dprior))
ggplot() +
stat_slabinterval(aes(dist = dist_prior), orientation = "horizontal") |
I have a prototype ready, but it needs polishing. I'll open a draft pr so you can take a look at what it looks like right now |
Looking forward to checking this out! I saw that you also were in contact with the developers of the distributions package |
yeah, I had the prototype working on the weekend, but then noticed some problems related to transformations of priors to the native scale, so I've been working with them to fix them :) |
Discussed in #191
Originally posted by GidonFrischkorn March 28, 2024
When I was thinking about the
default_priors
for them3
, I thought having an easy way of plotting thedefault_priors
on the parameters and native scale would be nice. I was thinking about something similar to the plots you generated for the "extract info" vignette. What do you think about this?Create a
plot
method for thedefault_priors
generated forbmmodel
. Potentially see if theplot
method can be generalized to the output class ofdefault_priors
and also work forbrms
modelsThe text was updated successfully, but these errors were encountered: