I am using brms to create a hierarchical, linear (log link) regression model. The model has 15 covariates, which are a combination of continuous and categorical (2 levels) variables, and group specific random intercepts (there are 51 groups). I’d like to include priors on a subset of the continuous covariates, with different upper and lower bounds on these priors.
While this question has been asked before (see Horseshoe prior on subset of predictors), it’s unclear to me how to modify the non-linear syntax code to include random intercepts.
An example of the model I’d like to run is below:
priors <-c(set_prior(“normal(0, 1)”, class = “b”, nlpar = “a”, ub=0), #Neg
set_prior(“normal(0, 1)”, class = “b”, nlpar = “b”, lb=0) #Pos
model <-brm(bf(y ~ a + b + var7 + … + var15 + (1|group), nl=T) +
lf(a ~ var1 + var2 + var3, center = TRUE) +
lf(b ~ var4 + var5 + var6, center = TRUE),
prior = priors)
When I run a model with the above code, the following error is generated: Error: Factors with more than two levels are not allowed as covariates.