I am trying to plot a two-way interaction within a three-way design, but conditional_effects is not quite giving me what I want. Using the example from the function’s help, I can plot the full three-way design nicely:
library(brms) library(tidyverse) fit3way <- brm(count ~ zAge * zBase * Trt, data = epilepsy) conditions <- make_conditions(fit3way, "zAge") conditional_effects(fit3way, "zBase:Trt", conditions = conditions)
However, I want to plot the credible two-way interaction, collapsing (i.e., averaging) across the third variable of age. In theory I can do that removing the conditions argument from the above, but I noticed that the resulting two-way plot is just the two-way interaction at zAge = 0. I verified this by looking at the data.frames of the plots.
p3way <- conditional_effects(fit3way, "zBase:Trt", conditions = conditions)[] p3way %>% filter(cond__ == "zAge = 0") %>% head() p2way <- conditional_effects(fit3way, "zBase:Trt")[] head(p2way)
Basically, is there a way to really ignore the effect of the third variable entirely when plotting this lower-order two-way interaction? Thanks in advance!
- Operating System: Windows 10 (19043.1706)
- brms Version: 2.16.3