fit <- brm(count ~ log_Age_c + log_Base4_c * Trt_c + (1 | patient),
data = epilepsy, family = poisson())
## plot all marginal effects
plot(marginal_effects(fit), ask = FALSE)
## only plot the marginal interaction effect of 'log_Base4_c:Trt_c'
## for different values for 'log_Age_c'
mdata <- data.frame(log_Age_c = c(-0.3, 0, 0.3))
plot(marginal_effects(fit, effects = "log_Base4_c:Trt_c",
data = mdata))
## also incorporate random effects variance over patients
## and add a rug representation of predictor values
plot(marginal_effects(fit, effects = "log_Base4_c:Trt_c",
data = mdata, re_formula = NULL), rug = TRUE)
Run the code above in your browser using DataLab