Skip to content

default_prior() documentation #1756

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
ASKurz opened this issue Mar 19, 2025 · 1 comment
Open

default_prior() documentation #1756

ASKurz opened this issue Mar 19, 2025 · 1 comment
Labels
Milestone

Comments

@ASKurz
Copy link

ASKurz commented Mar 19, 2025

In the documentation for default_prior() we read:

default_prior is a generic function that can be used to get default priors for Bayesian models.

This seems a little misleading. In the example below where a model uses non-default priors, default_prior() returns the same output as get_prior(). As the documentation currently reads, I would have expected default_prior() to return what the defaults would have been had I not used the prior argument within brm(), and I would have found it very helpful if it had.

fit1 <- brm(
  count ~ zAge + zBase * Trt + (1|patient) + (1|obs),
  data = epilepsy, 
  family = poisson(),
  prior = c(
    prior(normal(0, 1), class = Intercept),
    prior(normal(0, 1), class = b),
    prior(exponential(1), class = sd)),
  cores = 4, iter = 500)

default_prior(fit1)
          prior     class       coef   group resp dpar nlpar lb ub       source
   normal(0, 1)         b                                                  user
   normal(0, 1)         b       Trt1                               (vectorized)
   normal(0, 1)         b       zAge                               (vectorized)
   normal(0, 1)         b      zBase                               (vectorized)
   normal(0, 1)         b zBase:Trt1                               (vectorized)
   normal(0, 1) Intercept                                                  user
 exponential(1)        sd                                     0            user
 exponential(1)        sd                obs                  0    (vectorized)
 exponential(1)        sd  Intercept     obs                  0    (vectorized)
 exponential(1)        sd            patient                  0    (vectorized)
 exponential(1)        sd  Intercept patient                  0    (vectorized)

The weaker part of my request is more clarity in the documentation. But the stronger part of my request is it would be super cool if default_prior() returned what the default prior settings would have been for a model fit with non-default priors.

@paul-buerkner
Copy link
Owner

I like the idea. Will see what to best make out of it. :-)

@paul-buerkner paul-buerkner added this to the brms 2.23.0 milestone Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants