[R] extracting partial residuals of each level of an interaction in a Mixed GAM
Amparo Lazaro
amparo.lazaro at imedea.uib-csic.es
Fri Mar 25 12:33:24 CET 2011
Hi,
I'm using the library mgcv to fit Mixed effect GAM (gamm). My model is
simple but account for an interaction between a factor and a continuous
covariate. This is an example of my model:
mymodel<-gamm(visrate ~ factor(ExClutrEat)+s(logplantdiv,k=3,
by=E)+s(logplantdiv,k=3, by=C)
, random=list(plotID=~1),
family=Gamma (link=log), data=bartsia)
I would like to extrat the partial residuals of each level of the
interaction to plot them in different colors in the graph. I tried to
extract them in the same way I do with a classic GAM (not including
random factor), but then the extracted partial residuals do not fit with
the points plotted by "plot(mymodel$gam, res=TRUE)" function in the
"gamm" . I guess this is because the random effect is not being taking
into account, but I don't know how to account for the random effect to
extract the ´real´ partial residuals for of each level of the
interaction in a gamm. Did anybody have this problem before? Any
suggestions?
Thanks in advance,
Amparo
More information about the R-help
mailing list