<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body style="word-wrap:break-word">
Mark, I like you suggestions 1&2.  It would be easy to write a wrapper for the existing functions.  Not sure how to deal with the existing names.  I just dont want to go in and change all the R names, as I fear it would break a lot of code out there. Should
 have thought this out better 5 years ago when I did this stuff.  But perhaps I'm the only one using dnorm etc.
<div><br>
</div>
<div>S<br>
<div>
<div>On Oct 2, 2014, at 11:10 AM, Mark Maunder <<a href="mailto:mmaunder@iattc.org">mmaunder@iattc.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div lang="EN-US" style="font-family:Helvetica; font-size:18px; font-style:normal; font-variant:normal; font-weight:normal; letter-spacing:normal; line-height:normal; orphans:auto; text-align:start; text-indent:0px; text-transform:none; white-space:normal; widows:auto; word-spacing:0px">
<div class="WordSection1" style="">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">Should there be a naming convention so that</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">nll_xxxx gives a negative log likelihood</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">lnl_xxxx gives a log likelihood</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">R names gives a likelihood or distribution</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)">And it is up to the user to choose the nll for an objective function?</span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"></span></div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:11pt; font-family:Calibri,sans-serif; color:rgb(31,73,125)"> </span></div>
<div>
<div style="border-style:solid none none; border-top-color:rgb(181,196,223); border-top-width:1pt; padding:3pt 0in 0in">
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<b><span style="font-size:10pt; font-family:Tahoma,sans-serif">From:</span></b><span style="font-size:10pt; font-family:Tahoma,sans-serif"><span class="Apple-converted-space"> </span><a href="mailto:users-bounces@admb-project.org" style="color:purple; text-decoration:underline">users-bounces@admb-project.org</a><span class="Apple-converted-space"> </span>[<a href="mailto:users-bounces@admb-project.org" style="color:purple; text-decoration:underline">mailto:users-bounces@admb-project.org</a>]<span class="Apple-converted-space"> </span><b>On
 Behalf Of<span class="Apple-converted-space"> </span></b>Steve Martell<br>
<b>Sent:</b><span class="Apple-converted-space"> </span>Thursday, October 02, 2014 11:06 AM<br>
<b>To:</b><span class="Apple-converted-space"> </span>Aaron Greenberg<br>
<b>Cc:</b><span class="Apple-converted-space"> </span><a href="mailto:users@admb-project.org" style="color:purple; text-decoration:underline">users@admb-project.org</a>; Carlos Martorell<br>
<b>Subject:</b><span class="Apple-converted-space"> </span>Re: [ADMB Users] Problem with negative log likelihoods?</span></div>
</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
All the functions in statsLib return the negative log likelihood. ADMB minimizes the negative loglikelihoods.  It does not maximize a function. So for me it seemed obvious that the functions should return the negative loglikelihood.  But that was a choice I
 made.  If someone wants to change it, the open source platform allows you to do just that.  But if you do change it, please warn all others who use these functions to reverse the sign in their objective functions.</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
