Hello there!
I’m trying to run Bayesian inference for my model in R with the brms package, but I’ve got a problem. Here’s my model:
Baye_model.M1 <- brms::brm(
bf(
logBAgr1 ~ b1*logBA1 + b2*DD + b3*SWC - b4*NI + alpha,
nlf(NI ~ lambda*logBA2),
alpha ~ (1|plotID),
nl = TRUE
),
data = pair,
family = gaussian(),
prior = prior_brms.M1,
warmup = 2000,
iter = 5000,
chains = 2,
cores = 2,
control = list(adapt_delta = 0.9, max_treedepth = 15)
)
when I run this code, I’ve got error message: Error: The following variables can neither be found in ‘data’ nor in ‘data2’: ‘b1’, ‘b2’, ‘b3’, ‘b4’, ‘lambda’.
I’ve tried to add “b1 + b2 +b3 +b4 ~1” and “lambda ~1” in the bf (…), in this way I can run the model without error information. In this way, b1~ b4 and lambda are defined as random intercepts, which is not what I want to simulate. I want to view b1-b4 and lambda as unknown parameters and estimate their values through Bayesian inference. Could anyone give some suggestions on how to set up the model for this purpose correctly? thanks a lot in advance!