jerome@hivnet.ubc.ca
2002-Dec-11 22:30 UTC
[Rd] nlme() and parameters "model", "fixed" and "random" (PR#2363)
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
Latchezar Dimitrov
2002-Dec-11 22:45 UTC
[Rd] nlme() and parameters "model", "fixed" and "random" (PR#2363)
The same in Windows XP Pro Latchezar Dimitrov> -----Original Message----- > From: jerome@hivnet.ubc.ca [mailto:jerome@hivnet.ubc.ca] > Sent: Wednesday, December 11, 2002 4:30 PM > To: r-devel@stat.math.ethz.ch > Cc: R-bugs@biostat.ku.dk > Subject: [Rd] nlme() and parameters "model", "fixed" and > "random" (PR#2363) > > > 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 > > ______________________________________________ > R-devel@stat.math.ethz.ch mailing list > http://www.stat.math.ethz.ch/mailman/listin> fo/r-devel >
Douglas Bates
2002-Dec-11 22:54 UTC
[Rd] nlme() and parameters "model", "fixed" and "random" (PR#2363)
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)) # TRUEThanks 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).