Excluding a Smooth Term in BRMS using posterior_linpred

I have fit a model with a smooth term, including random curves for each subject, using a function like this:

mod1 = brm(y~s(x, k=4) + s(sid, x, k=4, bs='fs', m=1), family=bernoulli)

It is more complicated in reality, but this is enough to demonstrate my issue. I am interested in drawing from the posterior of this model excluding the smooth component corresponding to the random curves (generated via s(sid, x, k=4, bs='fs', m=1)). That is to say, I am interested in typical performance rather than individual subject performance. With random slopes or interactions, this would be as simple as setting re_formula = NA, but that does not appear to work.

Is there a non-hacky way to instruct posterior_linpred to ignore smooths corresponding to s(sid, x, k=4, bs='fs', m=1)? If not, I may need to drop back into mgcv. I could post an example if needed.

  • Operating System: 10.14.6
  • brms Version: 2.9.0

There is currently no non-hacky way of making this possible, but it is possible to generalized re_formula to also filter spline and other terms. Perhaps it is worth opening an issue about it if you like.

1 Like

Thanks, Paul!
Will do so this weekend.

Hey Paul,

I’ve run into the same issue described here and was wondering if a way exclude splines was ever added - haven’t had any luck finding a solution to the issue.

not yet. you will have to wait until brms 3 unfortunately

2 Likes