[R] Re: creating new varFunc classes in nlme .. error: "Don't know how to get coefficients for .. object"
Prof Brian Ripley
ripley at stats.ox.ac.uk
Sun Oct 3 19:30:35 CEST 2004
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
More information about the R-help
mailing list