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

Interface for defining which prior log densities are stored for priorsense #1585

Open
avehtari opened this issue Jan 20, 2024 · 1 comment
Open
Labels

Comments

@avehtari
Copy link
Contributor

Currently, brms stores all prior log densities in lprior variable. This is fine as the default behavior and makes it easy to use priorsense for quick tests without increasing the memory usage too much. To be able to focus on specific priors, we could allow priors to be tagged with labels.

For example, using a modified version of the example from set_prior doc

make_stancode(rating ~ treat + period + carry + (1|subject),
              data = inhaler, family = cumulative(),
              prior = c(prior(normal(0,10), class = "b", lprior = "b"),
                        prior(normal(1,2), class = "b", coef = "treat", lprior = "treat"),
                        prior(cauchy(0,2), class = "sd", group = "subject", coef = "Intercept"))

This would store the corresponding priors in variables lprior_b and lprior_treat. The same tag could be used for several priors, in which case the log density contributions from those priors would be summed together.

ping @n-kall

@n-kall
Copy link

n-kall commented Jan 20, 2024

In the separate_scaling branch of priorsense I have implemented the selection of priors and likelihood contributions in the case that lprior and log_lik are arrays. Currently the user needs to keep track of which element of the array corresponds to which prior, but perhaps the mapping can be stored.

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

3 participants