[R] Help with random effects and smoothing splines in GAMM

Spencer Graves spencer.graves at pdf.com
Sun Oct 29 23:07:02 CET 2006


      Your "random" specification 'list(x=~1, s(z,bs="cr")=~1)' 
generates for me a "syntax" error.  To understand it, please see the 
documentation for 'list'.  The help file for 'list' says, "The arguments 
to |list| or |pairlist| are of the form |value| or |tag=value|", and I 
believe that 'tag' must be a legal R name.  In your 'random' 
specification, R wants to interpret 's(z, bs="cr")' as a 'tag'.  This 
generates a 'syntax error', because it is not a legal R name.  To see 
how to get around this, I suggest you work through all the examples in 
the 'gamm' help file.  If that is not adequate, I suggest you also 
review the 'gamm' article in the June 2001 issue of R News (vol. 1/2, 
available from www.r-project.org -> Documentation:  Newsletter). 

      If you want more help from this listserve, please provide 
commented, minimal, self-contained, reproducible code, as suggested in 
the posting guide "www.R-project.org/posting-guide.html".  Your example 
was not self contained. 

      Hope this helps. 
      Spencer Graves

Liang, Hua wrote:
> Try to fit a longitudinal dataset using generalized mixed effects models
> via the R function gamm() as follows:
>
>  
>
> library(mgcv)
>
> gamm0.fit<- gamm(y ~ x+s(z,bs="cr"),
>
>                 random=list(
>
>                             x=~1,
>
>                             s(z,bs="cr")=~1
>
>                             ),
>
>                      family = binomial, data =raw)
>
> the data is given by raw=(id, y,x,z). It doesn't work. If you can tell
> me how to fix this problem, it will be appreciated.
>
>  
>
>  
>
>  
>
>  
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>



More information about the R-help mailing list