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

Priors: Impose bounds on more classes #1094

Closed
hsbadr opened this issue Feb 8, 2021 · 9 comments
Closed

Priors: Impose bounds on more classes #1094

hsbadr opened this issue Feb 8, 2021 · 9 comments
Labels
Milestone

Comments

@hsbadr
Copy link
Contributor

hsbadr commented Feb 8, 2021

Currently, upper and lower bounds are only allowed for classes "b". In many cases, with strong priors on the ranges, imposing bounds significantly reduces the computation time.

brms/R/priors.R

Lines 19 to 22 in e45f64e

#' @param lb Lower bound for parameter restriction. Currently only allowed
#' for classes \code{"b"}. Defaults to \code{NULL}, that is no restriction.
#' @param ub Upper bound for parameter restriction. Currently only allowed
#' for classes \code{"b"}. Defaults to \code{NULL}, that is no restriction.

Moreover, it isn't allowed to impose bounds with QR decomposition.

stop2("Cannot impose bounds on decomposed coefficients.")

@paul-buerkner
Copy link
Owner

I agree. The prior bounds framework needs to be reworked and made more flexible.

@mpirikL
Copy link

mpirikL commented Mar 17, 2021

If I may weigh in on this issue as a heavy user, but not a developer. Theory often gives us upper or lower bounds on the effects of some variables or the intercept but not on others. Currently, I am running into the problem that when I set the 'lb' and 'ub' arguments in set_prior() I cannot also set the 'coef' argument. Thus, it seems to me that brms requires that I either set bounds for all the parameters or none of them. Can you look into allowing a user to set bounds for individual parameters?

@drjhw
Copy link

drjhw commented Apr 21, 2021

I have the same problem - my model only converges if I set both the 'lb' and 'ub' arguments using set_prior. I need these bounds to constrain the intercept for the half-time in a non-linear model (similar to SSlogis, in package nlme) to sensible (positive) values. But, setting these bounds for the intercept then prevents the model from estimating coefficients for the variables of interest, because these covariates can lengthen or shorten the half-time.
I've been hoping to perform these analyses for more than a decade. So, I was excited to find that brms could estimate the basic model, with no covariates - but then frustrated to find that I could not relax the bounds to estimate the covariate effects.

@DoktorMike
Copy link

I also would love this feature, but currently you can still do it if you use nonlinear formulas instead which forces you to set priors for all of your parameters. It's very flexible but also quite verbose.

@paul-buerkner
Copy link
Owner

Closed via #1324

@lnalborczyk
Copy link

lnalborczyk commented Nov 11, 2022

Hi Paul,

I am echoing the remark of @mpirikL above, it does not seem possible to specify a prior with a lower bound on a specific beta parameter. For instance, prior(normal(0, 1), class = b, coef = "x", lb = 0) gives the following error: Error: Argument 'coef' may not be specified when using boundaries.

Do you know whether there is a way to get around this issue?

Thank you!

Ladislas

EDIT: oops nevermind, just noticed this was already discussed in #1422.

@paul-buerkner
Copy link
Owner

paul-buerkner commented Nov 11, 2022 via email

@lnalborczyk
Copy link

Perfect, thanks!

@mschubert
Copy link

For reference, an example to

use brms non linear syntax to define two separate linear predictors to specify different bounds

is here: #1422 (comment)

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

7 participants