Hello everyone
I’m coding a rather simple model, but I’m stucked while trying to use the me() function of brms:
library(brms)
Glx.Phe <- c(19.6, 19.4, 21.1, 22.1, 20.8, 20.9, 21.3, 21.1,
21.7, 22.2, 22.7, 22.9, 22.5, 23.0, 22.1, 24.2, 15.2)
Spp <- c("Antarctomysis_maxima", "Antarctomysis_maxima", "Antarctomysis_maxima",
"Champsocephalus_gunnari", "Champsocephalus_gunnari", "Champsocephalus_gunnari",
"Champsocephalus_gunnari", "Champsocephalus_gunnari", "Champsocephalus_gunnari",
"Champsocephalus_gunnari", "Champsocephalus_gunnari", "Champsocephalus_gunnari",
"Champsocephalus_gunnari", "Electrona_antartica", "Electrona_antartica",
"Electrona_antartica", "Euphausia_frigida")
tef1 <- rep(7.6, 17)
data <- data.frame(Glx.Phe, Spp, tef1)
formula <- bf(Glx.Phe ~ Spp:me(tef1, 1.2) -1 )
fit <- brm(formula, data = data)
summary(fit)
But as I want to use this code within an R package, I need to use pkg::functionname convention. Thus, when I use
formula <- brms::bf(Glx.Phe ~ Spp:brms::me(tef1, 1.2) -1 )
fit <- brms::brm(formula, data = data)
I get the
Error in model.frame.default(all_vars_terms, data, na.action = na.pass, :
invalid type (list) for variable ‘brms::me(tef1, 1.2)’
Any thoughts?
I’m working in win10 with R 4.3.1, rstan 2.26.22 and brms 2.20.1.
Thanks, cheers
Claudio