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

Ravi Varadhan ravi.varadhan at jhu.edu
Wed Nov 11 21:54:03 CET 2015

It seems like there is substantial finite-sample bias in the MLEs.  Either that or there is some error in your procedure.  See attached code.


From: Ravi Varadhan
Sent: Wednesday, November 11, 2015 2:33 PM
To: 'denizozonur at gazi.edu.tr' <denizozonur at gazi.edu.tr>; r-help at r-project.org
Cc: 'profjcnash at gmail.com' <profjcnash at gmail.com>
Subject: Re: [R] About error: L-BFGS-B needs finite values of 'fn'

With a small sample size, n=30, you will have realizations of data where you will run into difficulties with the MLE of generalized Gamma distribution.  This is mainly due to the `k' parameter.  Increase the sample size (e.g., n=50 or 100) and this problem is less likely to happen (but can still happen).

I would strongly suggest that when you are doing simulations, you should encapsulate the parameter estimation inside a `try' or `tryCatch' statement so that when there is an error, the simulation keeps going rather than crashing out.

See the attached code.


Ravi Varadhan, Ph.D. (Biostatistics), Ph.D. (Environmental Engg)
Associate Professor,  Department of Oncology
Division of Biostatistics & Bionformatics
Sidney Kimmel Comprehensive Cancer Center
Johns Hopkins University
550 N. Broadway, Suite 1111-E
Baltimore, MD 21205

More information about the R-help mailing list