[R] Re: creating new varFunc classes in nlme .. error: "Don't know how to get coefficients for .. object"

JJ josh8912 at yahoo.com
Thu Oct 7 10:07:07 CEST 2004


Thanks much Dr. Ripley.  Looks like the setMethod
statment was unneeded.  If anyone can help, Im still
looking for some insight into the error message I
receive using nlme:

Warning in conLin$Xy * varWeights(object) : longer
object length is not a multiple of shorter object
length Error in recalc.varFunc(object[[i]], conLin):
dim<- : dims [product 95] do not match the length of
object [600]

I receive this when I use a simple varFix statment,
but not a more complicated varCombo statement.  What
does it mean, in general, and is there a way to avoid
it?

Thanks.  John



--- Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:

> On Sun, 3 Oct 2004, J wrote:
> 
> > Ah!! After way too many hours of work Ive answered
> my
> > own question.  To get varExp2, a copy of varExp,
> to
> > work as a new varFunc, one needs to use this sort
> of
> > syntax:
> > 
> > update.varExp2 <- function (object, data, ...)
> > {
> >     print ("enter update")
> >     val <- NextMethod()
> >     if (length(val) == 0) {
> >         aux <- coef(val, allCoef = TRUE)
> >         if (!is.null(grps <- getGroups(val))) {
> >             aux <- aux[grps]
> >         }
> >         attr(val, "logLik") <- sum(log(attr(val,
> > "weights") <- exp(-aux *
> >             getCovariate(val))))
> >     }
> >     val
> > }
> > setMethod("update", "varExp2", update.varExp2)
> 
> update() is an S3 generic and nlme uses S3 classes,
> so this is definitely 
> wrong.  Have you been using S4 classes without
> mentioning it?
> 
> -- 
> Brian D. Ripley,                 
> ripley at stats.ox.ac.uk
> Professor of Applied Statistics, 
> http://www.stats.ox.ac.uk/~ripley/
> University of Oxford,             Tel:  +44 1865
> 272861 (self)
> 1 South Parks Road,                     +44 1865
> 272866 (PA)
> Oxford OX1 3TG, UK                Fax:  +44 1865
> 272595
> 
> 



		
_______________________________

Declare Yourself - Register online to vote today!




More information about the R-help mailing list