[R] fitting gamm with interaction term

2011-03-17 Thread Irene Mantzouni
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 messag

Re: [R] fitting gamm with interaction term

2011-03-17 Thread Simon Wood
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, I

[R] fitting gamm with interaction term

2011-03-17 Thread Irene Mantzouni
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 messag