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)? I'm using :> package.description("nlme")[1:3]Package Version Date "nlme" "3.1-17" "2001/08/26" _ platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1 minor 3.1 year 2001 month 08 day 31 language R R. Woodrow Setzer, Jr. Phone: (919) 541-0128 Experimental Toxicology Division Fax: (919) 541-5394 Pharmacokinetics Branch NHEERL MD-74; US EPA; RTP, NC 27711 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._