R-alpha: R0.13 bugs

Jim Lindsey (jlindsey@luc.ac.be)
Wed, 13 Nov 1996 09:50:51 +0100 (MET)


From: Jim Lindsey <jlindsey@luc.ac.be>
Message-Id: <9611130850.AA04330@alpha.luc.ac.be>
Subject: R-alpha: R0.13 bugs
To: r-testers@stat.math.ethz.ch
Date: Wed, 13 Nov 1996 09:50:51 +0100 (MET)

1. First something from 0.12 that I forgot to report:
  update() for a formula works with lm() but not glm() for which it
  (still in 0.13) gives
  Error in update.formula(call$formula,formula) ...
2. 0.5^0 gives NA
  This is a deliberate programming choice with which I strongly 
  disagree: we can no longer even calculate a binomial probability!
  As well, pow() in C gives the right answer: 0.5^0=1!!  
  Thus, the tests in arithmetic.c for POWOP should be removed:
  integer -  || x2==0
  real    -  && x2!=0
3.Yesterday, I suspected problems with garbage collection in
  optimization. I was getting the message,
  Error: invalid function value in optimizer
  rather randomly and having to leave R to have things work
  again.  I have found at least one of the problems. In optimize.c, in
  F77_SYMBOL(fcn) there is a for loop using i. Further down, there is a
  switch with tests using INTEGER(s)[i] and REAL(s)[i] where i is only
  defined from the loop above. In both places, i should be 0.  However,
  this breaks a lot of my code. I think the function should only be
  tested for illegal values once, at the beginning of the call to nlm
  using the initial values. If they give a valid function value, any
  other calls to the function giving NAs should be set to INT_MAX or
  DBL_MAX in place of the tests above. We are doing minimization so that
  this will direct the optimizer away from an illegal area in the
  parameter space where a constraint should have been applied. (If it is
  really felt necessary, a warning could be printed, but this is not
  really needed because there will already be something like "NAs in
  log" printed.) Leaving this testing to the user in the function will
  make optimization too slow.  Testing and changing the value when the
  function returns eliminates the need to check in lnsrch as was done in
  the previous version. The NAs almost all occur either during
  line-search (lnsrch) or calculating the information matrix (fdhess),
  even although the correct minimum has been found in many cases. A
  simple example that will not work without this fix is a Poisson
  distribution with mean parameter instead of canonical parameter,
  because of the constraint, mu>0. One essential characteristic of an
  optimizer is speed! Do the checking in C, not in the R function.
4. The help for nlm is still called minimize although the contents
  have been updated. As well, when an illegal value is fed to nlm, the
  error message contains msg instead of print.level.
  Jim
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-