[Rd] R 4.1.x make check fails, stats-Ex.R, step factor reduced below minFactor

Martin Maechler m@ech|er @end|ng |rom @t@t@m@th@ethz@ch
Fri Oct 1 15:45:48 CEST 2021


>>>>> Andrew Piskorski 
>>>>>     on Fri, 1 Oct 2021 05:01:39 -0400 writes:

    > I recently built R 4.1.1 (Patched) from source, as I have many older
    > versions over the years.  This version, on Ubuntu 18.04.4 LTS:

    > R 4.1.1 (Patched), 2021-09-21, svn.rev 80946, x86_64-pc-linux-gnu

    > Surprisingly, "make check" fails, which I don't recall seeing before.
    > The error is in from stats-Ex.R, which unfortunately terminates all
    > further testing!  This particular error, "step factor ... reduced
    > below 'minFactor'" does not seem very serious, but I can't figure out
    > why it's happening.

    > I installed with "make install install-tests" as usual, which seemed
    > to work fine.  Running the same tests after install, I'm able to get
    > more coverage by using errorsAreFatal=FALSE.  However, it seems the
    > rest of the 'stats' tests after the bad one still do not run.

    > I'm confused about the intent of this particular test.  The comment
    > above it seems to says that it's SUPPOSED to throw this error, yet
    > getting the error still terminates further testing, which seems
    > strange.  What's supposed to happen here?

    > Any ideas on why this error might be occurring, and how I should debug
    > it?  What's the right way for me to disable this one failing test, so
    > the ones after it can run?

    > Thanks for your help!


    > ## "make check" output:
    > make[1]: Entering directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests'
    > make[2]: Entering directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests'
    > make[3]: Entering directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests/Examples'
    > Testing examples for package 'base'
    > Testing examples for package 'tools'
    > comparing 'tools-Ex.Rout' to 'tools-Ex.Rout.save' ... OK
    > Testing examples for package 'utils'
    > Testing examples for package 'grDevices'
    > comparing 'grDevices-Ex.Rout' to 'grDevices-Ex.Rout.save' ... OK
    > Testing examples for package 'graphics'
    > comparing 'graphics-Ex.Rout' to 'graphics-Ex.Rout.save' ... OK
    > Testing examples for package 'stats'
    > Error: testing 'stats' failed
    > Execution halted
    > Makefile:37: recipe for target 'test-Examples-Base' failed
    > make[3]: *** [test-Examples-Base] Error 1
    > make[3]: Leaving directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests/Examples'
    > ../../tests/Makefile.common:198: recipe for target 'test-Examples' failed
    > make[2]: *** [test-Examples] Error 2
    > make[2]: Leaving directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests'
    > ../../tests/Makefile.common:184: recipe for target 'test-all-basics' failed
    > make[1]: *** [test-all-basics] Error 1
    > make[1]: Leaving directory '/home/nobackup/co/R/R-4-1-branch/Build-x86_64/tests'
    > Makefile:305: recipe for target 'check-all' failed
    > make: *** [check-all] Error 2


    > ## From file:  tests/Examples/stats-Ex.Rout.fail

    >> ## Here, requiring close convergence, you need to use more accurate numerical
    >> ##  differentiation; this gives Error: "step factor .. reduced below 'minFactor' .."
    >> options(digits = 10) # more accuracy for 'trace'
    >> ## IGNORE_RDIFF_BEGIN
    >> try(nlm1 <- update(nlmod, control = list(tol = 1e-7))) # where central diff. work here:
    > Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default",  :
    > No starting values specified for some parameters.
    > Initializing 'Const', 'A', 'B' to '1.'.
    > Consider specifying 'start' or using a selfStart model

So this did give an error we expected (on some platforms only),
hence used try().

