# Are interactions between two monotonic effects supported in brms?

I’ve been running some brms models with monotonic effects, but I’m repeatedly surprised that in both the conditional effects plot and if I make my own posterior distribution with add_epred_draws, there doesn’t seem to be an interaction between two monotonic predictors in the expected values. The model runs but the levels of one mo() never seem to affect the other mo().

I am planning to dig into this further and make a reprex but before I do, the issue would be explained if brms simply does not yet support interactions among monotonic effects. Are they actually supported, and if so would I need to specify anything special in conditional_effects or add_epred_draws to ensure the monotonic effects are generated correctly in the posterior?

It’s not clear to me what you mean when you say “interactions of monotonic effects”. What model formula are you using? How many different effects do you expect the model to estimate? And what exactly do you expect (in the presence of the interaction) to be monotonic?

I simply mean if I have two ordinal predictors, individually they would be entered into the regression equation like mo(var1) + mo(var2). And if I want to incorporate an interaction between the two of these predictors I could add mo(var1)*mo(var2)

What do you expect `mo(var1) * mo(var2)` to achieve? Suppose `var1` and `var2` are both ordinal with 10 levels, and moreover suppose that the effect of each variable is monotonically positive. Is your hope to estimate 99 terms with monotonicity constraints such that whenever either covariate increases (and the other does not decrease), the contribution to the linear predictor increases?

I understood this just at a simple level, to be requesting an interaction, i.e., in plain language, that the estimated effect of var1 would potentially vary depending on the level of var2. It would be slightly less explosive than your suggested 99 terms in that there are 4 levels of one variable and 5 of the other.

Yup, I’m just trying to make sure we pin down exactly what you want this interaction to represent. Interactions between factor variables result in a bunch of coefficients (19 in your case, plus the intercept), and we need to make sure we are on the same page about what is now supposed to be monotonic.

I think what we’re both saying is that you want the effect of var1 to be monotonic within each level of var2, and also you want the effect of var2 to be monotonic within each level of var1. I’m guessing that you also want the direction of the monotonic effects to be consistent–that is, either the effect of var1 is monotonically positive within all levels of var2 or it is monotonically negative within all levels of var2, and vice versa.

I don’t think `brms` is set up to estimate this sort of model, but I want to make sure I understand what the model you want is before I think too hard about whether there’s a way to pull it off.

In the parameter estimates it provides, it does look like it is trying to do something like what you are suggesting (maybe?) though there are many less levels, and when I plot posterior predictions it certainly looks like it hasn’t estimated any interactions (e.g., because all the lines are perfectly parallel).

Please don’t spend too much of your time thinking about it as this is not actually crucial for me to do, it just was confusing me and I wondered if it is simply because brms doesn’t actually do these kind of interactions