# Plot interactions for family="categorical"

**URL:** <https://discourse.mc-stan.org/t/plot-interactions-for-family-categorical/13095>\
**Category:** brms\
**Created:** [February 12, 2020, 12:09pm UTC](https://discourse.mc-stan.org/t/plot-interactions-for-family-categorical/13095 "2020-02-12T12:09:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pietro](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/pietro/32/4406_2.png) [@Pietro](https://discourse.mc-stan.org/u/Pietro)\
**Post date:** [February 12, 2020, 12:09pm UTC](https://discourse.mc-stan.org/t/plot-interactions-for-family-categorical/13095/1 "2020-02-12T12:09:59Z")

</div>

Please also provide the following information in addition to your question:

- Operating System: Windows
- brms Version: 2.9.0

I am trying to plot the interactions of a model with the following structure.

```
mod1 = brms::brm(Y ~ A*B+
                       C*B+ 
                       D + E+ F+
                       (1 |G) + (1|H),
                 control = list(adapt_delta = 0.99, max_treedepth = 10),
                 iter = 10000,
                 cores = 4,
                 data = dat6,
                 family="categorical")

```

the expression marginal\_effects(mod1, categorical = T) gives me the following warning.

```
Warning message:
Interactions cannot be plotted directly if 'categorical' is TRUE. Please use argument 'conditions' instead. 

```

I am not sure how to set the conditions, but looking at examples in the help page I tried:

```
conditions <- data.frame(A = c(-1, 0, 1))
marginal_effects(mod1, effects = "A:B",
                 conditions = conditions)

```

but I get the error

`Error: Please set 'categorical' to TRUE.`

Does anybody have an example to plot interactions in categorical models?  
Thanks for any suggestion.

---

<div class="post-metadata">

**Author:** ![matti](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/matti/32/13631_2.png) [@matti](https://discourse.mc-stan.org/u/matti)\
**Post date:** [February 12, 2020, 2:28pm UTC](https://discourse.mc-stan.org/t/plot-interactions-for-family-categorical/13095/2 "2020-02-12T14:28:31Z")

</div>

Can you try:

```
conditions <- data.frame(A = c(-1, 0, 1))
marginal_effects(
  mod1, 
  effects = "B",
  conditions = conditions,
  categorical = TRUE
)

```

?

Some permutation of effects & conditions should work, but remember to set `categorical = TRUE`.
