[R] error in nlme

Douglas Bates bates at stat.wisc.edu
Thu Sep 13 00:56:25 CEST 2001


Setzer.Woodrow at epamail.epa.gov writes:

> I'm getting an error from nlme that has me stymied.  I have a data set
> ,'mydata', with variables: AChE, Dose, sex, set, and mrid; 'set' and 'mrid'
> indicate two levels of nesting, with 'set' nested within 'mrid'.  I want to
> fit the model:

> mod <- nlme(AChE ~ Cexp(Dose, A, B, m), data=mydata,  fixed = A+B+M~sex,
> random=A+B+m~sex | mrid/set, weights=varPower(fixed=1))

> (mydata has over 1000 records, so I won't reproduce it here).
> 
> When I run this, I get the error:
> 
> Error: dim<- length of dims do not match the length of object
> 
> It turns out the error is being thrown by the statement:
> 
> dim(work$pdFactor) <- dim(pdMatrix(nlmeSt$reStruct[[1]]))
> 
> indeed:
> 
> Browse[1]> length(work$pdFactor)
> [1] 72
> Browse[1]> dim(pdMatrix(nlmeSt$reStruct[[1]]))
> [1] 6 6
> 
> It looks like work$pdFactor contains information about both levels of
> nesting, which is being ignored.
> 
> Does someone have an idea for a fix (or am I abusing nlme)?

You're not abusing nlme - it is supposed to be able to do that but the
R version doesn't.

The original S code for nlme had to be modified for R and the
modifications for the case of nested grouping factors were getting
very complicated.  I eventually punted and modified it so it would
work with a single grouping factor only (that's the reStruct[[1]] in
the assignment).

People have claimed that this did work in R at one time.  I'm not
sure.  I don't remember fixing it myself.

Fixing this would take a non-trivial amount of time and given the
number of things already on my "To Do" list I can't predict when I
will be able to look at it.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list