# Using `brms:hypothesis` correctly with interactions

This question is about the correct use of `brms`’s `hypothesis()` when a model has interaction. This is an example model:

``````summary(brm1.q <- brm(bf(DV ~
A * B +
(1|RanEff),
...
))
``````

where the critical part of the summary table would look like this:

``````#
# Population-Level Effects:
#           Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
# Intercept      ...       ...      ...      ...  ...      ...      ...
# Aj             ...       ...      ...      ...  ...      ...      ...
# Ak             ...       ...      ...      ...  ...      ...      ...
# Bn             ...       ...      ...      ...  ...      ...      ...
# Bo             ...       ...      ...      ...  ...      ...      ...
# Aj:Bn          ...       ...      ...      ...  ...      ...      ...
# Ak:Bn          ...       ...      ...      ...  ...      ...      ...
# Aj:Bo          ...       ...      ...      ...  ...      ...      ...
# Ak:Bo          ...       ...      ...      ...  ...      ...      ...
``````

Since effects are relative wrt the Intercept, if one wishes to contrast `Aj:Bn` and `Aj:Bn`, this, for example, would give the correct result:

``````hy1 = c(hy1 = 'Aj < Aj:Bn')
hypothesis(brm1.q, hy1)
``````

Does anyone have general (blanked) advice on how to help students wrap their heads around this and not make errors? This can become pretty hairy if the model would have higher-order interactions etc.

(Btw, this is similar, with similar “struggles”, if one would use `linearHypothesis()` from the `car` package.)

Thanks!