Bounded parameters and effect

I have very simple non-linear model:

x <- rnorm(100)
n <- rbinom(100, 1, 0.5)
y <- 1.5-1*n +  exp(x) + rnorm(100, 0, 0.1)

Where “n” is simply a 0 or 1 grouping variable, like male/female etc…

fit ← brm(bf(y ~ a + b * exp(x), nl=TRUE, a ~ 1 + n, b ~ 1), data=data.frame(y, x, n),prior= prior(normal(0,1), nlpar=“a”, lb=0) +prior(normal(0,1), nlpar=“b”), cores=4 )

Bounding parameter “a” to be positive (it has to be in my model), force the effect of “n” to always be positive, is there a workaround for this without splitting “a” into 2 parameters?

Where did you learn about this particular model?

The easiest and the most general solution would be to model a on the log scale so that exp(a) is alway positive. I.e. y ~ exp(a) + b * exp(x)

How does splitting a to address the sign of the parameter work? Like a piecewise function?

I mean something like this:
`

fit ← brm(bf(y ~ (aI+aN) + b * exp(x), nl=TRUE, aI + b ~ 1, aN ~ 0 + n), data=data.frame(y, x, n),prior= prior(normal(0,1), nlpar=“aI”, lb=0) + prior(normal(0,1), nlpar=“aN”) +prior(normal(0,1), nlpar=“b”), cores=4 )

`