predIntPois() from EnvStats error with some set of numbers

Hi all,

I want to get the prediction intervals of the poisson probability distribution.
When I use the function predIntPois with this set of numbers predIntPois(c(70,73,80,66,62,64,73))
I get the error:
Error in ebinom(0, sum.x, ci = TRUE, ci.type = "two-sided", conf.level = 1 - :
'size' must be a postive integer at least as large as 'x'.

However if I change for example the last number of the set of numbers with 1 more or 1 less, I don't get an error. And it works perfectly. How is this possible?

predIntPois(c(70,73,80,66,62,64, 72))

Results of Distribution Parameter Estimation

Assumed Distribution: Poisson

Estimated Parameter(s): lambda = 69.57143

Estimation Method: mle/mme/mvue

Data: c(70, 73, 80, 66, 62, 64, 72)

Sample Size: 7

Prediction Interval Method: conditional

Prediction Interval Type: two-sided

Confidence Level: 95%

Number of Future Observations: 1

Prediction Interval: LPL = 48
UPL = 88*

Hopefully someone can help me. Thanks!

Anne

Hi @user4432,
Any duplicate values in x are causing the error:

predIntPois(c(70,73,80,66,62,64,73))$interval$limits  # Error

But this works:

predIntPois(c(70,73,80,66,62,64,73), k=1,
            method="conditional.approx.normal")$interval$limits  # No error

This may be a bug in the function. I have just contacted the package authors on GitHub to check.
HTH

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.