Is X a numeric variable or a factor? If it's numeric try....
gam.lme<- gamm(Y~ s(z, by=X), random=list(groups=pdDiag(~1+X)) )
... since otherwise the separate X term is confounded with s(z, by=X).
(gam detects such confounding and copes with it, but gamm can't).
Simon
On 17/03/11 17:47, Irene Mantzouni wrote:> Hi all,
>
>
>
> I would like to fit a gamm model of the form:
>
>
>
> Y~X+X*f(z)
>
> Where f is the smooth function and
>
> With random effects on X and on the intercept.
>
>
>
> So, I try to write it like this:
>
>
>
> gam.lme<- gamm(Y~ s(z, by=X) +X, random=list(groups=pdDiag(~1+X)) )
>
>
>
> but I get the error message :
>
>
>
> Error in MEestimate(lmeSt, grps) :
>
> Singularity in backsolve at level 0, block 1
>
>
>
> When I simply fit a gam model using the formula above, then it works ok.
>
>
>
> Is it possible to fit such a model with gamm?
>
>
>
>
>
> Thanks a lot!
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
--
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603 http://people.bath.ac.uk/sw283