[R-sig-eco] NaNs produced in the process of maximum likelihood

Ben Bolker bbolker at gmail.com
Mon Oct 24 03:05:51 CEST 2011


lgj200306 <lgj200306 at ...> writes:

> 
> Thaks David very much, but how can I 
>  improve my model? Should I change my likelihood function 
> or do some thing else?
> Best wishes for all list members!

  Your choices are:

 (1) if the final result looks sensible, and none of the final
predicted values lead to NA/NaN results, you can *probably* ignore these
warnings

 (2) depending on your model, you may be able to bound
some of the parameters (e.g. using method="L-BFGS-B"
and specifying lower/upper values) *or* fit them on a different scale
(e.g. the log scale) to prevent zero/negative predicted
values of lambda (predicted values of zero will be OK
as long as they always go with observed values of zero --
otherwise you'll get infinite (negative) log-likelihood
values. There are some simple examples of bounded optimization
in the ?mle2 examples ...

> 
> At 2011-10-21 04:05:10,"David Valentim Dias" 
> <dvdscripter <at> gmail.com> wrote:
> Should be a bad parameter like you get from dpois(1, -1)
> 
> 2011/10/20 lgj200306<lgj200306 <at> 163.com>
> Hi, all
> I have a problem about the log maximum likelihood.
> I want to estimate several parameters using 
> log maximum likelihood method (mle2() in package "bbmle" ),
> and the likelihood fucton was based on poisson distribution.
> When finished, there were some warnings said that:
>  >In dpois(x, lambda, log) : NaNs produced
> Will this situation influence my result of 
> parameters estimating or not? If my parameters estimated have
> been influenced, how can I improve my R code 
> or data to achieve a exact estimating?
> Thanks for you attention and best wishes for all of you!
> Guojun Lin
> South China Botanical Garden, Chinese Academy of Science, China
> Department of Renewable Resources, University of Alberta, Canada



More information about the R-sig-ecology mailing list