scrogster / nimbleDistance

Functions to fit Bayesian distance sampling models using Nimble (https://github.com/nimble-dev/nimble). Inspired by the nimbleEcology package https://github.com/nimble-dev/nimbleEcology
GNU General Public License v3.0
5 stars 3 forks source link

Bug in Half-normal function #7

Closed dslramsey closed 1 year ago

dslramsey commented 1 year ago

I think there is a bug in the dHN.r code where you calculate the analytical integral for line transects. Currently it is

integral=pnorm(Xmax, 0, sigma)-0.5

However, I think the analytical integral should be

integral = 2*(pnorm(Xmax, 0, sigma)-0.5) * sqrt(pi/2) * sigma

I think the point transect one is OK

scrogster commented 1 year ago

Thanks Dave.

On Wed, Mar 22, 2023 at 2:07 PM Dave Ramsey @.***> wrote:

I think there is a bug in the dHN.r code where you calculate the analytical integral for line transects. Currently it is

integral=pnorm(Xmax, 0, sigma)-0.5

However, I think the analytical integral should be

integral = 2(pnorm(Xmax, 0, sigma)-0.5) sqrt(pi/2) * sigma

I think the point transect one is OK

— Reply to this email directly, view it on GitHub https://github.com/scrogster/nimbleDistance/issues/7, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJTVM2HD7VZHGLF6NCBG43W5JUGVANCNFSM6AAAAAAWDIHQSI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

scrogster commented 1 year ago

Bug is now corrected in dHN.R

scrogster commented 1 year ago

closing bug.