[R] Bug in optim - way to solve problem?

Jon Olav Skoien skoien at hydro.tuwien.ac.at
Tue Oct 5 14:03:15 CEST 2004


I want to automatically fit variograms to a large number of different 
sample data sets, and call the funtion "likfit" (in package geoR) from 
within a for-loop. "likfit" does again call "optim". After ssuccessfully 
fitting variograms to some of the data sets, the procedure crashes and I 
get the error message:

Error in optim(par = ini, fn = negloglik.GRF, method = "L-BFGS-B", lower = 
lower.optim,  :
         non-finite value supplied by optim

When I restart the procedure with the data set that first caused the error, 
it is usually possible to fit the variogram successfully for this data set, 
but the procedure will crash when fitting to another data set instead. I do 
therefore assume that the problem is not related to my data sets.

I think my problem is the same as one reported earlier, and it seems like 
there is a way around it:
Dr. Hans A. Kestler: [Rd] optim-Bug (PR#6720)

Unfortunately, as I have just started using R, and am not very familiar 
with all of the syntax, I did not understand from these postings how to 
solve the problem. Will I need a fix from somewhere, or should I just do 
some changes in the source code on my computer? And what should I 
eventually change in the source code?

Thanks in advance,

More information about the R-help mailing list