[ADMB Users] log_density_poisson

Ben Bolker bbolker at gmail.com
Mon Feb 7 08:11:01 PST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   Well,
<http://admb-foundation.org/documentation/api/default/group__PDF.html>  says

double 	log_density_poisson (double x, double mu)

  So maybe you have a type problem?  Is nlarv a vector of integers or
doubles?  Try (double)nlarv(ihaul)?

  (I don't know why 'x' should be double there, but it is ...)

  Beyond that, nothing looks obviously wrong -- if looking at variable
types doesn't sort it out you might have to post more detail (e.g. a
simple example with a few lines of your data)

On 11-02-07 10:57 AM, Mark Payne wrote:
> Hi,
> 
> I seem to be doing something stupid, but I'm really unsure what it is. Can anyone help?
> 
> My model is fairly simple - essentially a set of Poisson distributed larval count observations that I am trying to model in a likelihood framework. I have written my likelihood as such:
> 
>   //Now calculate the contribution to the likelihood
>   for(int ihaul=1;ihaul<=nhauls;ihaul++) {
>     model_concs_nll(ihaul)= -log_density_poisson(nlarv(ihaul),model_concs(ihaul)) ;
>   }
> 
>   //...and the likelihoods
>   nll = sum(model_concs_nll);
> 
> The problem is that this really seems to break ADMB - below is the output. Note that there are zero iterations, and that the gradients are all NaN. 
> 
>  - final statistics:
> 7 variables; iteration 0; function evaluation 0
> Function value   6.7970e+04; maximum gradient component mag   0.0000e+00
> Exit code = 0;  converg criter   1.0000e-04
> Var   Value    Gradient   |Var   Value    Gradient   |Var   Value    Gradient
>   1 12.18473         -nan |  2 12.18473         -nan |  3 12.18473         -nan
>   4 12.18473         -nan |  5 12.18473         -nan |  6 12.18473         -nan
>   7 12.18473         -nan |
> REPORT SECTION.......
> Estimating row 1 out of 7 for hessian
> Estimating row 2 out of 7 for hessian
> Estimating row 3 out of 7 for hessian
> Estimating row 4 out of 7 for hessian
> Estimating row 5 out of 7 for hessian
> Estimating row 6 out of 7 for hessian
> Estimating row 7 out of 7 for hessian
> 
> 
> This strikes me that I am doing something badly wrong - my guess is that it is related to the log_density_poisson function.
> 
> Does anyone have any insights?
> 
> Cheers,
> 
> Mark
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1QGZUACgkQc5UpGjwzenOsiwCfUqjmZqU93bbgV7ZjFHaEJGrF
jGYAnjo/KlmbNf/7yIzi/PPfULQGcW54
=G8RJ
-----END PGP SIGNATURE-----



More information about the Users mailing list