I want to resurrect a question that I asked two months ago (Comparing gam models using ti( )), but adding more explanations.
The aim of my analyses was to compare several gam models with different combinations of independent variables.
My analyses are done in R using the
gam
function from themgcv
packageSome of the models include interactions between some of the independent variables and in such a case, I use the following
gam
structure.gam(Y ~ ti(X1) + ti(X2) + ti(X1,X2), data = dat)
. The ti() function is a tensor product that is appropriate when interaction terms and main effects occur simultaneously (https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/te.html).Models that do not include interactions can be written as
gam(Y ~ ti(X1) + ti(X2), data = dat)
orgam(Y ~ s(X1) + s(X2), data = dat)
with s() a function providing a smoother of the variable considered (https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/s.html)
I have two questions concerning this setup:
- Is it correct using ti() (i.e. tensor product) when there is no interaction in the formula ?
(I am sure I will be blasted for this question, but if I use ti() instead of s() in those models their AIC value is better ... but see my second question)
- Can I compare directly (e.g. using AIC for example) models fitted with ti() and models fitted with s() ?
Thanks for your help !
Arnaud