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
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
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
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
4 matches
Mail list logo