[R-sig-ME] interactions with a smoothed term in a gam

Ben Bolker bbolker at gmail.com
Thu Jul 14 14:52:13 CEST 2011


On 11-07-14 04:00 AM, Rafael Mares wrote:
> Dear all
> 
> I am hoping someone can please help me with a gam I'm trying to
> specify using gamm4 0.1-2 in R, particularly in trying to specify
> interactions with a smoothed term.
> 
> I am looking at the occurrence or not of a behaviour (extraterritorial
> foray) in each week across several years and how this behaviour might
> be predicted by a series of continuous and categorical variables. I am
> including week as a predictor variable in my model like so:
> s(week,bs="cc") - as the behaviour is highly cyclical - , and I would
> like to allow this smoothed term to interact with my other predictor
> variables: age of the individual, total rainfall during week and
> occurrence of an intergroup encounter (yes/no). Is it possible to
> create a "fixed smoothed term" for week, that I could then allow to
> interact linearly with each of my other predictor variables? 

  What do you mean exactly by "interact linearly with"?  What model do
you have in mind for the possible change in the (logit probability of)
occurrence at a given week as a function of differences in age?

> I am
> trying to avoid specifying interactions as either: s(week, age) or
> s(week, by = age), because I am interested in multiple interactions
> and to my understanding, these approaches would create a different
> smooth for each interaction. My main interest is to see whether other
> highly seasonal variables (such as oestrus and it's interactions),
> which are expected to have linear effects, are better predictors than
> a smooth of week (plus interactions), in explaining whether
> individuals embark on extraterritorial forays or not.
> 
> Thank you in advance for any help.
> All the best,
> 
> Raff
> Rafael Mares
> Large Animal Research Group (LARG)
> Department of Zoology
> University of Cambridge
> Downing Street
> Cambridge
> CB2 3EJ
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models




More information about the R-sig-mixed-models mailing list