Skip to content

NBI & NBII not indexing correctly when falling back to poisson for small sigma #10

@joranE

Description

@joranE

For several of the functions in the NBI & NBII families there are lines of the form:

fy[sigma<=0.0001] <-  dPO(x, mu = mu, log = log)

that fall back to a Poisson density value for small sigma. However, the lack of any indexing on x or mu on the right hand side means that you get a vector length mismatch if this actually happens. I believe in each case the code should actually be doing something more like this:

idx <- sigma <= 0.0001
fy[idx] <- dPO(x[idx],mu = mu[idx],log = log)

A crude check of the source seems to surface this mistake in BB.R, NBI.R, NBII.R, DELAPORT.R, GeneralizedPoisson.R, ZIPIG.R and NBF.R.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions