From bates@stat.wisc.edu  Wed Dec 11 22:54:03 2002
From: bates@stat.wisc.edu (Douglas Bates)
Date: Wed Dec 11 22:54:03 2002
Subject: [Rd] nlme() and parameters "model", "fixed" and "random" (PR#2363)
In-Reply-To: <200212112129.WAA17784@pubhealth.ku.dk>
References: <200212112129.WAA17784@pubhealth.ku.dk>
Message-ID: <6rbs3skysa.fsf@bates5.stat.wisc.edu>

jerome@hivnet.ubc.ca writes:

> Full_Name: Jerome Asselin
> Version: 1.6.1
> OS: linux redhat 7.2
> Submission from: (NULL) (142.103.173.179)
> 
> 
> 
> print.lme() fails when the parameters "model", "fixed" and "random"
> are input as objects in nlme(). To show how this occurs, below is a
> slightly modified example from the nlme help page.
> 
> 
>      library(nlme)
>      data(Loblolly)
>      fm1 <- nlme(height ~ SSasymp(age, Asym, R0, lrc),
>                  data = Loblolly,
>                  fixed = Asym + R0 + lrc ~ 1,
>                  random = Asym ~ 1,
>                  start = c(Asym = 103, R0 = -8.5, lrc = -3.3))
>      fm1 # THIS WORKS...
> 
>      model <- height ~ SSasymp(age, Asym, R0, lrc)
>      fixed <- Asym + R0 + lrc ~ 1
>      random <- Asym ~ 1
>      start <- c(Asym = 103, R0 = -8.5, lrc = -3.3)
>      fm2 <- nlme(model,
>                  data = Loblolly,
>                  fixed = fixed,
>                  random = random,
>                  start = start)
>      fm2 # ERROR
>      #Nonlinear mixed-effects model fit by maximum likelihood
>      #Error in as.vector(x, mode) : cannot coerce to vector
> 
>      all(unlist(fm1$coefficients)==unlist(fm2$coefficients)) # TRUE

Thanks for the report.  The construction deparse(as.vector(x)) where x
is a formula is needed in S-PLUS but can cause an error in R.  We
should, and will, revise the R package for nlme to replace any
instances of deparse(as.vector(x)) by deparse(x).



[Rd] nlme() and parameters "model", "fixed" and "random" (PR#2363)
Douglas Bates