Lets say I have a data set with y
and x1
, x2
, xp
variables.
I want to fit all of my predictors with splines.
For example :
gam_object = gam(y ~ s(x1) + s(x2) + s(xp), data)
How can I do this without typing every single variable? If I would like to fit the module without the first two without using splines. How can I do that?
gam_object2 = gam(y ~ x1 + x2 + s(x1) + s(x2), data)