Contrast sum in brms logistic model

Hi, im working with brms using categorical covariates, binary response and both slopes and intercept random.
But i don’t know how to switch from contrast treatment to contrast sum.

here my model type:


fit_TrVSAn13<-brm(y~treatment * condition + (1|sample:treatment:condition)+ (treatment|sample) + (condition|treatment),
                  data=df,
                  iter=4000,
                  family = bernoulli())
  • Operating System: Ubuntu 21.04
  • brms Version: 2.16.3

Hi,

You can set contrasts globally with

options(contrasts = c(unordered = "contr.sum", ordered = "contr.poly"))

Or just for one of the variables e.g.

contrasts(data$variable) <- "contr.sum"

Cheers

2 Likes