Re: [R] mgcv:gamm: predict to reflect random s() effects?

2011-06-27 Thread Simon Wood
In your dummy variable trick, I see how subjectwise predictions are obtained. But to get the Group mean predictions, isn't the s term with the 0 dummy by variable the same as just omitting the s term with Subject altogether? I would think so but want to check. - Yes it's the same as omitting

Re: [R] mgcv:gamm: predict to reflect random s() effects?

2011-06-24 Thread Szumiloski, John
Thanks Simon, that was quite enlightening, as I did somewhat misunderstand how gamm works. The bs='re' argument to s() is something I had not seen before. And the idea of pooling any random effects over the entire population does seem safer than trying to estimate variabilities etc from bare

Re: [R] mgcv:gamm: predict to reflect random s() effects?

2011-06-24 Thread Simon Wood
Given that you don't have huge numbers of subjects you could fit the model with `gam' rather than `gamm', using out.gamm <- gam( Y ~ Group + s(X, by=Group) + s(Subject,bs="re"), method="REML") Then your predictions will differ by subject (see e.g. ?random.effects for a bit mor

[R] mgcv:gamm: predict to reflect random s() effects?

2011-06-24 Thread Szumiloski, John
Dear useRs, I am using the gamm function in the mgcv package to model a smooth relationship between a covariate and my dependent variable, while allowing for quantification of the subjectwise variability in the smooths. What I would like to do is to make subjectwise predictions for plotting pu