[R] interactions in GAMs

chirleu villegas at iim.csic.es
Tue Nov 27 17:42:25 CET 2012


Hi all, 
I wonder if it's possible to include a double interaction in a GAM formula.
Example:

If I do this:
mod=gam(energy~s(size, *by=color, by=sex*, k=5) + temperature, ...)

I get the interaction betwen size*color and size*sex.

But I need size*color*sex, being size a smoother.
I've created a new variable (colorsex) which combines all the level of both
color (2 levels) and sex (2 level), so that I have a new variable with 4
level. In this case I can do:

mod=gam(energy~s(size, *by=colorsex*, k=5) + temperature, ...)

What do you think of this approach?

In this case, should I also include colorsex (or color*sex) in the
parametric term *even if it's not significant*(as it's the case)?

Many thanks

David








--
View this message in context: http://r.789695.n4.nabble.com/interactions-in-GAMs-tp4650987.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list