Open GidonFrischkorn opened 6 months ago
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 https://github.com/venpopov/bmm/discussions/191
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
models