With the following model fit using smooth splines in
dat <- mgcv::gamSim(1, n = 200, scale = 2)
fit <- brm(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat)
we can show the fit of
plot(conditional_smooths(fit, smooths = "s(x2)"), ask = FALSE)
The fitted curve is centered around 0 along the
y-axis. Is there a way to add the
Intercept of the model to the plot? Also, how to show
To add the intercept, just use
conditional_effects() rather than
conditional_smooths(). Note that this method makes predictions with the other predictors held at their mean.
I am not sure what you mean by this…
Thanks a lot for the pointer @jd_c! The function
conditional_smooths() does seem to collect various “main” effects and “interactions”.
I also wish to examine various combinations such as
s(x1)-s(x2). I guess I may have to resort to
predict.brmsfit for those terms?
As far as I know,
conditional_effects() only does main effects or interactions.