[R] bug in nlme?

Douglas Bates bates at stat.wisc.edu
Mon Oct 21 22:07:01 CEST 2002


Try removing the names from the vector avila.fix1 before calling
update.  You can do this with
 names(avila.fix1) <- NULL

I think the problem may be that the names LKe, lKa, and lCl
are being propagated from the starting values and overwriting the
parameters in the environment in which the model is to be evaluated.
Notice that the names of the extended starting estimates are

.Names = c("lKe", "", "", "", "", "lKa", "", "", "", "", "lCl",
  "", "", "", "")))

and those conflict with parameter names.

If this does fix your problem we will modify the nlme code to strip
names from the starting estimates and avoid this problem in the
future.

kjetil halvorsen <kjetilh at umsanet.edu.bo> writes:

> The following error occurs with the latest version of nlme (
> Version: 3.1-32
> Date: 2002/10/06)
> on R 1.6.0, precompiled binary for windows(98).
> 
> > avila.nlme2 <- update(avila.nlme1, fixed=LKe+lKa+lCl ~ Periodo+Trat, 
> +   
> start=c(avila.fix1[1],0,0,0,0,avila.fix1[2],0,0,0,0,avila.fix1[3],0,0,0,0))
> Error: subscript out of bounds
> > traceback()
> 7: eval(expr, envir, enclos)
> 6: eval(modelExpression[[2]], envir = nlEnv)
> 5: nlme.formula(model = Conc ~ SSfol(200, Tiempo, lKe, lKa, lCl), 
>        data = avila, fixed = LKe + lKa + lCl ~ Periodo + Trat, random =
> structure(list(
>            Voluntario = structure(c(-72.0327852991691,
> -10.9140457582845, 
>            -2.40173940775114), formula = structure(list(lKe ~ 1, 
>                lKa ~ 1, lCl ~ 1), class = "listForm"), Dimnames = list(
>                c("lKe", "lKa", "lCl"), c("lKe", "lKa", "lCl")), class =
> c("pdDiag", 
>            "pdMat"))), settings = c(0, 1, 0, 1), class = "reStruct",
> .Names = "Voluntario", plen = structure(3, .Names = "Voluntario")), 
>        groups = ~Voluntario, start = structure(list(fixed =
> structure(c(-4.48968407530164, 
>        0, 0, 0, 0, -0.48160421584142, 0, 0, 0, 0, -0.746292880938506, 
>        0, 0, 0, 0), .Names = c("lKe", "", "", "", "", "lKa", "", 
>        "", "", "", "lCl", "", "", "", ""))), .Names = "fixed"), 
>        na.action = na.omit)
> 4: nlme(model = Conc ~ SSfol(200, Tiempo, lKe, lKa, lCl), data = avila, 
>        fixed = LKe + lKa + lCl ~ Periodo + Trat, random =
> structure(list(
>            Voluntario = structure(c(-72.0327852991691,
> -10.9140457582845, 
>            -2.40173940775114), formula = structure(list(lKe ~ 1, 
>                lKa ~ 1, lCl ~ 1), class = "listForm"), Dimnames = list(
>                c("lKe", "lKa", "lCl"), c("lKe", "lKa", "lCl")), class =
> c("pdDiag", 
>            "pdMat"))), settings = c(0, 1, 0, 1), class = "reStruct",
> .Names = "Voluntario", plen = structure(3, .Names = "Voluntario")), 
>        groups = ~Voluntario, start = structure(list(fixed =
> structure(c(-4.48968407530164, 
>        0, 0, 0, 0, -0.48160421584142, 0, 0, 0, 0, -0.746292880938506, 
>        0, 0, 0, 0), .Names = c("lKe", "", "", "", "", "lKa", "", 
>        "", "", "", "lCl", "", "", "", ""))), .Names = "fixed"), 
>        na.action = na.omit)
> 3: do.call("nlme", nextCall)
> 2: update.nlme(avila.nlme1, fixed = LKe + lKa + lCl ~ Periodo + 
>        Trat, start = c(avila.fix1[1], 0, 0, 0, 0, avila.fix1[2], 
>        0, 0, 0, 0, avila.fix1[3], 0, 0, 0, 0))
> 1: update(avila.nlme1, fixed = LKe + lKa + lCl ~ Periodo + Trat, 
>        start = c(avila.fix1[1], 0, 0, 0, 0, avila.fix1[2], 0, 0, 
>            0, 0, avila.fix1[3], 0, 0, 0, 0))
> 
> 
> Kjetil Halvorsen
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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