[R] .Internal(optim)

Sundar Dorai-Raj sundar.dorai-raj at pdf.com
Wed Jul 9 21:54:05 CEST 2003



Edoardo Airoldi wrote:
>> hi all,
>>  I am using optim.  I am getting the following error message:
>>
>> Error in optim(par = start.vals[, h], fn = post.func.pois, gr = 
>> post.grad.
>> pois,  :
>>         L-BFGS-B needs finite values of fn
>>
>> If I look at optim typing '> optim' it seems that the error comes from 
>> inside .Internal(optim), so I wonder how can I see the code for 
>> .Internal(
>> optim)?
>>
>> thanks
>> Edo
>>
>>
> 

Actually, the error means that your function (post.func.pois) is 
returning a infinite value. I usually put print statements in to see 
where this is happening. As in,

post.func.pois = function(par, ...) {
...
print(par)
print(some.operation(par)) # etc.
...
return(value) # if this is Inf, optim will stop
}

If you really think you need to see the optim source code, you can 
downdload the source from cran and look for optim.c.

Regards,
Sundar




More information about the R-help mailing list