From @tp @end|ng |rom p|@kor@k|@com  Fri Oct  1 11:01:39 2021
From: @tp @end|ng |rom p|@kor@k|@com (Andrew Piskorski)
Date: Fri, 1 Oct 2021 05:01:39 -0400
Subject: [Rd] R 4.1.x make check fails, stats-Ex.R,
 step factor reduced below minFactor
Message-ID: <YVbOc7TQQuUN8tYO@piskorski.com>

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
>    (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


## 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 at piskorski.com>



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