[R-sig-ME] gamm shifting residuals in plots

Vinicius Maia v|n|c|u@@@@m@|@ @end|ng |rom hotm@||@com
Fri Jan 18 02:11:32 CET 2019


Hi folks!

When running a gamm and seing its plots I found the residuals locations are shifted , I presume its because the gam smooth is fitted after  taking  the random effects into account (obviously). But I am not understanding how its possible to change data points location in these plots. The same is valid for the lmer, I usually plot the fitted line whith the residuals, but I have never seen this discrepancy in points positions with the fitted line before. I would appreciate if anyone could clarify what is happening.

Plots are attached

codes:

a) mod1=gamm(y1_r_prop~s(areia), random = list(area=~1,chave=~1),data=dadosest)
plot(mod1$gam,residuals=TRUE,pch=1.3,shift = coef(mod1$gam)[1])

b) mod2=gamm(y1_r_prop~s(areia), random = list(chave=~1),method="ML",data=dadosest)
plot(mod2$gam,residuals=TRUE,pch=1.3,shift = coef(mod2$gam)[1])

c) mod3=gamm(y1_r_prop~s(areia), random = list(area=~1),method="ML",data=dadosest)
plot(mod3$gam,residuals=TRUE,pch=1.3,shift = coef(mod3$gam)[1])

d) mod4=gam(y1_r_prop~s(areia),method="ML",data=dadosest)
plot(mod4,residuals=TRUE,pch=1.3,shift = coef(mod4)[1])

e) plot(y1_r_prop~areia)
curve(18.3048+-2.2142*x,add=TRUE) # coefficients from a lmer with both area and chave random effects

Thank you all!



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