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

Ravi Varadhan ravi.varadhan at jhu.edu
Wed Nov 11 20:32:36 CET 2015

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