Predictions including only certain population-level terms

  • Operating System: Windows 10 64-bit
  • brms Version: 2.4.0

I’ve fit a model of the form
y ~ s(x1) + x2 + (1|g1) + (1|g2) + (1|g3)
and I want to make predictions by including only specific terms in the model. I know that the group-level terms can be specified with re_formula, but is there a straightforward way to do this for the population-level terms s(x1) and x2?

Specifically, I want to visualize the predictions for s(x1) independently of all other terms, and then do the same for x2. Since x2 is a continuous effect, it’s easy enough to calculate the prediction manually for different values of x2 just by multiplying the value by the posterior parameter distribution. But for the spline term s(x1) I’m not sure how to do this. Is there a simple built-in way to do this?

Use marginal_effects and perhaps also update brms to the latest CRAN version.