[Rd] bounds violations, infinite loops in optim/L-BFGS-B (PR#671)

bolker@zoo.ufl.edu bolker@zoo.ufl.edu
Tue, 26 Sep 2000 16:14:13 +0200 (MET DST)


  I'm having some trouble with optim(method="L-BFGS-B"),
and I'm not sure I have the ability to track down and fix
what seem to be bugs within optim().
  I'm bootstrapping an original data set and fitting a model
to each bootstrapped data set.  For some bootstrapped samples,
optim() sets negative parameter values (despite the fact that
I have explicitly set non-zero lower bounds on the parameters)
and chokes.  For other samples, it appears to get into an infinite
loop (ignoring the finite value of maxit).
 
  Functions and samples that provoke the problem are below: I
was able to reproduce the problems running this with --vanilla.

  Not exactly a bug but: there is no tracing information built
into L-BFGS-B (setting trace=TRUE has no effect).

  Also, a general question: are both nlm() and optim() going to
be around indefinitely?  Should I be using one or the other?

  For the moment I've managed to (sort of) get around the problem
with try(), but the infinite loops are a real nuisance ...

cfunc2_function(input,N1,N2,G=1.0){
  pmin(1,1/((1+((input - N1)/N2))^G))
}

nllfun2g.boot_function(q,debug=FALSE){
#  if (i==93) debug <- TRUE
  N1_q[1]
  N2_q[2]
  G_q[3]
  L_cfunc2(boot.total,N1,N2,G)
  if (debug) cat(c(N1,N2,G,range(L)),"\n")
  r <- -sum(dbinom(boot.pred, boot.total, L, log=TRUE))
  if (!is.finite(r)) {
    cat(c(N1,N2,G,range(L)),"\n")
    cat(boot.pred,"\n")
    cat(boot.total,"\n")
    cat(L,"\n")
    cat(dbinom(boot.pred, boot.total, L, log=TRUE),"\n")
  }
  r
}

fuzz <- 0.001

boot.pred <- c(91,22,44,31,47,83,31,56,22,83,53,73)
boot.total <- c(900,150,900,200,150,100,200,300,150,300,200,500)
n <- try(optim(c(min(boot.total)-1,100,1),nllfun2g.boot,
        lower=rep(fuzz,3),upper=c(min(boot.total)-fuzz,Inf,Inf),
           method="L-BFGS-B",control=list(trace=TRUE),debug=TRUE))

boot.pred <- c(31,73,56,22,22,56,83,22,83,91,30,44)
boot.total <- c(200,100,300,150,150,300,100,150,300,900,500,900)
n <- optim(c(min(boot.total)-1,100,1),nllfun2g.boot,
        lower=rep(fuzz,3),upper=c(min(boot.total)-fuzz,Inf,Inf),
           method="L-BFGS-B",control=list(trace=TRUE),debug=TRUE)


--please do not edit the information below--

Version:
 platform = i686-pc-linux-gnu
 arch = i686
 os = linux-gnu
 system = i686, linux-gnu
 status = 
 major = 1
 minor = 1.1
 year = 2000
 month = August
 day = 15
 language = R

Search Path:
 .GlobalEnv, Autoloads, package:base

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._