Hi list,
I'm working with gamm models of this sort, using Simon Wood's mgcv library:
gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1))
gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1))
with a dataset of about 70000 rows and 110 levels for Group

in order to test whether tensor product smooths vary across factor levels. I was wondering if comparing those two models would be enough to conclude? I saw a preceding post on similar issues
http://r.789695.n4.nabble.com/Comparing-and-Interpreting-GAMMs-td2234209.html
but that example used simple s() smooths instead of tensor product smooths. In this case, the person was comparing between model A and model A1 like:

A<-gamm4(Z~factor+s(x)+s(x,by=factor) ,data=DATA, random=~(1|Group))
A1<- gamm4(Z~factor+s(x) ,data=DATA, random=~(1|Group))

I thus also tried to compare my model gm1, with another gm2 model of that sort:
gm2<-gamm(Z~te(x,y)+te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1))
but this type of models never converge and I obtain error messages of that sort: Error in MEestimate(lmeSt, grps) :   Singularity in backsolve at level 0, block 1

2 questions from that:
1) Keeping in mind that my main question is to check whether tensor products smooths vary across factor levels, would the comparison of models gm and gm1 be sufficient for me?
2) Otherwise, is there something wrong in my gm2 model that make it impossible to converge??

Also, side question that I already posted a few days ago but didn't get an answer for:
3)I don't manage to use vis.gam() to print 3 different 2D-contour plots for the three levels of factors I have in model gm1. It works well with model gm (when only one plot is generated) but not gm1 (3 plots should be generated)
Here is the error message I obtain:
vis.gam(gm1$gam,plot.type="contour",n.grid=200,color="heat",zlim=c(0,4))
Error in predict.gam(x, newdata = newd, se.fit = TRUE, type = type) :  number of items to replace is not a multiple of replacement length

Thanks a lot if someone can help with that,
Geraldine





	[[alternative HTML version deleted]]

