[R] gnls from library nlme

Douglas Bates bates at stat.wisc.edu
Sat Oct 5 02:16:25 CEST 2002


Peter Schlattmann <peter.schlattmann at medizin.fu-berlin.de> writes:

> Dear all,
> 
> I am trying to gain some experience with the function gnls from the nlme
> package.
> I tried to model the Theophyline data by trying to model the presumed
> dependency of
> the clearance on the body weight.
> 
> This is my  function call of gnls:
> 
> gnls(conc~SSfol(Dose,Time,lKe,lKa,lCl),data=Theoph,
> params=list(lKe~1,lKa~1,lCl~Wt),start=c(-2.4,0.46,-3.22,0.01))
> 
> That's been the result:
> 
> Error in as.vector(x, mode) : cannot coerce to vector
> 
> I tried various other calls with no success. Does anyone have a hint for
> me?
> 
> Thanks a lot
> Peter

There is a bug in the R version of gnls.  A certain construction is
needed when deparsing in S-PLUS but not needed in R.

I will upload a new version of the nlme package for R.  If you want to
test out the fix, the diff is given below.

Index: gnls.R
===================================================================
RCS file: /home/CVS/src/Rlibs/nlme/R/gnls.R,v
retrieving revision 1.7.2.2
diff -c -r1.7.2.2 gnls.R
*** gnls.R	9 Aug 2002 19:45:28 -0000	1.7.2.2
--- gnls.R	5 Oct 2002 00:04:48 -0000
***************
*** 233,239 ****
    names(plist) <- pnames
    for (nm in pnames) {
      plist[[nm]] <- TRUE
!     if (deparse(as.vector(params[[nm]][[3]])) != "1") {
        plist[[nm]] <-
          model.matrix(asOneSidedFormula(params[[nm]][[3]]),
                   model.frame(asOneSidedFormula(params[[nm]][[3]]), dataModShrunk))
--- 233,239 ----
    names(plist) <- pnames
    for (nm in pnames) {
      plist[[nm]] <- TRUE
!     if (deparse(params[[nm]][[3]]) != "1") {
        plist[[nm]] <-
          model.matrix(asOneSidedFormula(params[[nm]][[3]]),
                   model.frame(asOneSidedFormula(params[[nm]][[3]]), dataModShrunk))

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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