Priors for splines

When setting the priors for a model which does include splines, we can specify the prior of class “sds” for the wiggliness parameter, which is in some literature referred as a hyperprior.

But how could we specify the prior for the parameters of the actual spline, i.e. the prior for the “linear” coefficients in the mixed model representation (which are denoted as beta in Wood (2017), but other authors mostly use alpha or gamma)?

Besides feeling uncomfortable when using the default prior without knowing it, the bigger issue is that for specific problems the authors suggest different priors (e.g. RW1, RW2, i.i.d., …).


1 Like

I think part of the confusion is that there are many different variants of splines. The default in brms’s s term are Thin-plate regression splines (taken from the mgcv package). I admit to not understanding the detailes of the splines much, but those are not classical B-splines. If I understand thin-plate splines correctly, they are designed so that having a larger dimension of the basis then some “minimum” amount needed to represent the true function should not change inference much - the penalty term will keep the “wiggleness” in check. Large basis should mostly only degrade performance. So the default is to use quite a rich basis, because the penalty term (which is the thing you actually put priors on) is the most important one.

With that said, usually the best way to choose prior is a prior predictive check, i.e. simulating data from the prior and seeing if they are consistent with general domain expertise. This can usually be done in brms with sample_prior = "only". See also the Bayesian workflow preprint for additional discussion.


I think I found the solution myself. When using P-Splines (bs="ps") one can set the order of the difference penalty by using the m argument. As described in Straightforward intermediate rank tensor product smoothing in mixed models for the bayesian approach this leads to a normal prior with the quadratic difference matrix of the specified order as covariance matrix. This is equivalent to a random walk prior of the same order. A penalty of order zero leads to an i.i.d. normal prior.

1 Like