[R] te( ) interactions and AIC model selection with GAM
Ricardogg
rgonzalezgil at gmail.com
Thu Aug 2 23:45:06 CEST 2012
- 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.
More information about the R-help
mailing list