[R] Likelihood returning inf values to optim(L-BFGS-B) other options?

Ravi Varadhan rvaradhan at jhmi.edu
Thu Apr 5 15:27:46 CEST 2007


In your code, the variables x (which I assume is the observed data), Tvec,
and flag are not passed to the function as arguments.  This could be a
potential problem.  Another problem could be that you have to use "negative"
log-likelihood function as input to optim, since by default it "minimizes"
the function, whereas you are interested in finding the argmax of
log-likelihood.  So, in your function you should return (-ll) instead of ll.

If the above strategies don't work, I would try different initial values (it
would be best if you have a data-driven strategy for picking a starting
value) and different optimization methods (e.g. conjugate gradient with
"Polak-Ribiere" steplength option, Nelder-Mead, etc.).  



Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html



-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of r at micom-solutions.de
Sent: Thursday, April 05, 2007 6:12 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Likelihood returning inf values to optim(L-BFGS-B) other

Dear R-help list,

I am working on an optimization with R by evaluating a likelihood  
function that contains lots of Gamma calculations (BGNBD: Hardie Fader  
Lee 2005 Management Science). Since I am forced to implement lower  
bounds for the four parameters included in the model, I chose the  
optim() function mith L-BFGS-B as method. But the likelihood often  
returns inf-values which L-BFGS-B can't deal with.

Are there any other options to implement an optimization algorithm  
with R accounting for lower bounds and a four parameter-space?

Here is the error message I receive (german):
Fehler in optim(c(0.1, 0.1, 0.1, 0.1), fn, method = "L-BFGS-B", lower  
= c(1e-04,  :
	L-BFGS-B benötigt endliche Werte von 'fn'
Zusätzlich: Es gab 50 oder mehr Warnungen (Anzeige der ersten 50 mit  
And this is the likelihood function:
fn<-function(p) {

Thank you very much for your help in advance!

Best regards,


R-help at stat.math.ethz.ch mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list