Gang
December 3, 2021, 6:24pm
#1
With the following model fit using smooth splines in `brms`

```
library(brms)
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 `s(x2)`

through

```
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 `s(x1)+s(x2)`

?

jd_c
December 3, 2021, 6:52pm
#2
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â€¦

1 Like

Gang
December 4, 2021, 2:54am
#3
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)`

and `s(x1)-s(x2)`

. I guess I may have to resort to `predict.brmsfit`

for those terms?

jd_c
December 6, 2021, 1:08pm
#4
As far as I know, `conditional_smooths()`

or `conditional_effects()`

only does main effects or interactions.

1 Like