[R] Interaction effects with GAMM

Louise Baruël Johansen |ou|@ebj @end|ng |rom drcmr@dk
Mon Feb 18 15:58:18 CET 2019


I have a question on how to model interaction terms including smooths in a GAMM model (using the mgcv and nlme packages in R).

We have collected longitudinal behavioral and brain imaging data from ~100 subjects across ~6 time points, and I would like to model main effects of age, sex, brain as well as to-way interaction terms (and maybe three-way interaction terms), while correcting for education level and taking random effects into account. Is using the ti() setup the way to do this:

M = gamm(behav ~ ti(age) + sex + education + ti(age, by = sex) + brain + ti(brain, by = age), random = list(subjectID = ~1+age), data = data)

All help will be appreciated. 

Thanks, Louise


	[[alternative HTML version deleted]]



More information about the R-help mailing list