[R] ..nlme: start values necessary even though using self-start function?..

176 views
Skip to first unread message

Matthias Kuhn

unread,
Sep 30, 2014, 4:15:22 AM9/30/14
to r-h...@r-project.org
Dear list.

I am stuck with an "subscript out of bounds" error when I play with an
nlme-example from the yellow Pinheiro/Bates book. It is about using
nlme() using the formula interface for non-linear mixed models.

The following code snippet is inspired by the book (in section 8.2),
using the Orange-example data from R datasets containing repeated
measures of trunk circumferences over time for 5 trees. It is a
nfnGroupedData with structure circumference ~ age | Tree.


nlme( circumference ~ SSlogis(age, Asym, xmid, scal), data=Orange,
fixed= Asym + xmid + scal ~ 1)

It results in the following error:
Error in nlme.formula(circumference ~ SSlogis(age, Asym, xmid, scal), :
subscript out of bounds

Specifiying the grouping as in groups=~Tree does not help, either.

When I do provide start values, it works, though.

nlme( circumference ~ SSlogis(age, Asym, xmid, scal), data=Orange,
start=c(Asym = 200, xmid=725, scal=350),
fixed= Asym + xmid + scal ~ 1)

Beginning of result output:

Nonlinear mixed-effects model fit by maximum likelihood
Model: circumference ~ SSlogis(age, Asym, xmid, scal)
Data: Orange
Log-likelihood: -129.9907
Fixed: Asym + xmid + scal ~ 1
Asym xmid scal
192.0959 727.5887 356.6011
...

SSlogis() is a selfStart object and should be able to get its own
starting values like so:
getInitial(circumference ~ SSlogis(age, Asym, xmid, scal), data=Orange)


So start= argument should not be necessary.
What am I missing here? Any ideas?

Thanks in advance..

-m

ps> This is my setting:

> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] nlme_3.1-117 devtools_1.5

loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.5 grid_3.1.1 httr_0.5
lattice_0.20-29 memoise_0.2.1 parallel_3.1.1 RCurl_1.95-4.3
stringr_0.6.2 tools_3.1.1 whisker_0.3-2

And regarding my nlme-package from CRAN:

Information on package ‘nlme’


Description:


Package: nlme

Version: 3.1-117

Date: 2014-03-31

Priority: recommended

Title: Linear and Nonlinear Mixed Effects Models

Authors@R: c(person("José", "Pinheiro", role = "aut", comment
= "S version"), person("Douglas", "Bates", role = "aut", comment = "up
to 2007"), person("Saikat", "DebRoy", role = "ctb", comment = "up
to 2002"), person("Deepayan", "Sarkar", role = "ctb",
comment = "up to 2005"), person("EISPACK authors", role = "ctb",
comment = "src/rs.f"), person("R-core", email =

"R-c...@R-project.org", role = c("aut", "cre")))

Description: Fit and compare Gaussian linear and nonlinear
mixed-effects models.

Depends: graphics, stats, R (>= 3.0.0)

Imports: lattice

Suggests: Hmisc, MASS

LazyData: yes

ByteCompile: yes

Encoding: UTF-8

License: GPL (>= 2)

BugReports: http://bugs.r-project.org

Packaged: 2014-03-31 07:56:40 UTC; ripley

Author: José Pinheiro [aut] (S version), Douglas Bates
[aut] (up to 2007), Saikat DebRoy [ctb] (up to 2002), Deepayan Sarkar
[ctb] (up to 2005), EISPACK authors [ctb] (src/rs.f), R-core [aut,

cre]

Maintainer: R-core <R-c...@R-project.org>

NeedsCompilation: yes

Repository: CRAN

Date/Publication: 2014-03-31 10:16:43

Built: R 3.1.1; x86_64-apple-darwin13.1.0; 2014-07-11
12:37:41 UTC; unix

______________________________________________
R-h...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Prof Brian Ripley

unread,
Sep 30, 2014, 7:48:26 AM9/30/14
to Matthias Kuhn, r-h...@r-project.org
This seems to be a bug in the package. Maybe the code was written for
S, or maybe R has changed in the many years since the former maintainer
decided to be unhelpful.

I'll put this on the list for the next release.


--
Brian D. Ripley, rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

Reply all
Reply to author
Forward
0 new messages