I have defined sigma
inside my formula
as:
bf(...) +
nlf(sigma ~ sigmaA + sigmaB * exp(sigmaC * y)) +
lf(sigmaA + sigmaB + sigmaC ~ 1)
and inside my priors sigmaA
is unbounded while sigmaB
& sigmaC
are positive.
The problem is that the brms
fit goes on to give a negative estimate for sigmaA
so that if sigma
is plotted as a function of y
in the range of the available data y
then there are some regions of the data where sigma
is negative. I checked the raw Stan code (using brms::make_stancode()
on the formula object) and there is no mention of sigma
, only sigmaA
, sigmaB
& sigmaC
. Therefore I cannot be sure that when Stan runs it is forbidding any (sigmaA
, sigmaB
, sigmaC
) combinations that give a negative sigma
, and thus it is only constraining for the lb = 0
I have set in the sigmaB
& sigmaC
priors.
 How do you constrain
sigma
to be above zero when it is defined by a relationship of other parameters?
a) One brute force way would be definingnlf(sigma ~ abs(sigmaA + sigmaB * exp(sigmaC * y)))
.
b) I’m guessing you may say to just apply anlb = 0
bound to thesigmaA
but that could miss perfectly good parameter combos that don’t give a negativesigma
in the range of the data.
 Operating System: 5.10.16.3microsoftstandardWSL2

brms
Version: 2.18.0