Addressing Bugs in nlme

R
C
Models
Addressing open bugs on the recommended package nlme for (non)linear mixed effect models.
Author

Heather Turner and Ben Bolker

Background

The nlme package (maintained by R-core) has a medium-sized list of bugs reported, reaching back over 5 years. In some cases there is already a patch or a proposed solution. Other cases require some discussion or further debugging to determine an appropriate solution. Often only the R code is affected and the problem is more about determining the correct behaviour rather than debugging low-level code, though that will be required in the hardest cases.

This project would suit a group of people working in twos or threes, with each small group aiming to close one or two bugs during the sprint.

The nlme package is version controlled in a Subversion repository, available at https://svn.r-project.org/R-packages/trunk/nlme/.

Problem statement

The list of nlme bugs on R’s Bugzilla as of 23 June 2023 is summarised below:

Bug ID Level Status Topic Action(s) Programming skills Statistical knowledge
18505 Novice patch available behaviour changing with order of group variable check patch R
17884 Novice patch available new confint.lme method for fixed effects only check patch R confidence intervals
17988 Novice suggested solution what to return for corARMA with p = q = 0 check patch, update doc R
18472 Intermediate needs reprex correct behaviour of gls create reprex, discuss R gls
17712 Intermediate suggested solution conditions when algorithm should use decomposition create patch, check patch R
18285 Intermediate suggested solution how to handle rank deficiency discuss, create reprex, create patch R rank deficiency
17961 Intermediate unclear if bug or not appropriate df to use in tests discuss R anova tests
17866 Intermediate reprex available Initializing corStruct outside gls call gives different results debug R
16890 Intermediate patch welcome intervals.lmList does not work for with pool = FALSE create patch R
18192 Intermediate needs analysis crash in nlme equivalent to lme model debug R/C C
17227 Intermediate partial analysis available crash in nlme debug R/C C
16864 Advanced needs analysis lme fails to warn when data are near-redundant debug R/C/Fortran R, C, Fortran
16975 Advanced needs analysis REML estimation incorrect with fixed sigma debug R, C
17236 Advanced needs support from R Core Correct df for intercept in lme discuss, create patch, check patch R
18433 Advanced needs reprex infinite loop dependent on random seed create reprex, debug C, Docker nlme algorithms
16806 Advanced patch welcome method fails for individuals with single observations create patch C

Proposed solution

The table in the last section summarises the next action(s) required to address the different bugs. In more detail:

  • check patch

    • Check the bug is still present in the development version of nlme.

    • Apply the patch to the nlme sources, build and install the package, and test a reprex to confirm the patch fixes the issue.

    • Run R CMD check on the built package to check nothing is broken by the change.

  • update doc

    • Modify the source of the documentation file in the nlme sources.

    • Review your changes (e.g. Preview in RStudio or build and install to view).

    • Create a patch to include both code and documentation changes.

  • create reprex

    • Create a minimal, reproducible example, using only base R packages plus nlme, that demonstrates the issue. In complex cases, this may require creating a Docker image so that the whole environment is reproducible.
  • discuss

    • Discuss what the appropriate behaviour of the code should be, or discuss a proposal to clarify the way forward. Summarize conclusions on Bugzilla or agree a way forward with a member of R Core.
  • debug

    • Identify the parts of the code that are the root cause of the issue. This may not always be code that triggers an error, but code that does not produce the correct result in particular circumstances.
  • create patch

    • Modify the R and/or C source code to implement a proposed change. This can involve substantial work to determine the appropriate changes to make and may be an iterative process with feedback from others.

Testing

In general, we will rely on the tests included in the nlme package. It may be appropriate to propose additions to this test suite to cover the code added/modified when addressing a bug report.

We may also run reverse dependency checks to check changes do not break packages that depend on nlme.

Project requirements

Familiarity with Subversion will be helpful, however note that you can create a RStudio package project from the repository URL: https://svn.r-project.org/R-packages/trunk/nlme/.

Familiarity with R package development will be helpful, though again RStudio makes it simple to run R CMD check on the package or to build and install from source. Note that documentation in nlme is written directly in .Rd format.

On MacOS you should have the mandatory development tools, Xcode and GNU Fortran installed.

On Windows you should have RTools installed.

Project resources

Project outcomes

Contribution to a recommended package (potentially acknowledged in the ChangeLog).

Experience with the package development process.

Experience with creating/applying patches with Subversion.

Experiences working with bug reports on Bugzilla.

Reactions and comments