Re: [Rd] pbinom with size argument 0 (PR#8560)

From: Prof Brian Ripley <>
Date: Mon 06 Feb 2006 - 09:51:36 GMT

On Sun, 5 Feb 2006, Peter Dalgaard wrote:

> P Ehlers <> writes:
>> I prefer a (consistent) NaN. What happens to our notion of a
>> Binomial RV as a sequence of Bernoulli RVs if we permit n=0?
>> I have never seen (nor contemplated, I confess) the definition
>> of a Bernoulli RV as anything other than some dichotomous-outcome
>> one-trial random experiment.
> What's the problem ??
> An n=0 binomial is the sum of an empty set of Bernoulli RV's, and the
> sum over an empty set is identically 0.
>> Not n trials, where n might equal zero,
>> but _one_ trial. I can't see what would be gained by permitting a
>> zero-trial experiment. If we assign probability 1 to each outcome,
>> we have a problem with the sum of the probabilities.
> Consistency is what you gain. E.g.
> binom(.,n=n1+n2,p) == binom(.,n=n1,p) * binom(.,n=n2,p)
> where * denotes convolution. This will also hold for n1=0 or n2=0 if
> the binomial in that case is defined as a one-point distribution at
> zero. Same thing as any(logical(0)) etc., really.

Consistency is a Good Thing, and I had already altered the codebase to consistently allow size=0 as a discrete distribution concentrated at 0.

There were other inconsistencies, e.g. whether the geometric/negative binomial functions allow prob=0 or prob=1. I have no problem with prob=1 (it is a discrete distribution concentrated on one point) and this was addressed for rnbinom before (PR#1218) but subsequently broken (which is why we like regression tests ...). However prob=0 does not correspond to a proper distribution unless Inf is allowed as a value, and it was not so documented (nor implemented). Indeed we had

> dgeom(2, prob=0)

[1] 0
> dgeom(Inf, prob=0)

[1] 0
> pgeom(Inf, prob=0)

[1] 0

and in fact dgeom gave zero for every allowed value. So I cannot accept that as being right (and we even have a d-p-q-r test with prob=0).

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Mon Feb 06 21:14:52 2006

This archive was generated by hypermail 2.1.8 : Mon 06 Feb 2006 - 15:33:21 GMT