Specifying knot positions in splines in BRMS

In order for knots to be picked up, you need to specify k in s(...). This is only related to how mgcv handles splines and I have no control over that via brms. However, there was a problem in brms that may have prevented knots from being passed correctly in models with multiple splines. This should be fixed this in the brms version on GitHub.

Here is an example that works for me in the sense that results differ based on the chosen knots:

set.seed(2)
dat <- mgcv::gamSim(1,n=400,dist="normal",scale=2)

library(brms)
b2 <- brm(y~s(x2, k = 3), knots = list(x2 = c(0, 0.1, 0.2)), data=dat)
summary(b2)
marginal_smooths(b2)

b3 <- brm(y~s(x2, k = 3), knots = list(x2 = c(0.8, 0.9, 1)), data=dat)
summary(b3)
marginal_smooths(b3)
3 Likes