# interpretation of parameter tuning of gam with caret

i am using the caret package to train my gam model. my code looks like this

gam.train<-  train(price ~ . , data=data,  method = "gam",


and my output looks like this

Tuning parameter 'method' was held constant at a value of GCV.Cp
RMSE was used to select the optimal model using  the smallest value.
The final values used for the model were select = TRUE and method = GCV.Cp.


Now I just want to ask you guys if my interpretation is correct:

• I am tuning 2 parameter: methods and select
• method stands for "smoothing parameter estimation" method: GCV.Cp, REML, GACV.CP
• select means, that it shrinks my coefficients to almost 0, not like a backward selection with AIC or CP
• it tunes those parameter via cross validation using RMSE to choose the "best" parameter
• it also chooses which variables will be modelled as functions and which one as linear

did i get that correctly? Nevertheless, i still have some question

• why isn't it tuning the splines? when i look into the gam package, it uses the "thin plate splines" as default
• is it also tuning the degree of freedom of my smoothing terms? i guess yes, but i can't see that in the output
• since i used gamma as family: does it also tune the parameter for my gamma distribution?

i really hope that some of you guys can help me with this and i will really appreciate every answer!!!!!

best wishes

ching

First of all you are looking into the wrong package. If you specify method = "gam", the gam function from the package mgcv is used. Not from the gam package. You can find that information here

The grid search for method = "gam" is select and method, but you have not specified your own grid. The default grid search for method = "gam" is as follows:

  select method
1   TRUE GCV.Cp
2  FALSE GCV.Cp


So only method GCV.Cp will be checked as method. All the others are not looked at.

Splines and degrees of freedom are not tuned.

• Thank you phiver! Really appreciate your answer and time. Yeah I knew I was using the mgcv package. I forgot to mention that. However. So the gam function itself tunes my degrees of freedom right? The default smoothing function is the "thin plate" regression spline. So basically Caret is just doing a ridge regression for me, meaning reducing the unimportant variables to almost zero? And it uses the method gcv.cp to find the "best" amount of knots for my splines? – ching Oct 31 '16 at 13:48
• correct. checking both select options, caret does a ridge regression or not. In your case it was better for the final model. – phiver Oct 31 '16 at 14:37