The usual method for producing interactions of smooths with factors in
mgcv is using `by' variables (see ?gam.models for some documentation).
For example
if `gender' is a two level factor then
... s(time,by=gender) + gender
would produce a smooth of time for each gender. If you want a different
smooth of time for each combination of gender and gene, then I'd
recommend producing a factor with a level for each gender gene
combination, and using that as the by variable.
Simon
On 23/03/11 18:34, straybird_tx wrote:
I want to use gamm to generate smoothed trend line for three groups
identified by dummy variable genea and geneb. My question is how to add in
an interaction term between the time and another dummy variable such as
gender?
fitm<-gamm(change_gfr~
genea+geneb+s(timea_n,bs="ps")+s(timeb_n,bs="ps")+s(timec_n,bs="ps"),data=mm,random=list(time_n=~1|PID))
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-add-in-interaction-terms-in-gamm-tp3400243p3400243.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]
______________________________________________
R-help@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
______________________________________________
R-help@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.