3
$\begingroup$

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

$\endgroup$

1 Answer 1

3
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$
    – ching
    Commented Oct 31, 2016 at 13:48
  • $\begingroup$ correct. checking both select options, caret does a ridge regression or not. In your case it was better for the final model. $\endgroup$
    – phiver
    Commented Oct 31, 2016 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.