However, the next one "should work" (*)
and failing there, *does* fail the tests :

    >> (nlm2 <- update(nlmod, control = list(tol = 8e-8, nDcentral=TRUE), trace=TRUE))
    > Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default",  :
    > No starting values specified for some parameters.
    > Initializing 'Const', 'A', 'B' to '1.'.
    > Consider specifying 'start' or using a selfStart model
    > 1017460.306    (4.15e+02): par = (1 1 1)
    > 758164.7503    (2.34e+02): par = (13.42031396 1.961485 0.05947543745)
    > 269506.3538    (3.23e+02): par = (51.75719816 -13.09155957 0.8428607709)
    > 68969.21893    (1.03e+02): par = (76.0006985 -1.935226745 1.0190858)
    > 633.3672230    (1.29e+00): par = (100.3761515 8.624648402 5.104490259)
    > 151.4400218    (9.39e+00): par = (100.6344391 4.913490985 0.2849209569)
    > 53.08739850    (7.24e+00): par = (100.6830407 6.899303317 0.4637755074)
    > 1.344478640    (5.97e-01): par = (100.0368306 9.897714142 0.5169294939)
    > 0.9908415909   (1.55e-02): par = (100.0300625 9.9144191 0.5023516843)
    > 0.9906046057   (1.84e-05): par = (100.0288724 9.916224018 0.5025207336)
    > 0.9906046054   (9.95e-08): par = (100.028875 9.916228366 0.50252165)
    > 0.9906046054   (9.93e-08): par = (100.028875 9.916228366 0.50252165)
    > Error in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default",  : 
    > step factor 0.000488281 reduced below 'minFactor' of 0.000976562
    > Calls: update -> update.default -> eval -> eval -> nls
    > Execution halted

On our versions of Linux (and hardware in case it should matter: Intel x64), 
the above has always worked:
e.g.,

> (nlm2 <- update(nlmod, control = list(tol = 8e-8, nDcentral=TRUE), trace=TRUE))
Warning in nls(formula = y ~ Const + A * exp(B * x), algorithm = "default",  :
  No starting values specified for some parameters.
Initializing ‘Const’, ‘A’, ‘B’ to '1.'.
Consider specifying 'start' or using a selfStart model
1017460.306    (4.15e+02): par = (1 1 1)
758164.7503    (2.34e+02): par = (13.42031396 1.961485 0.05947543746)
269506.3540    (3.23e+02): par = (51.75719814 -13.09155954 0.8428607699)
68969.21900    (1.03e+02): par = (76.00069849 -1.93522673 1.019085799)
633.3672239    (1.29e+00): par = (100.3761515 8.62464841 5.104490279)
151.4400266    (9.39e+00): par = (100.6344391 4.913490966 0.284920948)
53.08740235    (7.24e+00): par = (100.6830408 6.899303242 0.4637755057)
1.344478691    (5.97e-01): par = (100.0368306 9.89771414 0.5169294949)
0.9908415909   (1.55e-02): par = (100.0300625 9.9144191 0.5023516842)
0.9906046057   (1.84e-05): par = (100.0288724 9.916224018 0.5025207337)
0.9906046054   (9.94e-08): par = (100.028875 9.916228366 0.50252165)
0.9906046054   (5.06e-10): par = (100.028875 9.916228388 0.5025216549)
Nonlinear regression model
  model: y ~ Const + A * exp(B * x)
   data: parent.frame()
      Const           A           B 
100.0288750   9.9162284   0.5025217 
 residual sum-of-squares: 0.9906046

However, we had heard of "strange platforms" where it failed,
--> R's bugzilla PR#18165
and for that reason, in the R-devel version of that source file
 <Rsrc>/src/library/stats/man/nls.Rd

have the code amended to not stop on error on those platforms
only:

o2 <- options(digits = 10) # more accuracy for 'trace'
## central differencing works here typically (PR#18165: not converging on *some*):
ctr2 <- nls.control(nDcentral=TRUE, tol = 8e-8, # <- even smaller than above
   warnOnly = (grepl("^aarch64.*linux", R.version$platform) && grepl("^NixOS", osVersion)
              ))
(nlm2 <- update(nlmod, control = ctr2, trace = TRUE)); options(o2)

... now would that run w/o error on your Ubuntu-installed R ?

First guess: no

Is there anything special (system libraries, compilers, ..)
on your platform?

If not, I do wonder because indeed the

   example(nls)

R code (indeed the full help page) is identical as in R 4.1.1,
and I think we can assume for sure that these examples have run
satisfactorily on most Ubuntu 18.04 LTS, no?



    > ## After install, start R with --vanilla and run tests like this:
    > ## https://cran.r-project.org/doc/manuals/r-patched/R-admin.html#Testing-a-Unix_002dalike-Installation
    > Sys.setenv(LC_COLLATE = "C", LC_TIME = "C", LANGUAGE = "en")
    > pdf("tests.pdf")
    > tools::testInstalledPackages(scope="base", errorsAreFatal=FALSE)

    > -- 
    > Andrew Piskorski <atp using piskorski.com>

    > ______________________________________________
    > R-devel using r-project.org mailing list
    > https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list