[R] NaN produced from log() with positive input

Arne Henningsen arne.henningsen at gmail.com
Sun Jul 12 08:23:57 CEST 2015


Dear Maram

On 8 July 2015 at 17:52, Maram Salem <marammagdysalem at gmx.com> wrote:
> Dear Arne,
>
> On a second thought, as per your mail "the warning messages occur each time,
> when maxLik() tries to calculate
> the logLik value for theta[1] <= 0, theta[1] + theta[2] <= 0, theta[3] <= 0
> or something similar."
>
> The component of the theta vector are all indeed strictly positive, and the
> initial values I used are c(40,50,2). and this means that " theta[1] > 0,
> theta[1] + theta[2] > 0, and theta[3] > 0 ".  These initial values are the
> parameter values that were used for generating the data (the C and T
> vectors). That's why I don't know why the warnings occur in the first place
> and why the estimates are far away from the initial values.a
> Any suggestions?

- don't send your messages twice;

- do what I suggested in my previous e-mail;

- increase the number of observations;

- check your log-likelihood function;

- use an optimisation algorithm that does not use derivatives;

- use numeric derivatives in the optimisation;

- check your function for returning the derivatives of the
log-likelihood function, e.g. with compareDerivatives();

- check the data generating process

Best regards,
Arne

-- 
Arne Henningsen
http://www.arne-henningsen.name



More information about the R-help mailing list