[R-sig-ME] glmmADMB fails to fit poisson data
dave fournier
davef at otter-rsch.com
Fri Jun 17 18:32:48 CEST 2016
> Thanks Dave. Would you suggest replacing the previous Poisson code
> entirely? (That seems sensible; unfortunately I don't think we have the
> test data for the previous [May 2013] example lying around ... )
>
> Ben
>
> case 0: // Poisson
> if (poiss_prob_bound==0) {
> tmpl = log_density_poisson(y(_i,1),lambda);
> } else {
> if (cph<5)
> tmpl = log(e3+exp(log_density_poisson(y(_i,1),lambda)));
> else
> tmpl = log(e4+exp(log_density_poisson(y(_i,1),lambda)));
> }
> break;
>
> On 16-06-11 10:38 AM, dave fournier wrote:
> >/case 0: // Poisson />/if (cph<2) />/tmpl=-square(log(1.0+y(_i,1))-log(1.0+lambda)); />/else />/tmpl= log_density_poisson(y(_i,1),lambda); />/break;/
I would use
tmpl=-square(log(1.0+y(_i,1))-log(1.0+lambda));
for all cases in phase 1 of the minimization. This provides decent
initial values for
the poisson_density. However replacling
tmpl = log_density_poisson(y(_i,1),lambda);
with something like
tmpl = log(e3+exp(log_density_poisson(y(_i,1),lambda)));
in some of the higher phase also serves another purpose. Even when a
lot of the
observations fit the model well there may be some outliers which can
make the
arithmetic for calculating the mode of the random effects unstable for
particular
values of the other model parameters picked by the optimization routine.
The modification
tends to make the calculations more stable. This was kind of a "quick
fix" when the code
was initially being developed. I'm sure it could be improved.
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models
mailing list