[R] nlme with a factor in R 2.4.0beta

Peter Dalgaard p.dalgaard at biostat.ku.dk
Mon Sep 25 11:28:21 CEST 2006


Christian Ritz <ritz at kvl.dk> writes:

> Hi,
> 
> the following R lines work fine in R 2.4.0 alpha (and older R versions), but not in R 
> 2.4.0 beta (details below):
> 
> 
> library(drc)  # to load the dataset 'PestSci'
> 
> library(nlme)
> 
> 
> ## Starting values
> sv <- c(0.328919, 1.956121, 0.097547, 1.642436, 0.208924)
> 
> 
> ## No error
> m1 <- nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))),
>                                fixed = list(b+c+d+e~1),
>                                random = d~1|CURVE,
>                                start = sv[c(2,3,4,5)], data = PestSci)
> 
> 
> ## Error: attempt to select more than one element
> m2 <- nlme(SLOPE ~ c + (d-c)/(1+exp(b*(log(DOSE)-log(e)))),
>                                fixed = list(b~HERBICIDE, c+d+e~1),
>                                random = d~1|CURVE,
>                                start = sv, data = PestSci)
...
> other attached packages:
>      nlme      drc
> "3.1-75"  "1.0-1"
....
>      nlme      drc
> "3.1-76"  "1.0-1"

I presume this is the real issue: The upgrade of nlme, rather than the
change of R itself from alpha to beta status.

The culprit would seem to be

   pars[, nm] <- f %*% beta[[fmap[[nm]]]]

inside nlme:::getParsNlme(). fmap[[nm]] is not necessarily a scalar,
so the outer set of [[]] should likely be []. The maintainer of nlme
will know for sure.

-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907



More information about the R-help mailing list