Re: [R] ERROR: gamm function (mgcv package). attempt to set an attribute on NULL

From: Ben Bolker <>
Date: Fri, 11 Mar 2011 02:10:03 +0000

wang cheng <cheng_wang29 <at>> writes:

> Hello:I run a gamm with following call
> :mode<-gamm(A~B,random=list(ID=~1),family=gaussian,na.action=na.omit,data=rs)
  an error
> happened:ERROR names(object$sp) <- names(G$sp) : attempt to set an
  attribute on NULL

with mgcv version 1.7-3  

What so? How can I correct the Error? Thanks very much for any help.

  Thank you for telling us that you are using a function within a contributed package, but ...
  Please read the posting guide. We are unlikely to be able to help without a reproducible example, unless you happen to have encountered a very common error.

 Update: I was able to guess what your problem was and create my own reproducible example. You have specified a generalized additive mixed model (GAMM) without any smooth terms, which means that you really don't need gamm (or the mgcv package in general) to do the problem.

rs <- data.frame(A=1:20,B=1:20,ID=rep(1:2,each=10))
> gamm(A~B,random=list(ID=~1),family=gaussian,na.action=na.omit,data=rs)
Error in names(object$sp) <- names(G$sp) :   attempt to set an attribute on NULL

  You could run the model you have requested via


  good luck
   (it would still be a good idea to read the posting guide, for future reference!)

    Ben Bolker mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Fri 11 Mar 2011 - 02:17:10 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Mar 2011 - 03:30:20 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive