Solved – interpretation of parameter tuning of gam with caret

caretgeneralized-additive-modelmodel-evaluation

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

gam.train<-  train(price ~ . , data=data,  method = "gam",
                family = Gamma(link = log))

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

Best Answer

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.