There was a bug in the vectorized version of dpois, so I fixed it.  I very much appreciate Carlos pointing the bug out. I guess this is how open source software is supposed to work.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Grumpy Steve</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
<div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
On Oct 2, 2014, at 10:56 AM, bigA <<a href="mailto:jaguar.smart@gmail.com" style="color:purple; text-decoration:underline">jaguar.smart@gmail.com</a>> wrote:</div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<br>
<br>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
If I am not mistaken, in Iceland, there was substantial discussion amongst  developers about what functions returned log-likelihood and which functions returned negative log-likelihood.</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
If I am not mistaken this hasn't been standardized; it is often different from R.  </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
The difference between the two versions of <span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">00075 appears to simply be a negative sign?</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">Is this a documentation failure or a bug?</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">Aaron</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)"><br>
<br>
</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">nll -= -k(i)*</span><span style="font-size:10pt; font-family:Arial,sans-serif"><a href="http://admb-project.org/documentation/api/d3arr2a_8cpp.html#a921f553085254834ebbe598d5e9c0341" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="font-size:9pt; font-family:'Courier New'; color:rgb(70,101,162); text-decoration:none">log</span></a></span><span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">(lambda(i))+lambda(i)+</span><span style="font-size:10pt; font-family:Arial,sans-serif"><a href="http://admb-project.org/documentation/api/group__gammafunc.html#gae01374ddda83bc2216ba9df9c76d9995" target="_blank" title="Log gamma function." style="color:purple; text-decoration:underline"><span style="font-size:9pt; font-family:'Courier New'; color:rgb(70,101,162); text-decoration:none">gammln</span></a></span><span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">(k(i)+1.);</span><span style="font-size:10pt; font-family:Arial,sans-serif"></span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">vs</span></div>
</div>
<div>
<div style="border:1pt solid rgb(214,229,196); padding:3pt 5pt; background-color:rgb(252,253,251); margin-left:1.5pt; margin-right:6pt">
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in; white-space:pre-wrap; word-wrap:break-word; overflow:auto"><span style="font-size:9pt"> nll -= k(i)*<a href="http://admb-project.org/documentation/api/d3arr2a_8cpp.html#a921f553085254834ebbe598d5e9c0341" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">log</span></a>(lambda(i))+lambda(i)+<a href="http://admb-project.org/documentation/api/group__gammafunc.html#gae01374ddda83bc2216ba9df9c76d9995" target="_blank" title="Log gamma function." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">gammln</span></a>(k(i)+1.);</span></pre>
</div>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
On Tue, Sep 30, 2014 at 6:57 PM, Carlos Martorell <<a href="mailto:martorell@ciencias.unam.mx" target="_blank" style="color:purple; text-decoration:underline">martorell@ciencias.unam.mx</a>> wrote:</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Hi,</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
After checking the output of an ADMB run I believe that I have found a problem in (at least) a couple of the functions used to calculate the negative log-likelihoods in dpois and dnbinom functions in the statsLib.h library. When a vector of parameters (lambdas
 in the Poisson case) is provided, the code for the log-likelihood is</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="border:1pt solid rgb(214,229,196); padding:3pt 5pt; background-color:rgb(252,253,251); margin-left:1.5pt; margin-right:6pt">
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in; word-wrap:break-word; overflow:auto"><span style="font-size:9pt">00067 <a href="http://admb-project.org/documentation/api/classdvariable.html" target="_blank" title="Fundamental data type for reverse mode automatic differentiation." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvariable</span></a> <a href="http://admb-project.org/documentation/api/dpois_8cpp.html#a64d2001c40c90f8295bd86ea88ff6979" target="_blank" style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dpois</span></a>(<span style="color:green">const</span> <a href="http://admb-project.org/documentation/api/classdvector.html" target="_blank" title="Vector of double precision numbers." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvector</span></a>& k, <span style="color:green">const</span> <a href="http://admb-project.org/documentation/api/classdvar__vector.html" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvar_vector</span></a>& lambda)</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00068"></a><span style="font-size:9pt">00068 {</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00069"></a><span style="font-size:9pt">00069   <a href="http://admb-project.org/documentation/api/group__RA.html#ga9616d0c80845da3942a30acbb1dbbfa9" target="_blank" title="Increments gradient_structure::RETURN_ARRAYS_PTR." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">RETURN_ARRAYS_INCREMENT</span></a>();</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00070"></a><span style="font-size:9pt">00070   <span style="color:rgb(96,64,32)">int</span> i;</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00071"></a><span style="font-size:9pt">00071   <span style="color:rgb(96,64,32)">int</span> n = <a href="http://admb-project.org/documentation/api/dsize_8cpp.html#aa42ba747b253f027435b478a7d747f52" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">size_count</span></a>(k);</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00072"></a><span style="font-size:9pt">00072   <a href="http://admb-project.org/documentation/api/classdvariable.html" target="_blank" title="Fundamental data type for reverse mode automatic differentiation." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvariable</span></a> nll=0;</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00073"></a><span style="font-size:9pt">00073   <span style="color:rgb(224,128,0)">for</span>(i = 1; i <= n; i++)</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00074"></a><span style="font-size:9pt">00074   {</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00075"></a><span style="font-size:9pt">00075     nll -= k(i)*<a href="http://admb-project.org/documentation/api/d3arr2a_8cpp.html#a921f553085254834ebbe598d5e9c0341" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">log</span></a>(lambda(i))+lambda(i)+<a href="http://admb-project.org/documentation/api/group__gammafunc.html#gae01374ddda83bc2216ba9df9c76d9995" target="_blank" title="Log gamma function." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">gammln</span></a>(k(i)+1.);</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00076"></a><span style="font-size:9pt">00076   }</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00077"></a><span style="font-size:9pt">00077   <a href="http://admb-project.org/documentation/api/group__RA.html#ga780ea9f1c9038a5116c28140166d6e7e" target="_blank" title="Decrements gradient_structure::RETURN_ARRAYS_PTR." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">RETURN_ARRAYS_DECREMENT</span></a>();</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00078"></a><span style="font-size:9pt">00078   <span style="color:rgb(224,128,0)">return</span> nll;</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00079"></a><span style="font-size:9pt">00079 }</span></pre>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
I believe that the correct code for line 00075 should be</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">nll -= -k(i)*</span><a href="http://admb-project.org/documentation/api/d3arr2a_8cpp.html#a921f553085254834ebbe598d5e9c0341" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="font-size:9pt; font-family:'Courier New'; color:rgb(70,101,162); text-decoration:none">log</span></a><span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">(lambda(i))+lambda(i)+</span><a href="http://admb-project.org/documentation/api/group__gammafunc.html#gae01374ddda83bc2216ba9df9c76d9995" target="_blank" title="Log gamma function." style="color:purple; text-decoration:underline"><span style="font-size:9pt; font-family:'Courier New'; color:rgb(70,101,162); text-decoration:none">gammln</span></a><span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">(k(i)+1.);</span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:9pt; font-family:'Courier New'; background-color:rgb(252,253,251)">This is evident in the same function when lambda is constant, e.g., </span></div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="border:1pt solid rgb(214,229,196); padding:3pt 5pt; background-color:rgb(252,253,251); margin-left:1.5pt; margin-right:6pt">
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in; word-wrap:break-word; overflow:auto"><span style="font-size:9pt"><a href="http://admb-project.org/documentation/api/statsLib_8h.html#a64d2001c40c90f8295bd86ea88ff6979" target="_blank" style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">00035</span></a> <a href="http://admb-project.org/documentation/api/classdvariable.html" target="_blank" title="Fundamental data type for reverse mode automatic differentiation." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvariable</span></a> <a href="http://admb-project.org/documentation/api/dpois_8cpp.html#a64d2001c40c90f8295bd86ea88ff6979" target="_blank" style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dpois</span></a>(<span style="color:green">const</span> <span style="color:rgb(96,64,32)">double</span>& k, <span style="color:green">const</span> <a href="http://admb-project.org/documentation/api/classprevariable.html" target="_blank" title="Base class for dvariable." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">prevariable</span></a>& lambda)</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00036"></a><span style="font-size:9pt">00036 {</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00037"></a><span style="font-size:9pt">00037   <a href="http://admb-project.org/documentation/api/group__RA.html#ga9616d0c80845da3942a30acbb1dbbfa9" target="_blank" title="Increments gradient_structure::RETURN_ARRAYS_PTR." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">RETURN_ARRAYS_INCREMENT</span></a>();</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00038"></a><span style="font-size:9pt">00038   <a href="http://admb-project.org/documentation/api/classdvariable.html" target="_blank" title="Fundamental data type for reverse mode automatic differentiation." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">dvariable</span></a> tmp = -k*<a href="http://admb-project.org/documentation/api/d3arr2a_8cpp.html#a921f553085254834ebbe598d5e9c0341" target="_blank" title="Description not yet available." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">log</span></a>(lambda)+lambda + <a href="http://admb-project.org/documentation/api/group__gammafunc.html#gae01374ddda83bc2216ba9df9c76d9995" target="_blank" title="Log gamma function." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">gammln</span></a>(k+1.);</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00039"></a><span style="font-size:9pt">00039   <a href="http://admb-project.org/documentation/api/group__RA.html#ga780ea9f1c9038a5116c28140166d6e7e" target="_blank" title="Decrements gradient_structure::RETURN_ARRAYS_PTR." style="color:purple; text-decoration:underline"><span style="color:rgb(70,101,162); text-decoration:none">RETURN_ARRAYS_DECREMENT</span></a>();</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00040"></a><span style="font-size:9pt">00040   <span style="color:rgb(224,128,0)">return</span> tmp;</span></pre>
<pre style="margin:0in 0in 3pt; font-size:10pt; font-family:'Courier New'; line-height:11.25pt; background-color:rgb(252,253,251); border:none; padding:0in"><a name="148ccdcf03885333_l00041"></a><span style="font-size:9pt">00041 }</span></pre>
</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
I found these codes both in the ADMB version that I downloaded and in the package documentation (<a href="http://admb-project.org/documentation/api/dpois_8cpp_source.html" target="_blank" style="color:purple; text-decoration:underline">http://admb-project.org/documentation/api/dpois_8cpp_source.html</a>).
 After making the correction that I propose above and re-running ADMB, the program reports the correct log-likelihoods. The same problem can be found in dnbinom and maybe in other functions.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Given that the functions provided for the estimation of negative log-likelihoods are widely used, it would be important to check that their outputs are correct.</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
Best,</div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
--<span class="Apple-converted-space"> </span><br>
<span style="font-size:10pt; font-family:Arial,sans-serif">      I think [the island's] unusually sterile character gives it a grandeur <br>
      which more vegetation might have spoiled.       </span></div>
<div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-family:Arial,sans-serif">                                                   ----Ch. Darwin. El diario del Beagle       </span><br>
<span style="font-family:Arial,sans-serif"> </span><br>
<span style="font-family:Arial,sans-serif">Dr. Carlos Martorell </span><br>
<span style="font-family:Arial,sans-serif"> </span><br>
<span style="font-family:Arial,sans-serif">Departamento de Ecología y Recursos Naturales </span><br>
<span style="font-family:Arial,sans-serif">Facultad de Ciencias-UNAM </span><br>
<span style="font-family:Arial,sans-serif">Circuito Exterior S/N, Cd. Universitaria </span><br>
<span style="font-family:Arial,sans-serif">04510 México D.F. </span><br>
<span style="font-family:Arial,sans-serif">Tel.  (55) 5622 4835 Fax (55) 5622 4828 </span><br>
<span style="font-family:Arial,sans-serif; color:blue"><a href="http://www.fciencias.unam.mx/investigacion/grupos/biologia/ecologia/ambientesl" target="_blank" style="color:purple; text-decoration:underline">http://www.fciencias.unam.mx/investigacion/grupos/biologia/ecologia/ambientesl</a></span></div>
</div>
</div>
</div>
<p class="MsoNormal" style="margin:0in 0in 12pt; font-size:12pt; font-family:'Times New Roman',serif">
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@admb-project.org" style="color:purple; text-decoration:underline">Users@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/users" target="_blank" style="color:purple; text-decoration:underline">http://lists.admb-project.org/mailman/listinfo/users</a></p>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@admb-project.org" style="color:purple; text-decoration:underline">Users@admb-project.org</a><br>
<a href="http://lists.admb-project.org/mailman/listinfo/users" style="color:purple; text-decoration:underline">http://lists.admb-project.org/mailman/listinfo/users</a></div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
 </div>
<div class="MsoNormal" align="center" style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif; text-align:center">
<hr size="3" width="100%" align="center">
</div>
<div style="margin:0in 0in 0.0001pt; font-size:12pt; font-family:'Times New Roman',serif">
<span style="font-size:7.5pt; font-family:Arial,sans-serif; color:gray"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
 and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
 Immunities Act, 22 U.S.C. Sec. 288 et seq.</span></div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This internet e-mail message, and any files transmitted with it, contains confidential, privileged information that is intended only for the addressee. If you have received this e-mail message in error, please call us at (206) 634-1838 collect if necessary)
 and ask to speak to the message sender. Nothing in this e-mail or the act of transmitting it, is to be construed as a waiver of any rights or privileges enjoyed by the sender or the International Pacific Halibut Commission pursuant to the International Organizations
 Immunities Act, 22 U.S.C. Sec. 288 et seq.<br>
</font>
</body>
</html>