'How to apply smooth parameter to main effect and interaction separately in mgcv?

I use the code below to apply smooth parameter to interaction term only.

mgcv::gam(Y ~ s(X1, k=3, sp=-1) + s(X2, k=4, sp=-1) + 
            ti(X1, X2, k=4, sp=c(1,1)) + X3,
          method = "REML")

k value is quite small for my model because I just want get very smooth spline curves of variables.

In this code, I tried apply sp = 1 for interaction term.

Is this correct method to using sp option to control smoothness parameter?

And, could I setting the sp parameter values for X1, X2 individually inside ti() interaction term? (Like below)

ti(X1, X2, k=3, sp=c(0.5, 1))


Solution 1:[1]

Yes. In the first example the marginal smooths for X1 and X2 will have their smoothness parameters fixed at the value 1. In the second example you have a fixed smoothing parameter of 0.5 for the marginal smooth of X1 and a smoothing parameter of 1 for the marginal smooth of X2 in the tensor product interaction smooth.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gavin Simpson