[R] Bug in optim - way to solve problem?
Peter Dalgaard
p.dalgaard at biostat.ku.dk
Tue Oct 5 14:44:30 CEST 2004
Jon Olav Skoien <skoien at hydro.tuwien.ac.at> writes:
> Hi,
>
> 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)
> http://r-bugs.biostat.ku.dk/cgi-bin/R/Analyses-fixed?id=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?
If you find a bug report sitting in Whatever-fixed, it usually
means that the bug was fixed... The question is then whether your
version is older or newer than the fix (you're not telling us) since
we can't fix bugs retroactively.
(There is an interim between releases where fixes are available only
as source patches, but give that we had a major release yesterday,
that hardly applies.)
This sort of error is generally related to uninitialized data, and
(IIRC) that was indeed the issue in PR#6720. However, there's no
guarantee that this was the only bug, nor that there wouldn't be one
of the same sort in geoR, or indeed your own code.
Anyways, the first thing to try would be to upgrade R and geoR. If
that doesn't help, try putting together a reproducible example
(w/data), and let people here (or better: on the r-devel list) see if
they can spot the problem.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
More information about the R-help
mailing list