Hi,
I am fitting a nonlinear model with negative binomial errors and the predictor X as a latent variable with measurement error.
I set up the model formulation like so:
mod2 = bf(Y ~ a*(me(X, X_sd))^b,
a ~ 1 + Ed*Tt + (1|g1) + (1|g2),
b ~ 1 + Ed*Tt + (1|g1),
nl = T)
nl1 = brm(formula = mod2, data = dat2,
prior = prior1, family = negbinomial(link="identity"),
iter = 2000, chains = 3, cores = 3,
control = list(adapt_delta = 0.9),
save_model = "mod-me.txt")
Here is the error I get when I try to make the stan code:
> make_stancode(formula = mod2, data = dat2,
+ family = negbinomial(link="identity"))
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for:
me(real, real)
Function me not found.
error in 'model32e441e674d_file32e47e7a7a6e' at line 72, column 54
-------------------------------------------------
70: for (n in 1:N) {
71: // compute non-linear predictor values
72: mu[n] = nlp_a[n] + nlp_b[n] * (me(C_1[n] , C_2[n]));
^
73: }
-------------------------------------------------
Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname, :
failed to parse Stan model 'file32e47e7a7a6e' due to the above error.
SYNTAX ERROR, MESSAGE(S) FROM PARSER:
No matches for:
me(real, real)
Function me not found.
error in 'model32e43a363066_file32e47e7a7a6e' at line 72, column 54
-------------------------------------------------
70: for (n in 1:N) {
71: // compute non-linear predictor values
72: mu[n] = nlp_a[n] + nlp_b[n] * (me(C_1[n] , C_2[n]));
^
73: }
-------------------------------------------------
Error in stanc(model_code = paste(program, collapse = "\n"), model_name = model_cppname, :
failed to parse Stan model 'file32e47e7a7a6e' due to the above error.
Does brms not recognize the function me()
when passed in the nonlinear model? Should I formulate the model differently?
If required, I can provide data to test this model.
Thanks,
Meghna
- Operating System: Windows 10
- brms Version: 2.13.0