Skip to content

te( ) interactions and AIC model selection with GAM

7 messages · Bert Gunter, Will Shadish, Simon Wood +1 more

#
Ricardo,

Your second construction (b) is the correct one (in a you are asking for 
one marginal to be a 2 dimensional cubic regression spline, which 
doesn't exist in mgcv).

For visualization, would the example at the end of ?te be the thing to 
do? In 3d I find looking at a series of 2d slices quite useful.

For AIC model comparison, the usual advice applies that although the 
comparisons are a bit more reliable for nested models (since then some 
of the AIC approximations errors are the same in both cases, and cancel 
in the comparison), it is still ok to use AIC for non-nested models 
(i.e. it is *not* like most hypothesis testing where everything falls 
apart if you don't have nesting).

best,
Simon
On 30/07/12 16:50, Ricardogg wrote:

  
    
#
Simon, could you clarify this paragraph. We are submitting to a 
psychology journal and I am certain they will be asking us about why it 
is still ok to use AIC for non-nested models. Thanks. Will Shadish
On 8/2/2012 9:49 AM, Simon Wood wrote:

  
    
#
Well, geez! Without trying to upstage SImon, why not google it yourself?!

http://en.wikipedia.org/wiki/Akaike_information_criterion

(seemed pretty clear to me...)

-- Bert
On Thu, Aug 2, 2012 at 9:54 AM, Will Shadish <wshadish at ucmerced.edu> wrote:

  
    
#
Bert, thanks for the very useful link. I am duly chastised for not 
having searched thoroughly enough.

Will
On 8/2/2012 10:02 AM, Bert Gunter wrote:

  
    
#
On 02/08/12 18:02, Bert Gunter wrote:
-- one or two slightly surprising statements in there though :-)
I quite like the coverage in Davison (2003) "Statistical Models" Section 
4.7. Burnham and Anderson (2002) "Model Selection and Multi Model 
inference: a practical information theoretic approach", Springer, is a 
longer treatment.

best,
Simon

  
    
#
- About the visualization, my question is more about interpretation. In the
case of  :

 model_name <- gam ( bm  ~ t + te (t_year, temp_W, temp_sept, k = 5, bs = c(
?cc?,?cr?,?cr?)), data = data) 

* a)* vis.gam (model_name , view= c(?t_year?, ?temp_W?))

*b)* vis.gam (model_name , view= c(?t_year?, ?temp_sept?))

I imagine that what we see in a) is the effect on t_year by temp_W but  this
effect is also affected by temp-sept right? In other words, is what we see
the effect of temp_W on  t_year considering the other element of the model
which is temp-sept?

- About AIC model selection, my question is more focus on whether it is
necessary to use the same  the same type of smoother ( e.g te) and the same
dimension of the basis (k) for different model comparison...that is, if I
have a complex model in my list of models that I want to compare like:

gam ( bm ~ t + te (t_year, temp_W, temp_sept, k = 5, bs = c(
?cc?,?cr?,?cr?)), data = data) 

should I always use as type smoother te () instead of using s ( ) and always
fix the k as k = 5?? Here the maximum k I can put is k = 5.

for example, let's say I have another simpler model in my list of models I
want to compare in which I want to check the relationship between bm and t. 
Can I write it like /gam (bm ~ s(t, k = 13, bs = ?cr?), data = data) /? Or I
have to write like/ gam (bm ~ te (t, k = 5, bs = ?cr?), data = data)/ to do
the comparison in the same conditions for all the models?

Thank you very much for your response Simon,

Best regards,

Ricardo












--
View this message in context: http://r.789695.n4.nabble.com/te-interactions-and-AIC-model-selection-with-GAM-tp4638368p4638922.html
Sent from the R help mailing list archive at Nabble.com.
#
- About the first question, I was not sure about what was the proper model (
a) or b) )  because I saw this  at the end of the help for te ---> ?te :

n <- 500
v <- runif(n);w<-runif(n);u<-runif(n)
f <- test2(u,v,w)
y <- f + rnorm(n)*0.2
# tensor product of 2D thin plate regression spline and 1D cr spline
b <- gam(y~te(v,w,u,k=c(30,5),d=c(2,1),bs=c("tp","cr")))
op <- par(mfrow=c(2,2))
vis.gam(b,cond=list(u=0),color="heat",zlim=c(-0.2,3.5))
vis.gam(b,cond=list(u=.33),color="heat",zlim=c(-0.2,3.5))
vis.gam(b,cond=list(u=.67),color="heat",zlim=c(-0.2,3.5))
vis.gam(b,cond=list(u=1),color="heat",zlim=c(-0.2,3.5))
par(op)

But maybe is because of the *tp* basis, and I use a *cc* one. Could be due
to this?

- About the visualization, my question is more about interpretation. In the
case of  : 

 model_name <- gam ( bm  ~ t + te (t_year, temp_W, temp_sept, k = 5, bs = c(
?cc?,?cr?,?cr?)), data = data) 

* a)* vis.gam (model_name , view= c(?t_year?, ?temp_W?)) 

*b) *vis.gam (model_name , view= c(?t_year?, ?temp_sept?)) 

I imagine that what we see in a) is the effect on t_year by temp_W but  this
effect is also affected by temp-sept right? In other words, is what we see
the effect of temp_W on  t_year considering the other element of the model
which is temp-sept? 

- About AIC model selection, my question is more focus on whether it is
necessary to use the same  type of smoother ( e.g te) and the same dimension
of the basis (k) for different model comparison...that is, if I have a
complex model in my list of models that I want to compare like: 

gam ( bm ~ t + te (t_year, temp_W, temp_sept, k = 5, bs = c(
?cc?,?cr?,?cr?)), data = data) 

should I always use as type smoother te () instead of using s ( ) and always
fix the k as k = 5?? Here the maximum k I can put is k = 5. 

for example, let's say I have another simpler model in my list of models I
want to compare in which I want to check the relationship between bm and t. 
Can I write it like /gam (bm ~ s(t, k = 13, bs = ?cr?), data = data)/ ? Or I
have to write like /gam (bm ~ te (t, k = 5, bs = ?cr?), data = data) /to do
the comparison in the same conditions for all the models? 

Thank you very much for your response Simon, 

Best regards, 

Ricardo 



--
View this message in context: http://r.789695.n4.nabble.com/te-interactions-and-AIC-model-selection-with-GAM-tp4638368p4638965.html
Sent from the R help mailing list archive at Nabble.com.