[R] L-BFGS-B needs finite values of 'fn'

From: Jinsong Zhao <jszhao_at_mail.hzau.edu.cn>
Date: Tue, 24 Jun 2008 18:00:46 +0800


Hi,

When I run the following code,

r <- c(3,4,4,3,5,4,5,9,8,11,12,13)
n <- rep(15,12)
x <- c(0, 1.1, 1.3, 2.0, 2.2, 2.8, 3.7, 3.9, 4.4, 4.8, 5.9, 6.8)
x <- log10(x)

fr <- function(c, alpha, beta) {
  P <- c + (1-c) * pnorm(alpha + beta * x)
  P <- pmax(pmin(P,1),0)
  -(sum(log(choose(n,r))) + sum(r * log(P)) + sum((n -r)* log(1-P)))
 }
fit <- mle((fr), start = list(c =0.2, alpha = 0, beta =0.1), method = "L-BFGS-B") I got:

Error in optim(start, f, method = method, hessian = TRUE, ...) :   L-BFGS-B needs finite values of 'fn'

When I change "L-BFGS-B" to "BFGS" or anything else that optim() support, there's no any error message.

What's wrong?

Any suggestions will be appreciated.

Jinsong



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 24 Jun 2008 - 10:10:57 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 24 Jun 2008 - 11:30:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive