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

J josh8912 at yahoo.com
Sun Oct 3 09:18:46 CEST 2004

Hello.  I am trying my hand at modifying the varFunc
class varExp, but I must be missing a step.  All I
want to do right now is make a working copy of varExp,
call it varExp2, and then later change it. 
coef.varExp2, coef<-.varExp2, and Initialize.varExp2
all seem to work properly after I construct them.  I
can successfully use the commands:

v2 <- varExp2(form = ~age|Sex,fixed = c(Female=0))
v2 <- Initialize(v2, Orthodont)

But, after this when I type "v2" at the prompt, I get
the message: 

Error in coef.varFunc(x, uncons = FALSE, allCoef =
TRUE) : Don't know how to get coefficients for varExp2

Im not sure what to do.  Im sure it is a simple fix or
statement I need to enter.  Can anyone offer
suggestions?  Do I have to use the command
varFunc(varExp2) at some point?

As background, I created VarExp2 by using:

varExp2 <- function (value = numeric(0), ... [and the
rest of the VarExp function] ...)  At the end of the
function I had to change the statement: c("varExp",...
to c("varExp2...

Then I used:

setMethod("Initialize","varExp2", function (object,
data, ...)
    form <- formula(object)
    ... [and the rest of the Initialize.varExp
function] ...)

I did the same with the coef and coef<- functions.  

Im not sure why coef, coef<-, and Initialize seem to
work (they produce the same output and attributes as
varExp), but still I get the error message.  Would it
have anything to do with the warning I get when I
create the coef.varExp2 and other functions:

In the method signature for function "coef<-", class
"varExp2" has no current definition in:
matchSignature(signature, fdef, where)

Any help would be greatly appreciated.  Do I somehow
need to tell nlme where to find my new functions?  John

More information about the R-help mailing list