interactions in GAMs
David, I think that the colorsex approach is the right one, and colorsex should initially be included as a main effect, because the smooths are centred for factor by variables (see e.g. ?gam.models). Whether you then choose to drop this main effect, as it appears to be non-significant, is a matter of taste (I would tend to leave it in). best, Simon
On 27/11/12 16:42, chirleu wrote:
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.
______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK +44 (0)1225 386603 http://people.bath.ac.uk/sw283