I am fitting a non-linear gaussian model with brms:
mod_full_k <- bf(Y|se(Y_std_error, sigma = TRUE) ~ (W*(Q+(k*V)))/
(exp(logI0)*(M^b+(VM/2)*b*(b-1)*M^(b-2))),
logI0 ~ 1,
b ~ 1,
k~1+(1|site),
nlf(sigma ~ int+W^a),
int ~ 1,
a ~ 1,
nl = T,
family = gaussian())
The parameter k can only have positive values and therefore I defined the priors as:
prior <- c(
prior(normal(10,2), nlpar = "logI0", lb = 0),
prior(beta(0.7*4,(1-0.7)*4), nlpar = "b", lb = 0, ub = 1),
prior(lognormal(-1.5,0.7), nlpar = "k", lb = 0),
prior(exponential(3), class = "sd", nlpar = "k"),
prior(normal(0,0.5), class = "b", nlpar = "a", lb = 0),
prior(normal(0,1), class = "b", nlpar = "int", lb = 0),
prior(exponential(3), class = "sd", nlpar = "logI0")
)
I don’t get any negative draws for the k_intercept parameter, but when I add the sd parameter to get the posterior, some draws are negative and the 95% CI overlap with zero for some parameters. How can I specify the priors and model so all k posterior (k + sd_k) are positive? Before I had:
inv_logit(k) ~ normal(0,1.5)
and this worked well, but then I read a paper and realised k can have values above 1. I thought of log transforming k such that:
log(k) ~ normal(0,1)
or something like that, but then any draws (with sd) with identity value between 0 and 1 will result in negative values.