# Monotonic increasing effect in brms

I’d like to model a monotonic increasing effect in brms (dose-response model so don’t believe that it would be decreasing). Without any constraint the estimated effect is currently decreasing. I tried to specify a prior with a lower bound on for the parameter but got the error “Error: Prior argument ‘coef’ may not be specified when using boundaries.”

A simple form of the model I’m trying to fit is:

``````prior <- set_prior("normal(0,5)", class="b", coef="mox", lb=0)
fit <- brm(level ~ mo(x), data=dat, family=cumulative(), prior = prior)
``````

Here, x is an ordered factor to be able to include it in the mo() function. Is there a way to restrict the estimate on mo(x) to be positive?

Thanks!

If your full model has no other coefficients, then drop the `coef` argument to your `set_prior` call. Otherwise, unfortunately last I knew this isn’t straightforwardly possible with `brms`. You could try updating to the latest development version just in case it’s changed recently, but here’s where things stand to my knowledge

However, it’s possible that you might be able to achieve this in a sneaky way using the nonlinear syntax of `brms`. I haven’t tested or verified this at all, but something like:

``````bf(
y ~ a + b,
a ~ other covariates,
b ~ 0 + mo(x),
nl = TRUE
)
``````

with

``````prior1 <- prior(some prior on the other terms, nlpar = "a") +
prior("normal(0,5)", class="b", lb=0, nlpar = "b")
``````
2 Likes

That (mostly) works! Slight modifications I had to make. I do have other variables, `y` and `z`

`````` prior1 <- c(set_prior("normal(0,5)", class="b", ub=0, nlpar="xinc"),
set_prior("normal(0,5)", class="b", nlpar = "other"))

fit <- brm(bf(level ~ xinc + other,
xinc ~ 0 + mo(x),
other ~ y + z,
nl=TRUE),
data=dat,
family=cumulative(),
prior=prior1)
``````

This is somewhat similar to what was suggested here that I couldn’t get to work. So thank you!

2 Likes